def notification_add(request): if not request.user.is_staff or request.method != 'POST': raise Http404 f = NotificationForm(request.POST) f.save() return HttpResponseRedirect(reverse('notification_list', args=[]))
def notification_add(request): if not request.user.is_staff: raise Http404 if request.method == 'POST': f = NotificationForm(request.POST) f.save() return HttpResponseRedirect(reverse('notification_list', args=[])) else: form = NotificationForm() return render_to_response("notifications/add_notification_form.html", { 'form': form, }, context_instance=RequestContext(request))