I have the following filter:
open_slots = Opening.objects.filter(club_id=club_id, day=datetime.date.today(), reservation ='Open')
I want to create another list "closed_slots" that has all the same attributes as the above except that reservation is not equal to 'Open'. When I tried using reservation !='Open' I get an error. How do I fix this?
Use the exclude
method. Details here.
open_slots = Opening.objects.filter(club_id=club_id, day=datetime.date.today()).exclude(reservation ='Open')
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With