Hector Garcia avatar Hector Garcia committed 6f13829

Added extra_ctxt params to all views

Comments (0)

Files changed (1)

nomadblog/views.py

 
 def list_posts(request, model=Post, blog_slug=None, username=None,
                status=DEFAULT_STATUS, order='-pub_date',
-               template='nomadblog/list_posts.html'):
+               extra_ctxt={}, template='nomadblog/list_posts.html'):
     """
     By default, a queryset of published Post model instances for all users
     are retrieved, ordered in reverse chronological order.
     context = list_posts_ctxt(request, model=model, blog_slug=blog_slug,
                               username=username, status=status)
     context['posts'] = context['posts'].order_by(order)
+    context.update(extra_ctxt)
     return render_to_response(template, {'multiblog': multiblog}, context)
 
 def show_post(request, category, slug, model=Post, blog_slug=None,
               username=None, status=DEFAULT_STATUS,
-              template='nomadblog/show_post.html'):
+              extra_ctxt={}, template='nomadblog/show_post.html'):
     """
     By default, a published Post model instance for a given user is retrieved.
     You can override these settings if you want to.
     context = show_post_ctxt(request, category, slug, model=model,
                              username=username, blog_slug=blog_slug,
                              status=status)
+    context.update(extra_ctxt)
     return render_to_response(template, {'multiblog': multiblog}, context)
 
 def list_categories(request, model=Post, blog_slug=None,
                     username=None, status=DEFAULT_STATUS,
-                    template='nomadblog/list_categories.html'):
+                    extra_ctxt={}, template='nomadblog/list_categories.html'):
     """
     By default, a queryset of categories related to published Post model
     instances for all users are retrieved.
     """
     context = list_categories_ctxt(request, blog_slug=blog_slug,
                                    username=username)
+    context.update(extra_ctxt)
     return render_to_response(template, {'multiblog': multiblog}, context)
 
 def list_posts_by_category(request, category, model=Post,
                            blog_slug=None, username=None,
                            status=DEFAULT_STATUS, order='-pub_date',
-                           template='nomadblog/list_posts_by_category.html'):
+                           textra_ctxt={},
+                           emplate='nomadblog/list_posts_by_category.html'):
     """
     By default, a queryset of published Post model
     instances related to the given category and for all users are retrieved.
                                           username=username,
                                           blog_slug=blog_slug)
     context['posts'] = context['posts'].order_by(order)
+    context.update(extra_ctxt)
     return render_to_response(template, {'multiblog': multiblog}, context)
 
Tip: Filter by directory path e.g. /media app.js to search for public/media/app.js.
Tip: Use camelCasing e.g. ProjME to search for ProjectModifiedEvent.java.
Tip: Filter by extension type e.g. /repo .js to search for all .js files in the /repo directory.
Tip: Separate your search with spaces e.g. /ssh pom.xml to search for src/ssh/pom.xml.
Tip: Use ↑ and ↓ arrow keys to navigate and return to view the file.
Tip: You can also navigate files with Ctrl+j (next) and Ctrl+k (previous) and view the file with Ctrl+o.
Tip: You can also navigate files with Alt+j (next) and Alt+k (previous) and view the file with Alt+o.