I have two models: Product
and Rating
. Product
model is a foreign key in Rating
.
I want to do the following in the Django admin panel:
On Clicking the Rating model, all the products should appear at first. And when I click on any product all the rating objects related to that product should arise.
Here are the models:
class Product(models.Model):
product_name = models.CharField(null=True, blank=True, max_length=200)
product_cost = models.BigIntegerField(null=True, blank=True)
product_size = models.BigIntegerField(null=True, blank=True)
class Rating(models.Model):
product = models.ForeignKey(Product, on_delete=models.CASCADE)
rating = models.IntegerField(null=True, blank=True)
added_on = models.DateTimeField(null=True, blank=True)
Normally, the path to the Rating objects is Like this:
/admin/app/rating/
In my case, the path to the Rating objects should be like this
/admin/app/product/rating/
I am new to python Django please help me.
不确定您的问题,需要更多说明我建议阅读有关管理员内联的信息
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.