示例#1
0
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}
    )
示例#2
0
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>"})
示例#3
0
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>"})
示例#4
0
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>"})
示例#5
0
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
    })
示例#6
0
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})