Merge branch 'thankyou-url' into 'master'
Make thank-you/sorry URLs better-looking See merge request VickySteeves/anna-dan-wedding-site!4
This commit is contained in:
commit
2e73ef2464
|
@ -1,5 +1,4 @@
|
|||
from django.shortcuts import render, redirect
|
||||
from django.urls import reverse
|
||||
|
||||
from .models import InvitedGuest
|
||||
|
||||
|
@ -18,7 +17,13 @@ def rsvp(request):
|
|||
guest.attending = attending
|
||||
any_attending = any_attending or attending
|
||||
guest.save()
|
||||
return redirect(reverse('thank-you') + '?attending=' + ('yes' if any_attending else 'no'))
|
||||
if any_attending:
|
||||
return redirect('thanks')
|
||||
else:
|
||||
return redirect('sorry')
|
||||
|
||||
def thanks(request):
|
||||
return render(request, 'thank-you.html', {'attending': request.GET.get('attending') == 'yes'})
|
||||
return render(request, 'thank-you.html', {'attending': True})
|
||||
|
||||
def sorry(request):
|
||||
return render(request, 'thank-you.html', {'attending': False})
|
||||
|
|
|
@ -6,5 +6,6 @@ urlpatterns = [
|
|||
path('admin/', admin.site.urls),
|
||||
path('', bigday.views.index, name='index'),
|
||||
path('rsvp',bigday.views.rsvp, name='rsvp'),
|
||||
path('thanks', bigday.views.thanks, name='thank-you')
|
||||
path('thanks', bigday.views.thanks, name='thanks'),
|
||||
path('sorry', bigday.views.sorry, name='sorry'),
|
||||
]
|
||||
|
|
Loading…
Reference in New Issue