SlideShare une entreprise Scribd logo
1  sur  51
an introduction
about myself



  •Name: Patrick Lauber
  •Place: Zürich, Switzerland
  •Age: 29
  •Profession: CTO of tigermedia.ch
  •Nick: digi604
history



  •         .ch

   •django-cms 1.0 (django 0.96) menu,
    performance

   •django-page-cms (django 1.0, mptt,
    placeholders)

    •django-cms 2.0 (plugins)
    •django-cms 2.1 (menus, placeholder 2.0,
      frontedit)
the parts



   • pages
   • plugins
   • menu
   • frontedit
   • permissions
   • publisher
   • i18n-urls
pages

 •title
 •drag&drop
 •mptt
 •published?
 •in menu?
 •meta info
 •template
plugins

 •your content
 •mix it
 •placeholders
 •reorder
 •drag & drop
 •copy / paste
plugins



              {% load cms_tags %}

           {% placeholder header %}

          {% placeholder leftcolumn %}

           {% placeholder content %}

            {% placeholder footer %}
plugins



           already built in:

            text, picture,
              link, file,
          flash, googlemap,
               inherit,
           snippet, teaser
            twitter, video
plugins




                 get more at:

          www.django-cms.org/extensions
menu

 •Construct any menu the
  design requires with two
   template tags

 •breadcrumbs
 •menus package
menu




          {% load menu_tags %}

       {% show_menu 0 100 0 100 %}


                                 • From Level
                                 • To Level
                                 • Inactive Levels
                                 • Active Levels
menu




                 {% load menu_tags %}

            {% show_menu 0 100 0 100 %}


                                        • From Level
• Current Page                          • To Level
• Root Nodes &                          • Inactive Levels
 Siblings                               • Active Levels
menu




                 {% load menu_tags %}

            {% show_menu 0 100 0 100 %}


                                        • From Level
• Current Page                          • To Level
• Root Nodes &                          • Inactive Levels
 Siblings                               • Active Levels
menu




                 {% load menu_tags %}

            {% show_menu 0 100 0 100 %}


                                        • From Level
• Current Page                          • To Level
• Root Nodes &                          • Inactive Levels
 Siblings                               • Active Levels
menu




                 {% load menu_tags %}

            {% show_menu 0 100 0 100 %}


                                        • From Level
• Current Page                          • To Level
• Root Nodes &                          • Inactive Levels
 Siblings                               • Active Levels
menu




                 {% load menu_tags %}

            {% show_menu 0 100 1 100 %}


                                        • From Level
• Current Page                          • To Level
• Root Nodes &                          • Inactive Levels
 Siblings                               • Active Levels
menu




                 {% load menu_tags %}

            {% show_menu 0 100 1 100 %}


                                        • From Level
• Current Page                          • To Level
• Root Nodes &                          • Inactive Levels
 Siblings                               • Active Levels
menu




                 {% load menu_tags %}

            {% show_menu 1 100 1 100 %}


                                        • From Level
• Current Page                          • To Level
• Root Nodes &                          • Inactive Levels
 Siblings                               • Active Levels
menu




                 {% load menu_tags %}

            {% show_menu 1 100 1 100 %}


                                        • From Level
• Current Page                          • To Level
• Root Nodes &                          • Inactive Levels
 Siblings                               • Active Levels
menu




                 {% load menu_tags %}

    {% show_menu 1 100 1 100 "my_menu.html" %}


                                        • From Level
• Current Page                          • To Level
• Root Nodes &                          • Inactive Levels
 Siblings                               • Active Levels
menu




            {% load menu_tags %}

   {% show_sub_menu 100 "my_menu.html" %}
menu




             {% load menu_tags %}

   {% show_breadcrumb 0 "my_breadcrumb" %}
frontedit

 • Edit Plugins directly in
   frontend

 • Add “?edit” to url to
   enable

 • Customers love it
permissions

 •create users with inherited
  permissions

 •allow / disallow: moving,
  editing, adding,
   advanced settings, sites,
   moderation
publisher

 •Moderate content changes
 •get notified
 • content onlydeleted if
   published /
                gets

   approved
i18n-urls

 • Language prefix
   /de/your_url/

 • middleware based
 • no changesurls, apps your
   templates,
              needed to
integrating it

  • How your own project.
    into
         to integrate the cms



  • It’s just an app.
  1. Menus

  2. Attach Menus

  3. Navigation Modifiers

  4. App-hooks

  5. Custom Plugins

  6. Placeholders
menus

 • Addmenu own entries to
   the
       your



 • yourapp/menu.py
 • entries will be attached to
   the root.
menus – menu.py


    from menus.base import Menu, NavigationNode
	   from menus.menu_pool import menu_pool
	   from django.utils.translation import ugettext_lazy as _
	
	   class MyMenu(Menu):
	
	       def get_nodes(self, request):
	           nodes = []
	           n = NavigationNode(_("login"), reverse("auth_login"), 1)
	           n2 = NavigationNode(_("admin"), reverse("admin:root"), 2)
	           n3 = NavigationNode(_("My list"), "/mylist/", 3)
	           n4 = NavigationNode(_("My sublist"), "/mylist/sublist/", 4, 3)
	           nodes.append(n)
	           nodes.append(n2)
	           nodes.append(n3)
	           nodes.append(n4)
	           return nodes
	
	   menu_pool.register_menu(MyMenu)
attach menus

 • Inherits from instead of
   CMSAttachMenu
   Menu

 • Selectadvanced settings to
   page
          your menu in the

   attach.

 • Needs a name
attach menus – menu.py


    from   menus.base import Menu, NavigationNode
	   from   menus.menu_pool import menu_pool
	   from   django.utils.translation import ugettext_lazy as _
	   from   cms.menu_bases import CMSAttachMenu

	   class MyMenu(CMSAttachMenu):
	
	       name = _("My Menu")

	          def get_nodes(self, request):
	              nodes = []
	              n = NavigationNode(_("login"), reverse("auth_login"), 1)
	              n2 = NavigationNode(_("admin"), reverse("admin:root"), 2)
	              n3 = NavigationNode(_("My list"), "/mylist/", 3)
	              n4 = NavigationNode(_("My sublist"), "/mylist/sublist/", 4, 3)
	              nodes.append(n)
	              nodes.append(n2)
	              nodes.append(n3)
	              nodes.append(n4)
	              return nodes
	
	   menu_pool.register_menu(MyMenu)
menu modifiers

 • modify the whole menu
   tree

 • add or change properties
   of NavigationNodes

 • rearrange trees
 • applied in 3 situations:
   • pre cut
   • post cut
   • breadcrumb
menu modifiers


    from menus.base import Modifier
	   from menus.menu_pool import menu_pool

	   class MyModifier(Modifier):
	   	 """
	   	 Counts the nodes
	   	 """
	   	 def modify(self, request, nodes, namespace, root_id, post_cut, breadcrumb):
	   	 	 if post_cut or breadcrumb:
	   	 	 	 return nodes
	   	 	 count = 0
	       	 for node in nodes:
	   	 	 	 node.counter = count
	   	 	 	 count += 1
	   	 	 return nodes

	   menu_pool.register_modifier(MyModifier)
app-hooks

 • attach whole apps to a
   page.

 • myapp/cms_app.py
 • urls.py gets attached to a
   page url

 • needs server restart after
   changes :(
app-hooks – cms_app.py


    from   cms.app_base import CMSApp
	   from   cms.apphook_pool import apphook_pool
	   from   django.utils.translation import ugettext_lazy as _
	   from   myapp.menu import MyMenu

	   class MyApphook(CMSApp):
	       name = _("My App")
	       urls = ["myapp.urls"]
	
	   apphook_pool.register(MyApphook)
app-hooks – urls.py


    from django.conf.urls.defaults import *

	   urlpatterns = patterns("myapp.views",
	       url(r"^$', "main_view", name="app_main"),
	       url(r"^sublevel/$", "sample_view", name="app_sublevel"),
	   )	




• Page URL: /mypage/
• /mypage/ will be handled by main_view
• /mypage/sublevel/ will be handled by sample_view
• plugins from page are available in app templates
app-hooks
 • If page has german url as well:
   /meine_seite/

 • app is available at:
   /en/mypage/
   /de/meine_seite/

 • reverse("main_view") or {% url main_view
   %}will choose current language

 • to choose manually:
   • reverse("de:main_view")
   • reverse("en:main_view")
   • {% url de:main_view %}
app-hooks – cms_app.py


    from myapp.menu import CategoryMenu
	
	   class MyApphook(CMSApp):
	       name = _("My App")
	       urls = ["myapp.urls"]
	       menus = [CategoryMenu]
	
	   apphook_pool.register(MyApphook)




• If your app has a menu, attach it as well
• reverse in menu gets the language namespace as well
app-hooks – models.py


    from django.db import models
	   from django.core.urlresolvers import reverse
	   import mptt

	   class Category(models.Model):
	   	 parent = models.ForeignKey("self", blank=True, null=True)
	   	 name = models.CharField(max_length=20)

	   	   def __unicode__(self):
	   	   	 return self.name

	   	   def get_absolute_url(self):
	   	   	 return reverse("category_view", args=[self.pk])

	   try:
	   	 mptt.register(Category)
	   except mptt.AlreadyRegistered:
	   	 pass
app-hooks – menu.py


    from   menus.base import NavigationNode
	   from   menus.menu_pool import menu_pool
	   from   django.utils.translation import ugettext_lazy as _
	   from   cms.menu_bases import CMSAttachMenu
	   from   myapp.models import Category
	
	   class CategoryMenu(CMSAttachMenu):
	
	   	   name = _("My Category Menu")
	
	   	   def get_nodes(self, request):
	   	   	 nodes = []
	   	   	 for category in Category.objects.all().order_by("tree_id", "lft"):
	   	   	 	 nodes.append(
	   	   	 	 	 NavigationNode(
	   	   	 	 	 	 category.name,
	   	   	 	 	 	 category.pk,
	   	   	 	 	 	 category.parent_id
	   	   	 	 	 )
	   	   	 	 )
	   	   	 return nodes
	
	   menu_pool.register_menu(CategoryMenu)
custom plugins

 •your data as a plugin
 •teasers for your app data
 •yourapp/cms_plugins.py
 • model inherits from
   CMSPlugin
custom plugins – models.py

  	
  class Gallery(models.Model):
  	 name = models.CharField(max_length=30)
  	
  class Picture(models.Model):
  	 gallery = models.ForeignKey(Gallery)
  	 image = models.ImageField(upload_to="uploads/images/")
  	 description = models.CharField(max_length=60)
custom plugins – models.py


  from cms.models import CMSPlugin
  	
  class GalleryPlugin(CMSPlugin):
  	 gallery = models.ForeignKey(Gallery)
custom plugins – cms_plugins.py


  from cms.plugin_base import CMSPluginBase
  from cms.plugin_pool import plugin_pool
  from models import GalleryPlugin
  from django.utils.translation import ugettext as _
  	
  class CMSGalleryPlugin(CMSPluginBase):
  	 model = GalleryPlugin
  	 name = _("Gallery")
  	 render_template = "cms/plugins/gallery.html"
  	
  	 def render(self, context, instance, placeholder):
  	 	 context.update({
  	 	 	 "gallery":instance.gallery,
  	 	 	 "object":instance,
  	 	 	 "placeholder":placeholder
  	 	 })
  	 	 return context

  plugin_pool.register_plugin(CMSGalleryPlugin)
custom plugins

 • CMSPluginBase extends
   from ModelAdmin

 • text enabled plugins
 • plugins are a tree (mptt)
 • plugin media
 • plugin rules in your
   settings.py

 • Plugin Context Processors
   (add Context to render)

 • Plugin Processors (Modify
   output of plugins)
placeholders

 • use the plugin system in
   your own apps.

 • works with frontedit :)
placeholders - models.py

  	 	
  from django.db import models
  from cms.models.fields import PlaceholderField
  	
  class MyBlog(models.Model):
  	 title = models.CharField(max_length=100)
  	 slug = models.SlugField(max_length=100)
  	 content = PlaceholderField("blog_content")
placeholders - admin.py


  from django.contrib import admin
  from cms.admin.placeholderadmin import PlaceholderAdmin
  from models import MyBlog

  class MyBlogAdmin(PlaceholderAdmin):
  	 prepopulated_fields = {"slug": ("title",)} #just for the slug field

  admin.site.register(MyBlog, MyBlogAdmin)
placeholders - template.html


  {% load placeholder_tags %}
  	
  {% render_placeholder myblog_instance.content %}
the future

 • 2.1 release
   • sprints → RC1?
 • 2.2
   • page extenders
   • more modularization
       • tree
       • permissions
       • publisher
       • frontedit
Thank you

   •Questions?




   •contact: digi@treepy.com
   •www.django-cms.org
   •http://github.com/digi604/django-cms-2.0/
   •#django-cms @ irc.freenode.net
   some pictures from: zazzle.com, thechive.com, google image search :)

Contenu connexe

Dernier

Strategize a Smooth Tenant-to-tenant Migration and Copilot Takeoff
Strategize a Smooth Tenant-to-tenant Migration and Copilot TakeoffStrategize a Smooth Tenant-to-tenant Migration and Copilot Takeoff
Strategize a Smooth Tenant-to-tenant Migration and Copilot Takeoffsammart93
 
WSO2's API Vision: Unifying Control, Empowering Developers
WSO2's API Vision: Unifying Control, Empowering DevelopersWSO2's API Vision: Unifying Control, Empowering Developers
WSO2's API Vision: Unifying Control, Empowering DevelopersWSO2
 
Apidays New York 2024 - Accelerating FinTech Innovation by Vasa Krishnan, Fin...
Apidays New York 2024 - Accelerating FinTech Innovation by Vasa Krishnan, Fin...Apidays New York 2024 - Accelerating FinTech Innovation by Vasa Krishnan, Fin...
Apidays New York 2024 - Accelerating FinTech Innovation by Vasa Krishnan, Fin...apidays
 
Spring Boot vs Quarkus the ultimate battle - DevoxxUK
Spring Boot vs Quarkus the ultimate battle - DevoxxUKSpring Boot vs Quarkus the ultimate battle - DevoxxUK
Spring Boot vs Quarkus the ultimate battle - DevoxxUKJago de Vreede
 
Modular Monolith - a Practical Alternative to Microservices @ Devoxx UK 2024
Modular Monolith - a Practical Alternative to Microservices @ Devoxx UK 2024Modular Monolith - a Practical Alternative to Microservices @ Devoxx UK 2024
Modular Monolith - a Practical Alternative to Microservices @ Devoxx UK 2024Victor Rentea
 
TrustArc Webinar - Unlock the Power of AI-Driven Data Discovery
TrustArc Webinar - Unlock the Power of AI-Driven Data DiscoveryTrustArc Webinar - Unlock the Power of AI-Driven Data Discovery
TrustArc Webinar - Unlock the Power of AI-Driven Data DiscoveryTrustArc
 
AI in Action: Real World Use Cases by Anitaraj
AI in Action: Real World Use Cases by AnitarajAI in Action: Real World Use Cases by Anitaraj
AI in Action: Real World Use Cases by AnitarajAnitaRaj43
 
Exploring Multimodal Embeddings with Milvus
Exploring Multimodal Embeddings with MilvusExploring Multimodal Embeddings with Milvus
Exploring Multimodal Embeddings with MilvusZilliz
 
MINDCTI Revenue Release Quarter One 2024
MINDCTI Revenue Release Quarter One 2024MINDCTI Revenue Release Quarter One 2024
MINDCTI Revenue Release Quarter One 2024MIND CTI
 
JohnPollard-hybrid-app-RailsConf2024.pptx
JohnPollard-hybrid-app-RailsConf2024.pptxJohnPollard-hybrid-app-RailsConf2024.pptx
JohnPollard-hybrid-app-RailsConf2024.pptxJohnPollard37
 
Architecting Cloud Native Applications
Architecting Cloud Native ApplicationsArchitecting Cloud Native Applications
Architecting Cloud Native ApplicationsWSO2
 
