diff --git a/bigday/templates/index.html b/bigday/templates/index.html index e9c28a8..ec9e6db 100644 --- a/bigday/templates/index.html +++ b/bigday/templates/index.html @@ -108,6 +108,12 @@

RSVP

Kindly let us know if you will be able to attend our wedding! On the back of your invitation should be a two-digit code. Please enter that in the box below, which will take you to a personalized RSVP form.

+ + {% if invalid_code %} + + {% endif %}
diff --git a/bigday/views.py b/bigday/views.py index 7d3a94d..4f84631 100644 --- a/bigday/views.py +++ b/bigday/views.py @@ -9,6 +9,9 @@ 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 render (request, 'rsvp.html', {'guests':guests, 'rsvpCode': rsvpCode}) elif request.method == 'POST': any_attending = False