I have a model that looks like this:
class Event(models.Model):
event_dates = ManyToManyField("EventDate")
#...
class EventDate(models.Model):
event_date = DateField()
#...
However, in the django admin MultipleSelect
form field that gets show for event_dates in the EventAdmin
, I'd like to limit the queryset to event_dates that are not in the past.
The queryset would be something like:
event_date_queryset = EventDate.objects.filter(event_date__gte = datetime.date.today())
But where can I set this queryset so that only non-past dates show up in the field?
(I don't currently have a custom form for the EventAdmin
but would be happy to add one.)