def get_conference_countries(request, conference): existing_countries = serializers.serialize( "json", Country.objects.filter(conference=conference), fields=("name", "country_code") ) form = NewCountryForm() return simplejson.dumps( {"form": '<table class="form">' + form.as_table() + "</table>", "objects": existing_countries} )
def add_country(request, conference): if request.method == 'POST': form = NewCountryForm(request.POST, request.FILES) if(form.is_valid(conference)): country = form.save(commit=False) country.conference = conference country.url_name = slugify(country.name) country.save() return serializers.serialize('json', [country], fields=('name','country_code'))[1:-1] else: return simplejson.dumps({'form':"<table class=\"form\">" + form.as_table() + "</table>"})
def add_country(request, conference): if request.method == "POST": form = NewCountryForm(request.POST, request.FILES) if form.is_valid(conference): country = form.save(commit=False) country.conference = conference country.url_name = slugify(country.name) country.save() return serializers.serialize("json", [country], fields=("name", "country_code"))[1:-1] else: return simplejson.dumps({"form": '<table class="form">' + form.as_table() + "</table>"})
def get_conference_countries(request, conference): existing_countries = serializers.serialize( 'json', Country.objects.filter(conference=conference), fields=('name', 'country_code')) form = NewCountryForm() return simplejson.dumps({ 'form': "<table class=\"form\">" + form.as_table() + "</table>", 'objects': existing_countries })
def get_conference_countries(request, conference): existing_countries = serializers.serialize('json', Country.objects.filter(conference=conference), fields=('name','country_code')) form = NewCountryForm() return simplejson.dumps({'form':"<table class=\"form\">" + form.as_table() + "</table>", 'objects':existing_countries})