def get_conference_committees(request, conference): existing_committees = serializers.serialize( "json", Committee.objects.filter(conference=conference), fields=("name") ) form = NewCommitteeForm() return simplejson.dumps( {"form": '<table class="form">' + form.as_table() + "</table>", "objects": existing_committees} )
def add_committee(request, conference): if request.method == 'POST': form = NewCommitteeForm(data=request.POST) if(form.is_valid(conference)): committee = form.save(commit=False) committee.conference = conference committee.url_name = slugify(committee.name) committee.save() return simplejson.dumps({'pk':committee.pk, 'name':committee.name}) else: return simplejson.dumps({'form':"<table class=\"form\">" + form.as_table() + "</table>"})
def add_committee(request, conference): if request.method == "POST": form = NewCommitteeForm(data=request.POST) if form.is_valid(conference): committee = form.save(commit=False) committee.conference = conference committee.url_name = slugify(committee.name) committee.save() return simplejson.dumps({"pk": committee.pk, "name": committee.name}) else: return simplejson.dumps({"form": '<table class="form">' + form.as_table() + "</table>"})
def get_conference_committees(request, conference): existing_committees = serializers.serialize( 'json', Committee.objects.filter(conference=conference), fields=('name')) form = NewCommitteeForm() return simplejson.dumps({ 'form': "<table class=\"form\">" + form.as_table() + "</table>", 'objects': existing_committees })
def get_conference_committees(request, conference): existing_committees = serializers.serialize('json', Committee.objects.filter(conference=conference), fields=('name')) form = NewCommitteeForm() return simplejson.dumps({'form':"<table class=\"form\">" + form.as_table() + "</table>", 'objects':existing_committees})