我在Django项目中创建了一些应用程序,它们被称为Coupon
和{
class Coupon(models.Model):
store = models.ForeignKey(Store, on_delete=models.DO_NOTHING)
title = models.CharField(max_length=200)
...
def __str__(self):
return self.title
class Store(models.Model):
name = models.CharField(max_length=200)
description = models.TextField(blank=True)
...
def __str__(self):
return self.name
我想实现的是当用户点击这些优惠券(Coupon1,Coupon2)时,用户应该在与Store1相关的单独视图中看到所有优惠券的列表。在
我该怎么做?在
假设我在URL中有优惠券的ID,名为
coupen_id
如果我正确地理解了你想要什么,那就是:
相关问题 更多 >
编程相关推荐