Skip to content

Instantly share code, notes, and snippets.

@mekhami
Created March 6, 2016 19:28
Show Gist options
  • Select an option

  • Save mekhami/0c0587fd78ff8375ecfa to your computer and use it in GitHub Desktop.

Select an option

Save mekhami/0c0587fd78ff8375ecfa to your computer and use it in GitHub Desktop.
def update_rsvp(request):
if request.method == 'GET':
person = Invitee.objects.get(code=request.session['code'])
form = InviteeForm(instance=person)
elif request.method == 'POST':
form = InviteeForm(request.POST)
if form.is_valid():
form.save()
return redirect('invites:success')
else:
form = InviteeForm(request.POST)
return render(request, 'invites/update.html', {'form': form})
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment