SlideShare una empresa de Scribd logo
1 de 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 :)

Más contenido relacionado

Último

CNv6 Instructor Chapter 6 Quality of Service
CNv6 Instructor Chapter 6 Quality of ServiceCNv6 Instructor Chapter 6 Quality of Service
CNv6 Instructor Chapter 6 Quality of Servicegiselly40
 
GenCyber Cyber Security Day Presentation
GenCyber Cyber Security Day PresentationGenCyber Cyber Security Day Presentation
GenCyber Cyber Security Day PresentationMichael W. Hawkins
 
How to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected WorkerHow to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected WorkerThousandEyes
 
How to convert PDF to text with Nanonets
How to convert PDF to text with NanonetsHow to convert PDF to text with Nanonets
How to convert PDF to text with Nanonetsnaman860154
 
Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...
Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...
Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...apidays
 
Automating Google Workspace (GWS) & more with Apps Script
Automating Google Workspace (GWS) & more with Apps ScriptAutomating Google Workspace (GWS) & more with Apps Script
Automating Google Workspace (GWS) & more with Apps Scriptwesley chun
 
Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024
Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024
Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024The Digital Insurer
 
The 7 Things I Know About Cyber Security After 25 Years | April 2024
The 7 Things I Know About Cyber Security After 25 Years | April 2024The 7 Things I Know About Cyber Security After 25 Years | April 2024
The 7 Things I Know About Cyber Security After 25 Years | April 2024Rafal Los
 
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...Miguel Araújo
 
Artificial Intelligence: Facts and Myths
Artificial Intelligence: Facts and MythsArtificial Intelligence: Facts and Myths
Artificial Intelligence: Facts and MythsJoaquim Jorge
 
The Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdf
The Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdfThe Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdf
The Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdfEnterprise Knowledge
 
Workshop - Best of Both Worlds_ Combine KG and Vector search for enhanced R...
Workshop - Best of Both Worlds_ Combine  KG and Vector search for  enhanced R...Workshop - Best of Both Worlds_ Combine  KG and Vector search for  enhanced R...
Workshop - Best of Both Worlds_ Combine KG and Vector search for enhanced R...Neo4j
 
Real Time Object Detection Using Open CV
Real Time Object Detection Using Open CVReal Time Object Detection Using Open CV
Real Time Object Detection Using Open CVKhem
 
Scaling API-first – The story of a global engineering organization
Scaling API-first – The story of a global engineering organizationScaling API-first – The story of a global engineering organization
Scaling API-first – The story of a global engineering organizationRadu Cotescu
 
08448380779 Call Girls In Greater Kailash - I Women Seeking Men
08448380779 Call Girls In Greater Kailash - I Women Seeking Men08448380779 Call Girls In Greater Kailash - I Women Seeking Men
08448380779 Call Girls In Greater Kailash - I Women Seeking MenDelhi Call girls
 
Handwritten Text Recognition for manuscripts and early printed texts
Handwritten Text Recognition for manuscripts and early printed textsHandwritten Text Recognition for manuscripts and early printed texts
Handwritten Text Recognition for manuscripts and early printed textsMaria Levchenko
 
Breaking the Kubernetes Kill Chain: Host Path Mount
Breaking the Kubernetes Kill Chain: Host Path MountBreaking the Kubernetes Kill Chain: Host Path Mount
Breaking the Kubernetes Kill Chain: Host Path MountPuma Security, LLC
 
A Call to Action for Generative AI in 2024
A Call to Action for Generative AI in 2024A Call to Action for Generative AI in 2024
A Call to Action for Generative AI in 2024Results
 
From Event to Action: Accelerate Your Decision Making with Real-Time Automation
From Event to Action: Accelerate Your Decision Making with Real-Time AutomationFrom Event to Action: Accelerate Your Decision Making with Real-Time Automation
From Event to Action: Accelerate Your Decision Making with Real-Time AutomationSafe Software
 
