Answer the question
In order to leave comments, you need to log in
How to create a link to a specific model element?
Good afternoon.
Please tell me the best way to do it.
There is a model, it has a field with the ForeignKey type.
class ProductsInOrder(models.Model):
product = models.ForeignKey(Products, on_delete=models.CASCADE, verbose_name='Товар')
price = models.CharField(max_length=20, default='', blank=True, verbose_name='Цена')
order = models.ForeignKey(Orders, on_delete=models.CASCADE, verbose_name='Заказ')
class Orders(models.Model):
name = models.CharField(max_length=40, blank=True)
town = models.CharField(max_length=80, blank=True)
tel = models.CharField(max_length=50)
Answer the question
In order to leave comments, you need to log in
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question