The logic required to make this work is already contained in the addvolunteer form.
However, the admin interface has this functionality already, and this can be copied to create the desired situation. Basically, you need to do a try-except, and inside of that do Event.objects.get() to check if the event already exists. The check for existence is necessarily a check for equality, and this can be based on time, date, and type all together...
On that note, it might be worth checking django docs to see if there is an idiom for defining the behavior of the equality operation for a model instance.
The logic required to make this work is already contained in the addvolunteer form.
However, the admin interface has this functionality already, and this can be copied to create the desired situation. Basically, you need to do a
try
-except
, and inside of that doEvent.objects.get()
to check if the event already exists. The check for existence is necessarily a check for equality, and this can be based on time, date, and type all together...On that note, it might be worth checking django docs to see if there is an idiom for defining the behavior of the equality operation for a model instance.