Have it scroll to the form
This commit is contained in:
parent
aec8ea57af
commit
da1664385d
|
@ -1,17 +1,21 @@
|
|||
from django.shortcuts import render, redirect
|
||||
from django.urls import reverse
|
||||
|
||||
from .models import InvitedGuest
|
||||
|
||||
def index(request):
|
||||
return render(request, 'index.html')
|
||||
|
||||
def try_again(request):
|
||||
return render(request, 'index.html', {'invalid_code': True})
|
||||
|
||||
def rsvp(request):
|
||||
rsvpCode = request.GET['rsvp-code']
|
||||
guests = InvitedGuest.objects.filter(rsvpCode = rsvpCode)
|
||||
if request.method == 'GET':
|
||||
if not guests:
|
||||
# No guests with that code
|
||||
return render(request, 'index.html', {'invalid_code': True})
|
||||
return redirect(reverse('try-again') + '#rsvp')
|
||||
return render (request, 'rsvp.html', {'guests':guests, 'rsvpCode': rsvpCode})
|
||||
elif request.method == 'POST':
|
||||
any_attending = False
|
||||
|
|
|
@ -5,6 +5,7 @@ import bigday.views
|
|||
urlpatterns = [
|
||||
path('admin/', admin.site.urls),
|
||||
path('', bigday.views.index, name='index'),
|
||||
path('try-again', bigday.views.try_again, name='try-again'),
|
||||
path('rsvp',bigday.views.rsvp, name='rsvp'),
|
||||
path('thanks', bigday.views.thanks, name='thanks'),
|
||||
path('sorry', bigday.views.sorry, name='sorry'),
|
||||
|
|
Loading…
Reference in New Issue