Beispiel #1
0
 def post(self, request, **kwargs):
     defaults = dict(
         queryset=self.get_blog().entry_set.of_type(Entry.TYPE_POST),
         date_field='pub_date',
     )
     defaults.update(kwargs)
     if request.method == 'POST':
         form = CommentForm(request.POST)
         if form.is_valid():
             response = post_free_comment(request)
             return HttpResponseRedirect(request.POST['url'])
         else:
             extra_context = dict(extra_context=dict(form=form))
             defaults.update(extra_context)
             return object_detail(request, **defaults)
     else:
         form = CommentForm()
         extra_context = dict(extra_context=dict(form=form))
         defaults.update(extra_context)
         return object_detail(request, **defaults)
Beispiel #2
0
 def page(self, request, **kwargs):
     defaults = dict(
         queryset=self.get_blog().entry_set.of_type(Entry.TYPE_PAGE),
         slug_field='slug',
         template_name='djog/entry_detail.html',
     )
     defaults.update(kwargs)
     if request.method == 'POST':
         form = CommentForm(request.POST)
         if form.is_valid():
             response = post_free_comment(request)
             return HttpResponseRedirect(request.POST['url'])
         else:
             extra_context = dict(extra_context=dict(form=form))
             defaults.update(extra_context)
             return list_detail.object_detail(request, **defaults)
     else:
         form = CommentForm()
         extra_context = dict(extra_context=dict(form=form))
         defaults.update(extra_context)
         return list_detail.object_detail(request, **defaults)