class Product(models.Model):
title = models.TextField(verbose_name='Номер',blank=True)
producte = models.TextField(verbose_name='Продукт')
order = models.ForeignKey('orders.Order', verbose_name='Заказ')
class Order(models.Model):
title = models.CharField(verbose_name='Название заказа', max_length=60)
slug = models.SlugField(verbose_name='URL',unique=True)# view.py
def ViewOrder(request, slug):
order = Order.objects.select_related().get(slug=slug)
starts = order.start_set.all()
id = Order.pkurl(r'^(?P<slug>[-\w]+)/$', ViewOrder, name='view_order'),class ProducteForm(ModelForm):
class Meta:
model = Producte
fields = ('title','producte', 'order')
class Category(models.Model):
name =....
class Product(models.Model):
category = models.ForeignKey(Category)
title = models.TextField(verbose_name='Номер',blank=True)
producte = models.TextField(verbose_name='Продукт')
class Order(models.Model):
products = models.ManyToMany(Product)