Set ref in form if user already has one
This commit is contained in:
parent
ac59a532c4
commit
94739d3508
|
@ -148,7 +148,10 @@ def updateRef(request, shadow, uid):
|
||||||
messages.success(request, "%s%s ref set to %s" % ("(shadow) " if shadow else "", user, ref))
|
messages.success(request, "%s%s ref set to %s" % ("(shadow) " if shadow else "", user, ref))
|
||||||
return HttpResponseRedirect(reverse("contest:registerRefs"))
|
return HttpResponseRedirect(reverse("contest:registerRefs"))
|
||||||
else:
|
else:
|
||||||
form = UpdateRefForm()
|
data = {}
|
||||||
|
if user.ref:
|
||||||
|
data["existingRef"] = user.ref
|
||||||
|
form = UpdateRefForm(initial=data)
|
||||||
|
|
||||||
return render(request, 'contest/updateRef.html', {'userobj': user, 'form': form, "shadow": shadow})
|
return render(request, 'contest/updateRef.html', {'userobj': user, 'form': form, "shadow": shadow})
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue