@login_required
def project_subprojects(request, project_slug):
 project = get_object_or_404(Project.objects.for_admin_user(request.user), slug=project_slug)
 form_kwargs = {'parent': project, 'user': request.user}
 if (request.method == 'POST'):
  form = SubprojectForm(request.POST, **form_kwargs)
  if form.is_valid():
   form.save()
   broadcast(type='app', task=tasks.symlink_subproject, args=[project.pk])
   project_dashboard = reverse('projects_subprojects', args=[project.slug])
   return HttpResponseRedirect(project_dashboard)
 else:
  form = SubprojectForm(**form_kwargs)
 subprojects = project.subprojects.all()
 return render_to_response('projects/project_subprojects.html', {'form': form, 'project': project, 'subprojects': subprojects}, context_instance=RequestContext(request))

@ login_required def project_subprojects ( request , project_slug ) : project = get_object_or_404 ( Project . objects . for_admin_user ( request . user ) , slug = project_slug ) form_kwargs = { 'parent' : project , 'user' : request . user } if ( request . method == 'POST' ) : form = SubprojectForm ( request . POST , ** form_kwargs ) if form . is_valid ( ) : form . save ( ) broadcast ( type = 'app' , task = tasks . symlink_subproject , args = [ project . pk ] ) project_dashboard = reverse ( 'projects_subprojects' , args = [ project . slug ] ) return HttpResponseRedirect ( project_dashboard ) else : form = SubprojectForm ( ** form_kwargs ) subprojects = project . subprojects . all ( ) return render_to_response ( 'projects/project_subprojects.html' , { 'form' : form , 'project' : project , 'subprojects' : subprojects } , context_instance = RequestContext ( request ) )
project subprojects view and form view .