A simple seat reservation tool sending confirmation emails with QR-code tickets. The live version is at tickets.tvmettmenstetten.ch. A lot of this has bben hardcoded and wasn't intended to be transferred to a different site, but it shouldn't be hard to modify.
Please feel free to use and modify this code to your liking (That's what the MIT licence says). If you have time to make some improvement to the code, contributions are very welcome!
And if you need help getting stuff running, I'm always happy to do so :)
Modifications needed to get this running (Most of them are marked with a TODO
in the code):
.htaccess
anddata/.htaccess
: Set theAuthUserFile
correctly.- Everything in
config/text.yml
needs adaptation. In particular the payment infos in the entriesmail_msg_bill
andmail_msg_bill_reminder
. - The room layout is hardcoded. To change it you may want to adapt CSS style in
css/room.css
, along with the methodcreate_room()
in both filesdynamic_parts.py
anddynamic_parts_op.py
. The config fileconfig/config.yml
contains two relevant optionstables
andseats_per_table
that can be helpful and finally the images underimg/
might need adaptation. - The email credentials are hardcoded in
utils/mail.py
. - The log-files under
logs/
and the data files underdata/
should be autogenerated if missing, but they might have wrong file permissions. Refer to the filefix_permissions
for guidance.
That's the index.cgi
. There are options to allow booking with food earlier than without and to close the option for food earlier. The form validation is done with JS (js/validateForm.js
) and again in the python script. However, the JS-validation is not very strict (for example "0" is a valid phone number).
Once a user booked seats they get an email with the confirmation and they can then pay the club using the information in this email.
Calling the optool.cgi
one gets to the admin site with options to cancel bookings, register payment, etc. Hovering over a name next to a booked seat displays the booking information. For changes in personal details it might be easier to change tehm directly in the data file.
IMPORTANT: Access to optool.cgi
and the data/
folder is done exclusively through .htaccess
files, and might need adaptation when setting up newly.
I set up a Python venv on the server. There are Bash exectution instructions on top of the files in the form of #!../../python_tvm/bin/python
which need adaptation, in particular in index.cgi
and optool.cgi
. (Python files end with .cgi
instead of .py
because of how our hosted apache server was set up)
The current version is running on Python 3.9.4 although the version shouldn't matter. the installed modules (pip freeze
) are
Pillow==8.3.1
pypng==0.0.21
PyQRCode==1.2.1
PyYAML==5.4.1
(I think Pillow is only needed to put the club logo in the middle of the QR-codes, which could be easily removed.)
In the file utils/mail.py
the email credentials to send confirmation emails are currently hardcoded. If you use GMAIL you have to "Allow less Secure Apps" in your Google account and it might be worth rewriting this bit using the GMAIL API.
We used an Android app (also here on Github) to read the QR-codes although that one isn't very adaptable either... The QR-code just contains some booking information in plain text.
It might be not necessary but at some point I set writing permissions (chmod a+w
) for certain files.