def arbiter_edit(request): try: arbiter = request.user.arbiter except Arbiter.DoesNotExist: raise Http404 if request.POST: arbiter_form = ArbiterForm(request.POST, instance=arbiter, prefix="edit") if arbiter_form.is_valid(): arbiter_form.save() messages.success(request, u"ویرایش اطلاعات با موفقیت انجام شد.") arbiter_form = ArbiterForm(instance=arbiter, prefix="edit") else: arbiter_form = ArbiterForm(instance=arbiter, prefix="edit") context = {"arbiter_form": arbiter_form} return render_to_response("registration/arbiter_edit.html", context, context_instance=RequestContext(request))
def arbiter_register(request): invitation_key = request.GET.get("c") arbiter = None if invitation_key: arbiter = get_object_or_404(Arbiter, invitation_key=invitation_key, invited=True) if request.POST: arbiter_form = ArbiterForm(request.POST, prefix="register", instance=arbiter) if arbiter_form.is_valid(): arbiter_form.save() messages.success(request, u"ثبت نام شما با موفقیت انجام شد.") return HttpResponseRedirect(reverse("login")) else: arbiter_form = ArbiterForm(prefix="register", instance=None) context = {"arbiter_form": arbiter_form} return render_to_response("registration/arbiter_register.html", context, context_instance=RequestContext(request))
def arbiter_edit(request): try: arbiter = request.user.arbiter except Arbiter.DoesNotExist: raise Http404 if request.POST: arbiter_form = ArbiterForm(request.POST, instance=arbiter, prefix='edit') if arbiter_form.is_valid(): arbiter_form.save() messages.success(request, u"ویرایش اطلاعات با موفقیت انجام شد.") arbiter_form = ArbiterForm(instance=arbiter, prefix='edit') else: arbiter_form = ArbiterForm(instance=arbiter, prefix='edit') context = { 'arbiter_form': arbiter_form, } return render_to_response('registration/arbiter_edit.html', context, context_instance=RequestContext(request))
def arbiter_register(request): invitation_key = request.GET.get('c') arbiter = None if invitation_key: arbiter = get_object_or_404(Arbiter, invitation_key=invitation_key, invited=True) if request.POST: arbiter_form = ArbiterForm(request.POST, prefix='register', instance=arbiter) if arbiter_form.is_valid(): arbiter_form.save() messages.success(request, u"ثبت نام شما با موفقیت انجام شد.") return HttpResponseRedirect(reverse('login')) else: arbiter_form = ArbiterForm(prefix='register', instance=None) context = { 'arbiter_form': arbiter_form, } return render_to_response('registration/arbiter_register.html', context, context_instance=RequestContext(request))