Skip to content

Instantly share code, notes, and snippets.

@bhavaniravi
Created March 27, 2018 11:58
Show Gist options
  • Select an option

  • Save bhavaniravi/b784c57ae9d24fce359ae44e2e90b8e3 to your computer and use it in GitHub Desktop.

Select an option

Save bhavaniravi/b784c57ae9d24fce359ae44e2e90b8e3 to your computer and use it in GitHub Desktop.
@login_required
def addtoprofile(request, count):
count = int(count)
formsets = (Form1, Form2, Form3)
try:
Form = Form[count]
except IndexError:
return redirect("/")
next_url = "Next"
if count == len(formsets):
return redirect("/")
if request.method == "GET":
return TemplateResponse(request, template, "form":Form())
if request.method == "POST":
form = Form(request.POST)
if form.is_valid():
form.save()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment