I have a form similar to that declared below:
class LineItemForm(Mixin, forms.ModelForm):
cost = forms.FloatField()
field_order = ['part', 'cost']
class Meta:
model = LineItem
fields = ['part']
And then I have another form that inherits from that:
class InventoryTransactionForm(
LineItemForm): class Meta:
fields = ['part', 'document']
exclude = []
I have two views that use the InventoryTransactionForm. View A uses it in a formset like so:
InventoryFormset = modelformset_factory(LineItem, InventoryTransactionForm, formset=
InventoryTransactionFormSet) inventory_formset = InventoryFormset(request.POST or None, initial=[{"part": default_part}])
View B uses just the form:
form = InventoryTransactionForm(
request.POST or None, instance=inventorytransaction.
transaction.lineitem, prefix="inventory", create_mode=False )
When I load View B, I get this exception:
ModelForm has no model class specified.
Everything works fine in View A.
Any ideas, thoughts, or suggestions?
Thank you,
Matthew
You received this message because you are subscribed to the Google Groups "Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to django-users+unsubscribe@googlegroups.com.
To post to this group, send email to django-users@googlegroups.com.
Visit this group at https://groups.google.com/group/django-users.
To view this discussion on the web visit https://groups.google.com/d/msgid/django-users/e28dd82e-9398-48e0-8b65-21b939a4426c%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
No comments:
Post a Comment