@login_required
def project_notifications(request, project_slug):
 project = get_object_or_404(Project.objects.for_admin_user(request.user), slug=project_slug)
 email_form = EmailHookForm(data=(request.POST or None), project=project)
 webhook_form = WebHookForm(data=(request.POST or None), project=project)
 if (request.method == 'POST'):
  if email_form.is_valid():
   email_form.save()
  if webhook_form.is_valid():
   webhook_form.save()
  project_dashboard = reverse('projects_notifications', args=[project.slug])
  return HttpResponseRedirect(project_dashboard)
 emails = project.emailhook_notifications.all()
 urls = project.webhook_notifications.all()
 return render_to_response('projects/project_notifications.html', {'email_form': email_form, 'webhook_form': webhook_form, 'project': project, 'emails': emails, 'urls': urls}, context_instance=RequestContext(request))

@ login_required def project_notifications ( request , project_slug ) : project = get_object_or_404 ( Project . objects . for_admin_user ( request . user ) , slug = project_slug ) email_form = EmailHookForm ( data = ( request . POST or None ) , project = project ) webhook_form = WebHookForm ( data = ( request . POST or None ) , project = project ) if ( request . method == 'POST' ) : if email_form . is_valid ( ) : email_form . save ( ) if webhook_form . is_valid ( ) : webhook_form . save ( ) project_dashboard = reverse ( 'projects_notifications' , args = [ project . slug ] ) return HttpResponseRedirect ( project_dashboard ) emails = project . emailhook_notifications . all ( ) urls = project . webhook_notifications . all ( ) return render_to_response ( 'projects/project_notifications.html' , { 'email_form' : email_form , 'webhook_form' : webhook_form , 'project' : project , 'emails' : emails , 'urls' : urls } , context_instance = RequestContext ( request ) )
project notification view and form view .