Accessor for m2m field 'groups' clashes with related m2m field 'Group.user_set'.
See original GitHub issueHi there, I’m trying to extend the UserEmail model, and when I run the schemamigration with South, I get this:
CommandError: One or more models did not validate:
ducales_site.usuariocustomemailuser: Accessor for m2m field 'groups' clashes with related m2m field 'Group.user_set'. Add a related_name argument to the definition for 'groups'.
ducales_site.usuariocustomemailuser: Accessor for m2m field 'user_permissions' clashes with related m2m field 'Permission.user_set'. Add a related_name argument to the definition for 'user_permissions'.
custom_user.emailuser: Accessor for m2m field 'groups' clashes with related m2m field 'Group.user_set'. Add a related_name argument to the definition for 'groups'.
custom_user.emailuser: Accessor for m2m field 'user_permissions' clashes with related m2m field 'Permission.user_set'. Add a related_name argument to the definition for 'user_permissions'.
Here is my model:
from custom_user.models import AbstractEmailUser
class UsuarioCustomEmailUser(AbstractEmailUser):
generos = (('M', 'Masculino'), ('F', 'Femenino'),)
tipo_documento = (('CC', 'Cédula de Ciudadanía'), ('CE', 'Cédula de Extranjería'),)
genero = models.CharField(blank = True, max_length = 1, choices = generos, verbose_name = u'Género')
t_documento = models.CharField(blank = True, max_length = 2, choices = tipo_documento, verbose_name = u'Tipo de documento')
n_documento = models.IntegerField(blank = True, max_length = 15, verbose_name = u'No. de documento')
direccion = models.CharField(blank = True, max_length = 140, verbose_name = u'Dirección')
ciudad = models.ForeignKey(Ciudad, blank = True, verbose_name = u'Ciudad')
twitter = models.CharField(blank = True, max_length = 15, verbose_name = u'Twitter')
tyc = models.BooleanField(verbose_name = u'Acepta términos y condiciones')
recibir_sms = models.BooleanField(blank = True, verbose_name = u'Acepta recibir información en el celular')
recibir_correo = models.BooleanField(blank = True, verbose_name = u'Acepta recibir información en el correo electrónico')
How can I add the related_name argument to solve this? Thanks in advance.
Issue Analytics
- State:
- Created 9 years ago
- Comments:6 (3 by maintainers)
Top Results From Across the Web
Django 1.5 Custom User for m2m field 'groups' clashes
I get this: accounts.companyuser: Accessor for m2m field 'groups' clashes with related m2m field 'Group.user_set'. Add a related_name argument ...
Read more >Accessor for field clashes with related field - Google Groups
Hi! I want to create an object that contains 2 links to users. For example class GameClaim(models.Model): target = models.ForeignKey(User) claimer = models....
Read more >Reverse accessor for 'User.groups' clashes ... - Django Forum
I'm trying to start a new app (called jsnake) and when I try to run makemigrations for the first time I get: ERRORS:...
Read more >auth.User.groups: (fields.E304) Reverse accessor ... - YouTube
PYTHON : auth.User.groups: ( fields.E304) Reverse accessor for 'User. groups ' clashes with reverse accessor for 'UserManage.groups' [ Gift ...
Read more >[Answered]-auth.User.groups: (fields.E304) Reverse accessor ...
Coding example for the question auth.User.groups: (fields.E304) Reverse accessor for 'User.groups' clashes with reverse accessor for ...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
Oh, I see. You need to change the setting
AUTH_USER_MODEL
to point to your subclassed model. From your error message, I think it should be:Can you check if works now?
I see this is not clear enough in the docs, will update them to explain it with more detail.
Now it’s working fine. Yes, the docs are a little bit unclear, an update will be appreciated.
Thank you