Show a message if the invitation code is wrong
This commit is contained in:
parent
2e73ef2464
commit
aec8ea57af
|
@ -108,6 +108,12 @@
|
|||
<h2>RSVP</h2>
|
||||
|
||||
<p>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.</p>
|
||||
|
||||
{% if invalid_code %}
|
||||
<div class="alert alert-danger" role="alert">
|
||||
Sorry, this invitation code doesn't seem quite right...
|
||||
</div>
|
||||
{% endif %}
|
||||
|
||||
<form action="{% url 'rsvp' %}" method="get" class="form-inline justify-content-center">
|
||||
<label class="sr-only" for="rsvp-code">RSVP Code</label>
|
||||
|
|
|
@ -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
|
||||
|
|
Loading…
Reference in New Issue