I try to make a django application to create bills.
I have two tables (Bill, Delivery) and one Bill can have up to 5 deliveries.
Now I want a form for the bill and one delivery. To add or remove a delivery I want a button.
I am using class-based-views. How to realise this in django?
I have found django-extra-views, but I couldn't get it work. I have also seen this link here but this is not dynamic and function-based views.
models.py
class Bill(models.Model):
company = models.ForeignKey(Bioenergie)
customer = models.ForeignKey(Customer)
price = models.DecimalField(max_digits=5,decimal_places=2)
bill_number = models.CharField(max_length=10, null=True)
delivery_date = models.DateField()
date = models.DateField(null=True)
class Delivery(models.Model):
billing_choises = (('1', 'Menge'),
('2', 'Gewicht/Feuchtigkeit')
)
option = models.CharField(choices=billing_choises, default=1, max_length=20)
amount = models.PositiveIntegerField(blank=True, null=True)
humidity = models.SmallIntegerField(blank=True, null=True)
weight = models.DecimalField(blank=True, null=True, decimal_places=2, max_digits=5)
bill = models.ForeignKey(Bill)
Blue: Forms
Gray: Buttoms