Can legacy variables be added to exceptions or widgets?
I have the following setup.
class AddPropertyForm(forms.ModelForm): num_months = forms.ChoiceField(choices=MONTHS) request_featured = forms.BooleanField(required=False) featured_months = forms.ChoiceField(choices=MONTHS) class Meta(): model = RentalProperty exclude = ('listing_id', 'active_listing', 'active_listing_expiry_date', 'featured_property', 'featured_expiry_date', 'slug', 'property_manager') widgets = { 'property_type': forms.Select(attrs={'onchange':'propertyType()'}), } class EditPropertyForm(AddPropertyForm): request_reactivation = forms.BooleanField(required=False) class Meta(AddPropertyForm.Meta): exclude = ('address1', 'property_type') widgets = { 'request_reactivation': forms.CheckboxInput(attrs {'onchange':'reactivateProperty()'}), }
I am trying to get the final result for EditPropertyForm to look like this for exclude and widgets statements.
exclude = ('address1', 'property_type', 'listing_id', 'active_listing', 'active_listing_expiry_date', 'featured_property', 'featured_expiry_date', 'slug', 'property_manager') widgets = { 'request_reactivation': forms.CheckboxInput(attrs {'onchange':'reactivateProperty()'}), 'property_type': forms.Select(attrs={'onchange':'propertyType()'}), }
If there is a better approach, suggest.
Any help is most appreciated.
source share