SlideShare uma empresa 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 :)

Mais conteúdo relacionado

Último

"ML in Production",Oleksandr Bagan
"ML in Production",Oleksandr Bagan"ML in Production",Oleksandr Bagan
"ML in Production",Oleksandr BaganFwdays
 
Unleash Your Potential - Namagunga Girls Coding Club
Unleash Your Potential - Namagunga Girls Coding ClubUnleash Your Potential - Namagunga Girls Coding Club
Unleash Your Potential - Namagunga Girls Coding ClubKalema Edgar
 
DevEX - reference for building teams, processes, and platforms
DevEX - reference for building teams, processes, and platformsDevEX - reference for building teams, processes, and platforms
DevEX - reference for building teams, processes, and platformsSergiu Bodiu
 
DSPy a system for AI to Write Prompts and Do Fine Tuning
DSPy a system for AI to Write Prompts and Do Fine TuningDSPy a system for AI to Write Prompts and Do Fine Tuning
DSPy a system for AI to Write Prompts and Do Fine TuningLars Bell
 
CloudStudio User manual (basic edition):
CloudStudio User manual (basic edition):CloudStudio User manual (basic edition):
CloudStudio User manual (basic edition):comworks
 
Gen AI in Business - Global Trends Report 2024.pdf
Gen AI in Business - Global Trends Report 2024.pdfGen AI in Business - Global Trends Report 2024.pdf
Gen AI in Business - Global Trends Report 2024.pdfAddepto
 
From Family Reminiscence to Scholarly Archive .
From Family Reminiscence to Scholarly Archive .From Family Reminiscence to Scholarly Archive .
From Family Reminiscence to Scholarly Archive .Alan Dix
 
Powerpoint exploring the locations used in television show Time Clash
Powerpoint exploring the locations used in television show Time ClashPowerpoint exploring the locations used in television show Time Clash
Powerpoint exploring the locations used in television show Time Clashcharlottematthew16
 
Take control of your SAP testing with UiPath Test Suite
Take control of your SAP testing with UiPath Test SuiteTake control of your SAP testing with UiPath Test Suite
Take control of your SAP testing with UiPath Test SuiteDianaGray10
 
WordPress Websites for Engineers: Elevate Your Brand
WordPress Websites for Engineers: Elevate Your BrandWordPress Websites for Engineers: Elevate Your Brand
WordPress Websites for Engineers: Elevate Your Brandgvaughan
 
Are Multi-Cloud and Serverless Good or Bad?
Are Multi-Cloud and Serverless Good or Bad?Are Multi-Cloud and Serverless Good or Bad?
Are Multi-Cloud and Serverless Good or Bad?Mattias Andersson
 
DevoxxFR 2024 Reproducible Builds with Apache Maven
DevoxxFR 2024 Reproducible Builds with Apache MavenDevoxxFR 2024 Reproducible Builds with Apache Maven
DevoxxFR 2024 Reproducible Builds with Apache MavenHervé Boutemy
 
Search Engine Optimization SEO PDF for 2024.pdf
Search Engine Optimization SEO PDF for 2024.pdfSearch Engine Optimization SEO PDF for 2024.pdf
Search Engine Optimization SEO PDF for 2024.pdfRankYa
 
"LLMs for Python Engineers: Advanced Data Analysis and Semantic Kernel",Oleks...
"LLMs for Python Engineers: Advanced Data Analysis and Semantic Kernel",Oleks..."LLMs for Python Engineers: Advanced Data Analysis and Semantic Kernel",Oleks...
"LLMs for Python Engineers: Advanced Data Analysis and Semantic Kernel",Oleks...Fwdays
 
Tampa BSides - Chef's Tour of Microsoft Security Adoption Framework (SAF)
Tampa BSides - Chef's Tour of Microsoft Security Adoption Framework (SAF)Tampa BSides - Chef's Tour of Microsoft Security Adoption Framework (SAF)
Tampa BSides - Chef's Tour of Microsoft Security Adoption Framework (SAF)Mark Simos
 
"Subclassing and Composition – A Pythonic Tour of Trade-Offs", Hynek Schlawack
"Subclassing and Composition – A Pythonic Tour of Trade-Offs", Hynek Schlawack"Subclassing and Composition – A Pythonic Tour of Trade-Offs", Hynek Schlawack
"Subclassing and Composition – A Pythonic Tour of Trade-Offs", Hynek SchlawackFwdays
 
Dev Dives: Streamline document processing with UiPath Studio Web
Dev Dives: Streamline document processing with UiPath Studio WebDev Dives: Streamline document processing with UiPath Studio Web
Dev Dives: Streamline document processing with UiPath Studio WebUiPathCommunity
 
SIP trunking in Janus @ Kamailio World 2024
SIP trunking in Janus @ Kamailio World 2024SIP trunking in Janus @ Kamailio World 2024
SIP trunking in Janus @ Kamailio World 2024Lorenzo Miniero
 

Último (20)

"ML in Production",Oleksandr Bagan
"ML in Production",Oleksandr Bagan"ML in Production",Oleksandr Bagan
"ML in Production",Oleksandr Bagan
 
