I am currently using inlineformset_factory to get a formset with Holidays for a Person, but I only want to display the Holiday objects that are in the future.
HolidaysFormset = inlineformset_factory(Person, Holiday)
Within the Person class, it is easy to get the future holidays:
def future_holidays(self):
return self.holidays.filter(end__gte=datetime.date.today())
I have looked at the relevant source code, and the formfield_callback looked slightly promising, but that is only called on a per field basis, and cannot be used (I think) to limit which objects match.
Any suggestions? Will I be best off creating my own FormSet, or a sub-class of Holiday? Or should I be looking into using a custom Manager?