A Domino Admins Adventures (Engage 2024)
A Domino Admins Adventures (Engage 2024)A Domino Admins Adventures (Engage 2024)
A Domino Admins Adventures (Engage 2024)Gabriella Davis
 

Último (20)

CNv6 Instructor Chapter 6 Quality of Service
CNv6 Instructor Chapter 6 Quality of ServiceCNv6 Instructor Chapter 6 Quality of Service
CNv6 Instructor Chapter 6 Quality of Service
 
GenCyber Cyber Security Day Presentation
GenCyber Cyber Security Day PresentationGenCyber Cyber Security Day Presentation
GenCyber Cyber Security Day Presentation
 
How to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected WorkerHow to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected Worker
 
How to convert PDF to text with Nanonets
How to convert PDF to text with NanonetsHow to convert PDF to text with Nanonets
How to convert PDF to text with Nanonets
 
Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...
Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...
Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...
 
Automating Google Workspace (GWS) & more with Apps Script
Automating Google Workspace (GWS) & more with Apps ScriptAutomating Google Workspace (GWS) & more with Apps Script
Automating Google Workspace (GWS) & more with Apps Script
 
Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024
Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024
Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024
 
The 7 Things I Know About Cyber Security After 25 Years | April 2024
The 7 Things I Know About Cyber Security After 25 Years | April 2024The 7 Things I Know About Cyber Security After 25 Years | April 2024
The 7 Things I Know About Cyber Security After 25 Years | April 2024
 
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...
 
Artificial Intelligence: Facts and Myths
Artificial Intelligence: Facts and MythsArtificial Intelligence: Facts and Myths
Artificial Intelligence: Facts and Myths
 
The Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdf
The Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdfThe Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdf
The Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdf
 
Workshop - Best of Both Worlds_ Combine KG and Vector search for enhanced R...
Workshop - Best of Both Worlds_ Combine  KG and Vector search for  enhanced R...Workshop - Best of Both Worlds_ Combine  KG and Vector search for  enhanced R...
Workshop - Best of Both Worlds_ Combine KG and Vector search for enhanced R...
 
Real Time Object Detection Using Open CV
Real Time Object Detection Using Open CVReal Time Object Detection Using Open CV
Real Time Object Detection Using Open CV
 
Scaling API-first – The story of a global engineering organization
Scaling API-first – The story of a global engineering organizationScaling API-first – The story of a global engineering organization
Scaling API-first – The story of a global engineering organization
 
08448380779 Call Girls In Greater Kailash - I Women Seeking Men
08448380779 Call Girls In Greater Kailash - I Women Seeking Men08448380779 Call Girls In Greater Kailash - I Women Seeking Men
08448380779 Call Girls In Greater Kailash - I Women Seeking Men
 
Handwritten Text Recognition for manuscripts and early printed texts
Handwritten Text Recognition for manuscripts and early printed textsHandwritten Text Recognition for manuscripts and early printed texts
Handwritten Text Recognition for manuscripts and early printed texts
 
Breaking the Kubernetes Kill Chain: Host Path Mount
Breaking the Kubernetes Kill Chain: Host Path MountBreaking the Kubernetes Kill Chain: Host Path Mount
Breaking the Kubernetes Kill Chain: Host Path Mount
 
A Call to Action for Generative AI in 2024
A Call to Action for Generative AI in 2024A Call to Action for Generative AI in 2024
A Call to Action for Generative AI in 2024
 
From Event to Action: Accelerate Your Decision Making with Real-Time Automation
From Event to Action: Accelerate Your Decision Making with Real-Time AutomationFrom Event to Action: Accelerate Your Decision Making with Real-Time Automation
From Event to Action: Accelerate Your Decision Making with Real-Time Automation
 
A Domino Admins Adventures (Engage 2024)
A Domino Admins Adventures (Engage 2024)A Domino Admins Adventures (Engage 2024)
A Domino Admins Adventures (Engage 2024)
 

Destacado

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
 

Destacado (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 :)

Notas del editor