0
class MyObject (models.Model):
name = models.CharField()
class Day (models.Model):
day = models.IntegerField()
class Month (models.Model):
month = models.IntegerField()
myobj = models.ForeignKey (MyObject)
days = models.ManyToManyField (Day)
用戶與網站上的形式引入了一個月。 我提出一個要求:
MyObject.objects.filter (month__month = <month, which is entered by the user with the form>
<day, which is entered by the user with the form> in month__days????
)
如何檢查查詢用戶輸入的日期是(目前)在M2M通信天在模型中月?
工程!我使用了以下選項:MyObject.objects.filter(month__month = 3, month__days__day__exact = 5)。謝謝! – user2396461