Hello everyone,

I want to implement a model which make references to 2 groups, to do this, 
I thought I had to defined, in the model which links the 2 groups, a 
foreign key for each Group like this:

from django.contrib.auth.models import Group
from django.db import models


class GroupLinker(models.Model):
    EMSGroup = models.ForeignKey(Group, on_delete=models.CASCADE)
    LDAPGroup = models.ForeignKey(Group, on_delete=models.CASCADE)


But I got that error: 

ERRORS:
api.GroupLinker.EMSGroup: (fields.E304) Reverse accessor for 
'GroupLinker.EMSGroup' clashes with reverse accessor for 
'GroupLinker.LDAPGroup'.
        HINT: Add or change a related_name argument to the definition for 
'GroupLinker.EMSGroup' or 'GroupLinker.LDAPGroup'.
api.GroupLinker.LDAPGroup: (fields.E304) Reverse accessor for 
'GroupLinker.LDAPGroup' clashes with reverse accessor for 
'GroupLinker.EMSGroup'.
        HINT: Add or change a related_name argument to the definition for 
'GroupLinker.LDAPGroup' or 'GroupLinker.EMSGroup'.

I don't understand why I should add a related name, because my future table 
will just link my 2 groups right? Where am I wrong?

Kind regards,

Benjamin.

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To post to this group, send email to [email protected].
Visit this group at https://groups.google.com/group/django-users.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/d3edbdd1-3bfa-43ec-9565-e2665bb0c878%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to