Cloud Frontiers: A Deep Dive into Serverless Spatial Data and FME
Cloud Frontiers:  A Deep Dive into Serverless Spatial Data and FMECloud Frontiers:  A Deep Dive into Serverless Spatial Data and FME
Cloud Frontiers: A Deep Dive into Serverless Spatial Data and FMESafe Software
 
Web Form Automation for Bonterra Impact Management (fka Social Solutions Apri...
Web Form Automation for Bonterra Impact Management (fka Social Solutions Apri...Web Form Automation for Bonterra Impact Management (fka Social Solutions Apri...
Web Form Automation for Bonterra Impact Management (fka Social Solutions Apri...Jeffrey Haguewood
 
Polkadot JAM Slides - Token2049 - By Dr. Gavin Wood
Polkadot JAM Slides - Token2049 - By Dr. Gavin WoodPolkadot JAM Slides - Token2049 - By Dr. Gavin Wood
Polkadot JAM Slides - Token2049 - By Dr. Gavin WoodJuan lago vázquez
 
AWS Community Day CPH - Three problems of Terraform
AWS Community Day CPH - Three problems of TerraformAWS Community Day CPH - Three problems of Terraform
AWS Community Day CPH - Three problems of TerraformAndrey Devyatkin
 
Apidays New York 2024 - Passkeys: Developing APIs to enable passwordless auth...
Apidays New York 2024 - Passkeys: Developing APIs to enable passwordless auth...Apidays New York 2024 - Passkeys: Developing APIs to enable passwordless auth...
Apidays New York 2024 - Passkeys: Developing APIs to enable passwordless auth...apidays
 
Cloud Frontiers: A Deep Dive into Serverless Spatial Data and FME
Cloud Frontiers:  A Deep Dive into Serverless Spatial Data and FMECloud Frontiers:  A Deep Dive into Serverless Spatial Data and FME
Cloud Frontiers: A Deep Dive into Serverless Spatial Data and FMESafe Software
 
Why Teams call analytics are critical to your entire business
Why Teams call analytics are critical to your entire businessWhy Teams call analytics are critical to your entire business
Why Teams call analytics are critical to your entire businesspanagenda
 
Apidays New York 2024 - Scaling API-first by Ian Reasor and Radu Cotescu, Adobe
Apidays New York 2024 - Scaling API-first by Ian Reasor and Radu Cotescu, AdobeApidays New York 2024 - Scaling API-first by Ian Reasor and Radu Cotescu, Adobe
Apidays New York 2024 - Scaling API-first by Ian Reasor and Radu Cotescu, Adobeapidays
 

Dernier (20)

Strategize a Smooth Tenant-to-tenant Migration and Copilot Takeoff
Strategize a Smooth Tenant-to-tenant Migration and Copilot TakeoffStrategize a Smooth Tenant-to-tenant Migration and Copilot Takeoff
Strategize a Smooth Tenant-to-tenant Migration and Copilot Takeoff
 
WSO2's API Vision: Unifying Control, Empowering Developers
WSO2's API Vision: Unifying Control, Empowering DevelopersWSO2's API Vision: Unifying Control, Empowering Developers
WSO2's API Vision: Unifying Control, Empowering Developers
 
Apidays New York 2024 - Accelerating FinTech Innovation by Vasa Krishnan, Fin...
Apidays New York 2024 - Accelerating FinTech Innovation by Vasa Krishnan, Fin...Apidays New York 2024 - Accelerating FinTech Innovation by Vasa Krishnan, Fin...
Apidays New York 2024 - Accelerating FinTech Innovation by Vasa Krishnan, Fin...
 
Spring Boot vs Quarkus the ultimate battle - DevoxxUK
Spring Boot vs Quarkus the ultimate battle - DevoxxUKSpring Boot vs Quarkus the ultimate battle - DevoxxUK
Spring Boot vs Quarkus the ultimate battle - DevoxxUK
 
Modular Monolith - a Practical Alternative to Microservices @ Devoxx UK 2024
Modular Monolith - a Practical Alternative to Microservices @ Devoxx UK 2024Modular Monolith - a Practical Alternative to Microservices @ Devoxx UK 2024
Modular Monolith - a Practical Alternative to Microservices @ Devoxx UK 2024
 
TrustArc Webinar - Unlock the Power of AI-Driven Data Discovery
TrustArc Webinar - Unlock the Power of AI-Driven Data DiscoveryTrustArc Webinar - Unlock the Power of AI-Driven Data Discovery
TrustArc Webinar - Unlock the Power of AI-Driven Data Discovery
 
AI in Action: Real World Use Cases by Anitaraj
AI in Action: Real World Use Cases by AnitarajAI in Action: Real World Use Cases by Anitaraj
AI in Action: Real World Use Cases by Anitaraj
 
Exploring Multimodal Embeddings with Milvus
Exploring Multimodal Embeddings with MilvusExploring Multimodal Embeddings with Milvus
Exploring Multimodal Embeddings with Milvus
 
MINDCTI Revenue Release Quarter One 2024
MINDCTI Revenue Release Quarter One 2024MINDCTI Revenue Release Quarter One 2024
MINDCTI Revenue Release Quarter One 2024
 
JohnPollard-hybrid-app-RailsConf2024.pptx
JohnPollard-hybrid-app-RailsConf2024.pptxJohnPollard-hybrid-app-RailsConf2024.pptx
JohnPollard-hybrid-app-RailsConf2024.pptx
 
Architecting Cloud Native Applications
Architecting Cloud Native ApplicationsArchitecting Cloud Native Applications
Architecting Cloud Native Applications
 
Cloud Frontiers: A Deep Dive into Serverless Spatial Data and FME
Cloud Frontiers:  A Deep Dive into Serverless Spatial Data and FMECloud Frontiers:  A Deep Dive into Serverless Spatial Data and FME
Cloud Frontiers: A Deep Dive into Serverless Spatial Data and FME
 
Web Form Automation for Bonterra Impact Management (fka Social Solutions Apri...
Web Form Automation for Bonterra Impact Management (fka Social Solutions Apri...Web Form Automation for Bonterra Impact Management (fka Social Solutions Apri...
Web Form Automation for Bonterra Impact Management (fka Social Solutions Apri...
 
Polkadot JAM Slides - Token2049 - By Dr. Gavin Wood
Polkadot JAM Slides - Token2049 - By Dr. Gavin WoodPolkadot JAM Slides - Token2049 - By Dr. Gavin Wood
Polkadot JAM Slides - Token2049 - By Dr. Gavin Wood
 
AWS Community Day CPH - Three problems of Terraform
AWS Community Day CPH - Three problems of TerraformAWS Community Day CPH - Three problems of Terraform
AWS Community Day CPH - Three problems of Terraform
 
Apidays New York 2024 - Passkeys: Developing APIs to enable passwordless auth...
Apidays New York 2024 - Passkeys: Developing APIs to enable passwordless auth...Apidays New York 2024 - Passkeys: Developing APIs to enable passwordless auth...
Apidays New York 2024 - Passkeys: Developing APIs to enable passwordless auth...
 
Cloud Frontiers: A Deep Dive into Serverless Spatial Data and FME
Cloud Frontiers:  A Deep Dive into Serverless Spatial Data and FMECloud Frontiers:  A Deep Dive into Serverless Spatial Data and FME
Cloud Frontiers: A Deep Dive into Serverless Spatial Data and FME
 
Why Teams call analytics are critical to your entire business
Why Teams call analytics are critical to your entire businessWhy Teams call analytics are critical to your entire business
Why Teams call analytics are critical to your entire business
 
Apidays New York 2024 - Scaling API-first by Ian Reasor and Radu Cotescu, Adobe
Apidays New York 2024 - Scaling API-first by Ian Reasor and Radu Cotescu, AdobeApidays New York 2024 - Scaling API-first by Ian Reasor and Radu Cotescu, Adobe
Apidays New York 2024 - Scaling API-first by Ian Reasor and Radu Cotescu, Adobe
 
Understanding the FAA Part 107 License ..
Understanding the FAA Part 107 License ..Understanding the FAA Part 107 License ..
Understanding the FAA Part 107 License ..
 

En vedette

2024 State of Marketing Report – by Hubspot
2024 State of Marketing Report – by Hubspot2024 State of Marketing Report – by Hubspot
2024 State of Marketing Report – by HubspotMarius Sescu
 
Everything You Need To Know About ChatGPT
Everything You Need To Know About ChatGPTEverything You Need To Know About ChatGPT
Everything You Need To Know About ChatGPTExpeed Software
 
Product Design Trends in 2024 | Teenage Engineerings
Product Design Trends in 2024 | Teenage EngineeringsProduct Design Trends in 2024 | Teenage Engineerings
Product Design Trends in 2024 | Teenage EngineeringsPixeldarts
 
How Race, Age and Gender Shape Attitudes Towards Mental Health
How Race, Age and Gender Shape Attitudes Towards Mental HealthHow Race, Age and Gender Shape Attitudes Towards Mental Health
How Race, Age and Gender Shape Attitudes Towards Mental HealthThinkNow
 
AI Trends in Creative Operations 2024 by Artwork Flow.pdf
AI Trends in Creative Operations 2024 by Artwork Flow.pdfAI Trends in Creative Operations 2024 by Artwork Flow.pdf
AI Trends in Creative Operations 2024 by Artwork Flow.pdfmarketingartwork
 
PEPSICO Presentation to CAGNY Conference Feb 2024
PEPSICO Presentation to CAGNY Conference Feb 2024PEPSICO Presentation to CAGNY Conference Feb 2024
PEPSICO Presentation to CAGNY Conference Feb 2024Neil Kimberley
 
Content Methodology: A Best Practices Report (Webinar)
Content Methodology: A Best Practices Report (Webinar)Content Methodology: A Best Practices Report (Webinar)
Content Methodology: A Best Practices Report (Webinar)contently
 
How to Prepare For a Successful Job Search for 2024
How to Prepare For a Successful Job Search for 2024How to Prepare For a Successful Job Search for 2024
How to Prepare For a Successful Job Search for 2024Albert Qian
 
Social Media Marketing Trends 2024 // The Global Indie Insights
Social Media Marketing Trends 2024 // The Global Indie InsightsSocial Media Marketing Trends 2024 // The Global Indie Insights
Social Media Marketing Trends 2024 // The Global Indie InsightsKurio // The Social Media Age(ncy)
 
Trends In Paid Search: Navigating The Digital Landscape In 2024
Trends In Paid Search: Navigating The Digital Landscape In 2024Trends In Paid Search: Navigating The Digital Landscape In 2024
Trends In Paid Search: Navigating The Digital Landscape In 2024Search Engine Journal
 
5 Public speaking tips from TED - Visualized summary
5 Public speaking tips from TED - Visualized summary5 Public speaking tips from TED - Visualized summary
5 Public speaking tips from TED - Visualized summarySpeakerHub
 
ChatGPT and the Future of Work - Clark Boyd
ChatGPT and the Future of Work - Clark Boyd ChatGPT and the Future of Work - Clark Boyd
ChatGPT and the Future of Work - Clark Boyd Clark Boyd
 
Getting into the tech field. what next
Getting into the tech field. what next Getting into the tech field. what next
Getting into the tech field. what next Tessa Mero
 
Google's Just Not That Into You: Understanding Core Updates & Search Intent
Google's Just Not That Into You: Understanding Core Updates & Search IntentGoogle's Just Not That Into You: Understanding Core Updates & Search Intent
Google's Just Not That Into You: Understanding Core Updates & Search IntentLily Ray
 
Time Management & Productivity - Best Practices
Time Management & Productivity -  Best PracticesTime Management & Productivity -  Best Practices
Time Management & Productivity - Best PracticesVit Horky
 
The six step guide to practical project management
The six step guide to practical project managementThe six step guide to practical project management
The six step guide to practical project managementMindGenius
 
Beginners Guide to TikTok for Search - Rachel Pearson - We are Tilt __ Bright...
Beginners Guide to TikTok for Search - Rachel Pearson - We are Tilt __ Bright...Beginners Guide to TikTok for Search - Rachel Pearson - We are Tilt __ Bright...
Beginners Guide to TikTok for Search - Rachel Pearson - We are Tilt __ Bright...RachelPearson36
 

En vedette (20)

2024 State of Marketing Report – by Hubspot
2024 State of Marketing Report – by Hubspot2024 State of Marketing Report – by Hubspot
2024 State of Marketing Report – by Hubspot
 
Everything You Need To Know About ChatGPT
Everything You Need To Know About ChatGPTEverything You Need To Know About ChatGPT
Everything You Need To Know About ChatGPT
 
Product Design Trends in 2024 | Teenage Engineerings
Product Design Trends in 2024 | Teenage EngineeringsProduct Design Trends in 2024 | Teenage Engineerings
Product Design Trends in 2024 | Teenage Engineerings
 
How Race, Age and Gender Shape Attitudes Towards Mental Health
How Race, Age and Gender Shape Attitudes Towards Mental HealthHow Race, Age and Gender Shape Attitudes Towards Mental Health
How Race, Age and Gender Shape Attitudes Towards Mental Health
 
AI Trends in Creative Operations 2024 by Artwork Flow.pdf
AI Trends in Creative Operations 2024 by Artwork Flow.pdfAI Trends in Creative Operations 2024 by Artwork Flow.pdf
AI Trends in Creative Operations 2024 by Artwork Flow.pdf
 
Skeleton Culture Code
Skeleton Culture CodeSkeleton Culture Code
Skeleton Culture Code
 
PEPSICO Presentation to CAGNY Conference Feb 2024
PEPSICO Presentation to CAGNY Conference Feb 2024PEPSICO Presentation to CAGNY Conference Feb 2024
PEPSICO Presentation to CAGNY Conference Feb 2024
 
Content Methodology: A Best Practices Report (Webinar)
Content Methodology: A Best Practices Report (Webinar)Content Methodology: A Best Practices Report (Webinar)
Content Methodology: A Best Practices Report (Webinar)
 
How to Prepare For a Successful Job Search for 2024
How to Prepare For a Successful Job Search for 2024How to Prepare For a Successful Job Search for 2024
How to Prepare For a Successful Job Search for 2024
 
Social Media Marketing Trends 2024 // The Global Indie Insights
Social Media Marketing Trends 2024 // The Global Indie InsightsSocial Media Marketing Trends 2024 // The Global Indie Insights
Social Media Marketing Trends 2024 // The Global Indie Insights
 
Trends In Paid Search: Navigating The Digital Landscape In 2024
Trends In Paid Search: Navigating The Digital Landscape In 2024Trends In Paid Search: Navigating The Digital Landscape In 2024
Trends In Paid Search: Navigating The Digital Landscape In 2024
 
5 Public speaking tips from TED - Visualized summary
5 Public speaking tips from TED - Visualized summary5 Public speaking tips from TED - Visualized summary
5 Public speaking tips from TED - Visualized summary
 
ChatGPT and the Future of Work - Clark Boyd
ChatGPT and the Future of Work - Clark Boyd ChatGPT and the Future of Work - Clark Boyd
ChatGPT and the Future of Work - Clark Boyd
 
Getting into the tech field. what next
Getting into the tech field. what next Getting into the tech field. what next
Getting into the tech field. what next
 
Google's Just Not That Into You: Understanding Core Updates & Search Intent
Google's Just Not That Into You: Understanding Core Updates & Search IntentGoogle's Just Not That Into You: Understanding Core Updates & Search Intent
Google's Just Not That Into You: Understanding Core Updates & Search Intent
 
How to have difficult conversations
How to have difficult conversations How to have difficult conversations
How to have difficult conversations
 
Introduction to Data Science
Introduction to Data ScienceIntroduction to Data Science
Introduction to Data Science
 
Time Management & Productivity - Best Practices
Time Management & Productivity -  Best PracticesTime Management & Productivity -  Best Practices
Time Management & Productivity - Best Practices
 
The six step guide to practical project management
The six step guide to practical project managementThe six step guide to practical project management
The six step guide to practical project management
 
Beginners Guide to TikTok for Search - Rachel Pearson - We are Tilt __ Bright...
Beginners Guide to TikTok for Search - Rachel Pearson - We are Tilt __ Bright...Beginners Guide to TikTok for Search - Rachel Pearson - We are Tilt __ Bright...
Beginners Guide to TikTok for Search - Rachel Pearson - We are Tilt __ Bright...
 

Django cms.key

  • 2. about myself •Name: Patrick Lauber •Place: Zürich, Switzerland •Age: 29 •Profession: CTO of tigermedia.ch •Nick: digi604
  • 3. history • .ch •django-cms 1.0 (django 0.96) menu, performance •django-page-cms (django 1.0, mptt, placeholders) •django-cms 2.0 (plugins) •django-cms 2.1 (menus, placeholder 2.0, frontedit)
  • 4. the parts • pages • plugins • menu • frontedit • permissions • publisher • i18n-urls
  • 5. pages •title •drag&drop •mptt •published? •in menu? •meta info •template
  • 6. plugins •your content •mix it •placeholders •reorder •drag & drop •copy / paste
  • 7. plugins {% load cms_tags %} {% placeholder header %} {% placeholder leftcolumn %} {% placeholder content %} {% placeholder footer %}
  • 8. plugins already built in: text, picture, link, file, flash, googlemap, inherit, snippet, teaser twitter, video
  • 9. plugins get more at: www.django-cms.org/extensions
  • 10. menu •Construct any menu the design requires with two template tags •breadcrumbs •menus package
  • 11. menu {% load menu_tags %} {% show_menu 0 100 0 100 %} • From Level • To Level • Inactive Levels • Active Levels
  • 12. menu {% load menu_tags %} {% show_menu 0 100 0 100 %} • From Level • Current Page • To Level • Root Nodes & • Inactive Levels Siblings • Active Levels
  • 13. menu {% load menu_tags %} {% show_menu 0 100 0 100 %} • From Level • Current Page • To Level • Root Nodes & • Inactive Levels Siblings • Active Levels
  • 14. menu {% load menu_tags %} {% show_menu 0 100 0 100 %} • From Level • Current Page • To Level • Root Nodes & • Inactive Levels Siblings • Active Levels
  • 15. menu {% load menu_tags %} {% show_menu 0 100 0 100 %} • From Level • Current Page • To Level • Root Nodes & • Inactive Levels Siblings • Active Levels
  • 16. menu {% load menu_tags %} {% show_menu 0 100 1 100 %} • From Level • Current Page • To Level • Root Nodes & • Inactive Levels Siblings • Active Levels
  • 17. menu {% load menu_tags %} {% show_menu 0 100 1 100 %} • From Level • Current Page • To Level • Root Nodes & • Inactive Levels Siblings • Active Levels
  • 18. menu {% load menu_tags %} {% show_menu 1 100 1 100 %} • From Level • Current Page • To Level • Root Nodes & • Inactive Levels Siblings • Active Levels
  • 19. menu {% load menu_tags %} {% show_menu 1 100 1 100 %} • From Level • Current Page • To Level • Root Nodes & • Inactive Levels Siblings • Active Levels
  • 20. menu {% load menu_tags %} {% show_menu 1 100 1 100 "my_menu.html" %} • From Level • Current Page • To Level • Root Nodes & • Inactive Levels Siblings • Active Levels
  • 21. menu {% load menu_tags %} {% show_sub_menu 100 "my_menu.html" %}
  • 22. menu {% load menu_tags %} {% show_breadcrumb 0 "my_breadcrumb" %}
  • 23. frontedit • Edit Plugins directly in frontend • Add “?edit” to url to enable • Customers love it
  • 24. permissions •create users with inherited permissions •allow / disallow: moving, editing, adding, advanced settings, sites, moderation
  • 25. publisher •Moderate content changes •get notified • content onlydeleted if published / gets approved
  • 26. i18n-urls • Language prefix /de/your_url/ • middleware based • no changesurls, apps your templates, needed to
  • 27. integrating it • How your own project. into to integrate the cms • It’s just an app. 1. Menus 2. Attach Menus 3. Navigation Modifiers 4. App-hooks 5. Custom Plugins 6. Placeholders
  • 28. menus • Addmenu own entries to the your • yourapp/menu.py • entries will be attached to the root.
  • 29. menus – menu.py from menus.base import Menu, NavigationNode from menus.menu_pool import menu_pool from django.utils.translation import ugettext_lazy as _ class MyMenu(Menu): def get_nodes(self, request): nodes = [] n = NavigationNode(_("login"), reverse("auth_login"), 1) n2 = NavigationNode(_("admin"), reverse("admin:root"), 2) n3 = NavigationNode(_("My list"), "/mylist/", 3) n4 = NavigationNode(_("My sublist"), "/mylist/sublist/", 4, 3) nodes.append(n) nodes.append(n2) nodes.append(n3) nodes.append(n4) return nodes menu_pool.register_menu(MyMenu)
  • 30. attach menus • Inherits from instead of CMSAttachMenu Menu • Selectadvanced settings to page your menu in the attach. • Needs a name
  • 31. attach menus – menu.py from menus.base import Menu, NavigationNode from menus.menu_pool import menu_pool from django.utils.translation import ugettext_lazy as _ from cms.menu_bases import CMSAttachMenu class MyMenu(CMSAttachMenu): name = _("My Menu") def get_nodes(self, request): nodes = [] n = NavigationNode(_("login"), reverse("auth_login"), 1) n2 = NavigationNode(_("admin"), reverse("admin:root"), 2) n3 = NavigationNode(_("My list"), "/mylist/", 3) n4 = NavigationNode(_("My sublist"), "/mylist/sublist/", 4, 3) nodes.append(n) nodes.append(n2) nodes.append(n3) nodes.append(n4) return nodes menu_pool.register_menu(MyMenu)
  • 32. menu modifiers • modify the whole menu tree • add or change properties of NavigationNodes • rearrange trees • applied in 3 situations: • pre cut • post cut • breadcrumb
  • 33. menu modifiers from menus.base import Modifier from menus.menu_pool import menu_pool class MyModifier(Modifier): """ Counts the nodes """ def modify(self, request, nodes, namespace, root_id, post_cut, breadcrumb): if post_cut or breadcrumb: return nodes count = 0 for node in nodes: node.counter = count count += 1 return nodes menu_pool.register_modifier(MyModifier)
  • 34. app-hooks • attach whole apps to a page. • myapp/cms_app.py • urls.py gets attached to a page url • needs server restart after changes :(
  • 35. app-hooks – cms_app.py from cms.app_base import CMSApp from cms.apphook_pool import apphook_pool from django.utils.translation import ugettext_lazy as _ from myapp.menu import MyMenu class MyApphook(CMSApp): name = _("My App") urls = ["myapp.urls"] apphook_pool.register(MyApphook)
  • 36. app-hooks – urls.py from django.conf.urls.defaults import * urlpatterns = patterns("myapp.views", url(r"^$', "main_view", name="app_main"), url(r"^sublevel/$", "sample_view", name="app_sublevel"), ) • Page URL: /mypage/ • /mypage/ will be handled by main_view • /mypage/sublevel/ will be handled by sample_view • plugins from page are available in app templates
  • 37. app-hooks • If page has german url as well: /meine_seite/ • app is available at: /en/mypage/ /de/meine_seite/ • reverse("main_view") or {% url main_view %}will choose current language • to choose manually: • reverse("de:main_view") • reverse("en:main_view") • {% url de:main_view %}
  • 38. app-hooks – cms_app.py from myapp.menu import CategoryMenu class MyApphook(CMSApp): name = _("My App") urls = ["myapp.urls"] menus = [CategoryMenu] apphook_pool.register(MyApphook) • If your app has a menu, attach it as well • reverse in menu gets the language namespace as well
  • 39. app-hooks – models.py from django.db import models from django.core.urlresolvers import reverse import mptt class Category(models.Model): parent = models.ForeignKey("self", blank=True, null=True) name = models.CharField(max_length=20) def __unicode__(self): return self.name def get_absolute_url(self): return reverse("category_view", args=[self.pk]) try: mptt.register(Category) except mptt.AlreadyRegistered: pass
  • 40. app-hooks – menu.py from menus.base import NavigationNode from menus.menu_pool import menu_pool from django.utils.translation import ugettext_lazy as _ from cms.menu_bases import CMSAttachMenu from myapp.models import Category class CategoryMenu(CMSAttachMenu): name = _("My Category Menu") def get_nodes(self, request): nodes = [] for category in Category.objects.all().order_by("tree_id", "lft"): nodes.append( NavigationNode( category.name, category.pk, category.parent_id ) ) return nodes menu_pool.register_menu(CategoryMenu)
  • 41. custom plugins •your data as a plugin •teasers for your app data •yourapp/cms_plugins.py • model inherits from CMSPlugin
  • 42. custom plugins – models.py class Gallery(models.Model): name = models.CharField(max_length=30) class Picture(models.Model): gallery = models.ForeignKey(Gallery) image = models.ImageField(upload_to="uploads/images/") description = models.CharField(max_length=60)
  • 43. custom plugins – models.py from cms.models import CMSPlugin class GalleryPlugin(CMSPlugin): gallery = models.ForeignKey(Gallery)
  • 44. custom plugins – cms_plugins.py from cms.plugin_base import CMSPluginBase from cms.plugin_pool import plugin_pool from models import GalleryPlugin from django.utils.translation import ugettext as _ class CMSGalleryPlugin(CMSPluginBase): model = GalleryPlugin name = _("Gallery") render_template = "cms/plugins/gallery.html" def render(self, context, instance, placeholder): context.update({ "gallery":instance.gallery, "object":instance, "placeholder":placeholder }) return context plugin_pool.register_plugin(CMSGalleryPlugin)
  • 45. custom plugins • CMSPluginBase extends from ModelAdmin • text enabled plugins • plugins are a tree (mptt) • plugin media • plugin rules in your settings.py • Plugin Context Processors (add Context to render) • Plugin Processors (Modify output of plugins)
  • 46. placeholders • use the plugin system in your own apps. • works with frontedit :)
  • 47. placeholders - models.py from django.db import models from cms.models.fields import PlaceholderField class MyBlog(models.Model): title = models.CharField(max_length=100) slug = models.SlugField(max_length=100) content = PlaceholderField("blog_content")
  • 48. placeholders - admin.py from django.contrib import admin from cms.admin.placeholderadmin import PlaceholderAdmin from models import MyBlog class MyBlogAdmin(PlaceholderAdmin): prepopulated_fields = {"slug": ("title",)} #just for the slug field admin.site.register(MyBlog, MyBlogAdmin)
  • 49. placeholders - template.html {% load placeholder_tags %} {% render_placeholder myblog_instance.content %}
  • 50. the future • 2.1 release • sprints → RC1? • 2.2 • page extenders • more modularization • tree • permissions • publisher • frontedit
  • 51. Thank you •Questions? •contact: digi@treepy.com •www.django-cms.org •http://github.com/digi604/django-cms-2.0/ •#django-cms @ irc.freenode.net some pictures from: zazzle.com, thechive.com, google image search :)

Notes de l'éditeur