示例#1
0
def ajax_create_band(request):
    form = NewBandForm(request.POST)

    if form.is_valid():
        profile = request.user.get_profile()
        if profile.bands_in_count() >= profile.band_count_limit:
            return json_failure(design.you_have_reached_your_band_count_limit)

        actually_create_band(request.user, form.cleaned_data.get('band_name'))
        return json_success()

    return json_failure(form_errors(form))
示例#2
0
def ajax_create_band(request):
    form = NewBandForm(request.POST)

    if form.is_valid():
        profile = request.user.get_profile()
        if profile.bands_in_count() >= profile.band_count_limit:
            return json_failure(design.you_have_reached_your_band_count_limit)

        actually_create_band(request.user, form.cleaned_data.get('band_name'))
        return json_success()

    return json_failure(form_errors(form))
示例#3
0
def create_band(request):
    err_msg = ''
    if request.method == 'POST':
        form = NewBandForm(request.POST)
        if form.is_valid():
            profile = request.user.get_profile()
            if profile.bands_in_count() >= profile.band_count_limit:
                err_msg = design.you_have_reached_your_band_count_limit
            else:
                actually_create_band(request.user, form.cleaned_data.get('band_name'))
                return HttpResponseRedirect(reverse("workbench.home"))
    else:
        form = NewBandForm()

    return render_to_response('workbench/create_band.html', {'form': form, 'err_msg': err_msg}, context_instance=RequestContext(request))
示例#4
0
def create_band(request):
    err_msg = ''
    if request.method == 'POST':
        form = NewBandForm(request.POST)
        if form.is_valid():
            profile = request.user.get_profile()
            if profile.bands_in_count() >= profile.band_count_limit:
                err_msg = design.you_have_reached_your_band_count_limit
            else:
                actually_create_band(request.user,
                                     form.cleaned_data.get('band_name'))
                return HttpResponseRedirect(reverse("workbench.home"))
    else:
        form = NewBandForm()

    return render_to_response('workbench/create_band.html', {
        'form': form,
        'err_msg': err_msg
    },
                              context_instance=RequestContext(request))