I have the following models:
class Bill(models.Model):
date = models.DateTimeField(_("Date of bill"),null=True,blank=True)
class Item(models.Model):
name = models.CharField(_("Name"),max_length=100)
price = models.FloatField(_("Price"))
quantity = models.IntegerField(_("Quantity"))
bill = models.ForeignKey("Bill",verbose_name=_("Bill"),
related_name="billitem")
I know that this is possible:
from django.forms.models import inlineformset_factory
inlineformset_factory(Bill, Item)
and then process this via standard view.
Now I was wondering, if there is a way to achieve the same (meaning: using a inline for adding/editing items belonging to a bill) using class based views (not for the admin-interface).
See Question&Answers more detail:
os 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…