My Wiki!

cmsplugin_blog

Rendering entry details

  1. urls.py: when url that matchs this pattern is called.
  2. The unction 'blogdetail' is called. It is defined in urls.py as function 'views.py.EntryDateDetailView.asview()'
urls.py
--------------------------------
...
from cmsplugin_blog.views import EntryDateDetailView, EntryArchiveIndexView
...
(r'^(?P<year>\d{4})/(?P<month>\d{2})/(?P<day>\d{2})/(?P<slug>[-\w]+)/$',blog_detail, blog_info_detail_dict, 'blog_detail')
...
blog_detail = EntryDateDetailView.as_view()
  • This explains asview(): http://www.gregaker.net/2012/apr/19/how-do-django-class-based-views-work/ . All arguments will be passed to the 'dispatch()' function. - The template file cmsplugin-blog/entrydetail.html is rendered. <code> views.py

    1 import datetime 2 try: # pragma: no cover 3 from django.views.generic.dates import BaseDateDetailView, ArchiveIndexView, datelookupforfield, datefromstring 4 from django.views.generic.detail import SingleObjectTemplateResponseMixin 5 except ImportError: # pragma: no cover 6 from cbv.views.detail import SingleObjectTemplateResponseMixin 7 from cbv.views.dates import BaseDateDetailView, ArchiveIndexView, _datelookupforfield, datefrom_string … 25 class DateDetailView(SingleObjectTemplateResponseMixin, BaseDateDetailView): … 57 class EntryDateDetailView(DateDetailView): … 96 def dispatch(self, request, args, kwargs): 97 try: 98 return super(EntryDateDetailView, self).dispatch(request, args, kwargs) 99 except Redirect, e: 100 return redirect(*e.args, e.kwargs) </code> <code> entrydetails.html ——————————– 1 {% extends “cmspluginblog/cmspluginblogbase.html” %} 2 3 {% load placeholdertags cmspluginblogtags simpletranslationtags %} 4 5 6 {% block left-col %} 7 block.super 8 9 <h1>{% with object|getpreferredtranslationfromrequest:request as title %}title{% endwith %}</h1> 10 11 <p class=“date”><span>date:"d F Y" </span></p> 12 13 {% with object.placeholders|chooseplaceholder:“blogcontent” as content %} 14 {% renderplaceholder content %} 15 {% endwith %} … </code> ===== render_placeholder =====


Navigation