Unleash Your Potential - Namagunga Girls Coding Club
Unleash Your Potential - Namagunga Girls Coding ClubUnleash Your Potential - Namagunga Girls Coding Club
Unleash Your Potential - Namagunga Girls Coding Club
 
DevEX - reference for building teams, processes, and platforms
DevEX - reference for building teams, processes, and platformsDevEX - reference for building teams, processes, and platforms
DevEX - reference for building teams, processes, and platforms
 
DSPy a system for AI to Write Prompts and Do Fine Tuning
DSPy a system for AI to Write Prompts and Do Fine TuningDSPy a system for AI to Write Prompts and Do Fine Tuning
DSPy a system for AI to Write Prompts and Do Fine Tuning
 
CloudStudio User manual (basic edition):
CloudStudio User manual (basic edition):CloudStudio User manual (basic edition):
CloudStudio User manual (basic edition):
 
Gen AI in Business - Global Trends Report 2024.pdf
Gen AI in Business - Global Trends Report 2024.pdfGen AI in Business - Global Trends Report 2024.pdf
Gen AI in Business - Global Trends Report 2024.pdf
 
From Family Reminiscence to Scholarly Archive .
From Family Reminiscence to Scholarly Archive .From Family Reminiscence to Scholarly Archive .
From Family Reminiscence to Scholarly Archive .
 
Powerpoint exploring the locations used in television show Time Clash
Powerpoint exploring the locations used in television show Time ClashPowerpoint exploring the locations used in television show Time Clash
Powerpoint exploring the locations used in television show Time Clash
 
Take control of your SAP testing with UiPath Test Suite
Take control of your SAP testing with UiPath Test SuiteTake control of your SAP testing with UiPath Test Suite
Take control of your SAP testing with UiPath Test Suite
 
WordPress Websites for Engineers: Elevate Your Brand
WordPress Websites for Engineers: Elevate Your BrandWordPress Websites for Engineers: Elevate Your Brand
WordPress Websites for Engineers: Elevate Your Brand
 
Are Multi-Cloud and Serverless Good or Bad?
Are Multi-Cloud and Serverless Good or Bad?Are Multi-Cloud and Serverless Good or Bad?
Are Multi-Cloud and Serverless Good or Bad?
 
DevoxxFR 2024 Reproducible Builds with Apache Maven
DevoxxFR 2024 Reproducible Builds with Apache MavenDevoxxFR 2024 Reproducible Builds with Apache Maven
DevoxxFR 2024 Reproducible Builds with Apache Maven
 
Search Engine Optimization SEO PDF for 2024.pdf
Search Engine Optimization SEO PDF for 2024.pdfSearch Engine Optimization SEO PDF for 2024.pdf
Search Engine Optimization SEO PDF for 2024.pdf
 
"LLMs for Python Engineers: Advanced Data Analysis and Semantic Kernel",Oleks...
"LLMs for Python Engineers: Advanced Data Analysis and Semantic Kernel",Oleks..."LLMs for Python Engineers: Advanced Data Analysis and Semantic Kernel",Oleks...
"LLMs for Python Engineers: Advanced Data Analysis and Semantic Kernel",Oleks...
 
Tampa BSides - Chef's Tour of Microsoft Security Adoption Framework (SAF)
Tampa BSides - Chef's Tour of Microsoft Security Adoption Framework (SAF)Tampa BSides - Chef's Tour of Microsoft Security Adoption Framework (SAF)
Tampa BSides - Chef's Tour of Microsoft Security Adoption Framework (SAF)
 
"Subclassing and Composition – A Pythonic Tour of Trade-Offs", Hynek Schlawack
"Subclassing and Composition – A Pythonic Tour of Trade-Offs", Hynek Schlawack"Subclassing and Composition – A Pythonic Tour of Trade-Offs", Hynek Schlawack
"Subclassing and Composition – A Pythonic Tour of Trade-Offs", Hynek Schlawack
 
E-Vehicle_Hacking_by_Parul Sharma_null_owasp.pptx
E-Vehicle_Hacking_by_Parul Sharma_null_owasp.pptxE-Vehicle_Hacking_by_Parul Sharma_null_owasp.pptx
E-Vehicle_Hacking_by_Parul Sharma_null_owasp.pptx
 
Dev Dives: Streamline document processing with UiPath Studio Web
Dev Dives: Streamline document processing with UiPath Studio WebDev Dives: Streamline document processing with UiPath Studio Web
Dev Dives: Streamline document processing with UiPath Studio Web
 
SIP trunking in Janus @ Kamailio World 2024
SIP trunking in Janus @ Kamailio World 2024SIP trunking in Janus @ Kamailio World 2024
SIP trunking in Janus @ Kamailio World 2024
 
DMCC Future of Trade Web3 - Special Edition
DMCC Future of Trade Web3 - Special EditionDMCC Future of Trade Web3 - Special Edition
DMCC Future of Trade Web3 - Special Edition
 

Destaque

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
 

Destaque (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 do Editor