Make thank-you/sorry URLs better-looking
This commit is contained in:
parent
a969359428
commit
7dba93e2b2
|
@ -1,5 +1,4 @@
|
||||||
from django.shortcuts import render, redirect
|
from django.shortcuts import render, redirect
|
||||||
from django.urls import reverse
|
|
||||||
|
|
||||||
from .models import InvitedGuest
|
from .models import InvitedGuest
|
||||||
|
|
||||||
|
@ -18,7 +17,13 @@ def rsvp(request):
|
||||||
guest.attending = attending
|
guest.attending = attending
|
||||||
any_attending = any_attending or attending
|
any_attending = any_attending or attending
|
||||||
guest.save()
|
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):
|
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('admin/', admin.site.urls),
|
||||||
path('', bigday.views.index, name='index'),
|
path('', bigday.views.index, name='index'),
|
||||||
path('rsvp',bigday.views.rsvp, name='rsvp'),
|
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