question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Accessor for m2m field 'groups' clashes with related m2m field 'Group.user_set'.

See original GitHub issue

Hi 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:closed
  • Created 9 years ago
  • Comments:6 (3 by maintainers)

github_iconTop GitHub Comments

1reaction
jcugatcommented, Aug 11, 2014

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:

AUTH_USER_MODEL = 'accounts.UserData'

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.

0reactions
Plorenzocommented, Aug 11, 2014

Now it’s working fine. Yes, the docs are a little bit unclear, an update will be appreciated.

Thank you

Read more comments on GitHub >

github_iconTop 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 >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found