models.py:
class Societe(models.Model):
...
class Client(Societe):
...
class Meta(Societe.Meta):
proxy = True
class Fournisseur(Societe):
...
class Meta(Societe.Meta):
proxy = True
class Commande(models.Model):
Client = models.ForeignKey(Client, related_name='Commandes')
Fournisseur = models.ForeignKey(Fournisseur, related_name='Commandes')
这适用于Django 1.9,但在1.11中,我收到错误:
Commande.Client: (fields.E304) Reverse accessor for 'Commande.Client' clashes with reverse accessor for 'Commande.Fournisseur'.
Commande.Client: (fields.E305) Reverse query name for 'Commande.Client' clashes with reverse query name for 'Commande.Fournisseur'.
Commande.Fournisseur: (fields.E304) Reverse accessor for 'Commande.Fournisseur' clashes with reverse accessor for 'Commande.Client'.
Commande.Fournisseur: (fields.E305) Reverse query name for 'Commande.Fournisseur' clashes with reverse query name for 'Commande.Client'.
Django似乎认为Client
和Fournisseur
是相同的模型。
我不想改变相关的名字,知道如何解决这个问题吗?