{{tag>cmsplugin_blog}} ====== Rendering entry details ====== - urls.py: when url that matchs this pattern is called. - The unction 'blog_detail' is called. It is defined in urls.py as function 'views.py.EntryDateDetailView.as_view()' urls.py -------------------------------- ... from cmsplugin_blog.views import EntryDateDetailView, EntryArchiveIndexView ... (r'^(?P\d{4})/(?P\d{2})/(?P\d{2})/(?P[-\w]+)/$',blog_detail, blog_info_detail_dict, 'blog_detail') ... blog_detail = EntryDateDetailView.as_view() - This explains as_view(): 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/entry_detail.html is rendered. views.py -------------------------------- 1 import datetime 2 try: # pragma: no cover 3 from django.views.generic.dates import BaseDateDetailView, ArchiveIndexView, _date_lookup_for_field, _date_from_string 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, _date_lookup_for_field, _date_from_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) entry_details.html -------------------------------- 1 {% extends "cmsplugin_blog/cmsplugin_blog_base.html" %} 2 3 {% load placeholder_tags cmsplugin_blog_tags simple_translation_tags %} 4 5 6 {% block left-col %} 7 {{ block.super }} 8 9

{% with object|get_preferred_translation_from_request:request as title %}{{ title }}{% endwith %}

10 11

{{ object.pub_date|date:"d F Y" }}

12 13 {% with object.placeholders|choose_placeholder:"blog_content" as content %} 14 {% render_placeholder content %} 15 {% endwith %} ...
===== render_placeholder =====