我有兩個 Django 模型:Match 和 MatchRegister。我想獲取不在 MatchRegister 對象中的所有匹配項的列表,但我無法這樣做。你能幫我實現它嗎?在我的兩個班級之下class Match(models.Model): """Model representing Match object""" match_number = models.CharField( max_length=10 ) home_team = models.ForeignKey( Team, on_delete=models.SET_NULL, null=True, related_name='home_team' ) away_team = models.ForeignKey( Team, on_delete=models.SET_NULL, null=True, related_name='away_team' ) match_category = models.ForeignKey( MatchCategory, on_delete=models.SET_NULL, null=True ) date_time = models.DateTimeField( default=timezone.now ) notes = models.TextField( max_length=1000, blank=True ) last_update = models.DateTimeField( auto_now=timezone.now )class MatchRegister(models.Model): match = models.ForeignKey( Match, on_delete=models.SET_NULL, null=True )
添加回答
舉報
0/150
提交
取消