Trips Year ModelForm Factory

fyt.db.forms.make_tripsyear_formfield_callback(trips_year)[source]

Return a function responsible for making formfields.

Used to restrict field choices to matching trips_year.

fyt.db.forms.tripsyear_modelform_factory(model, trips_year, *args, **kwargs)[source]

Model form factory which restricts related object choices to those for trips_year.

formfield_callback is responsible for constructing a FormField from a passed ModelField. Our callback intercepts the usual ForeignKey implementation and restricts the queryset to objects of this trips_year