#24513: "... has no field named None" with M2MField when migrating
---------------------------------+--------------------------------------
     Reporter:  Kondou-ger       |                    Owner:  nobody
         Type:  Uncategorized    |                   Status:  new
    Component:  Migrations       |                  Version:  1.8rc1
     Severity:  Normal           |               Resolution:
     Keywords:  migrations, bug  |             Triage Stage:  Unreviewed
    Has patch:  0                |      Needs documentation:  0
  Needs tests:  0                |  Patch needs improvement:  0
Easy pickings:  0                |                    UI/UX:  0
---------------------------------+--------------------------------------

Comment (by Kondou-ger):

 In
 
[https://github.com/django/django/blob/1.8c1/django/db/backends/base/schema.py#L268
 django.db.backends.base.schema.py#L268] the call to `get_field()` is done,
 where
 {{{
 fields==(None, 'group'),
 model._meta.unique_together==((None, 'group'),),
 model==project.user__groups
 }}}
 The call to this is done at
 
[https://github.com/django/django/blob/1.8c1/django/db/backends/sqlite3/schema.py#L137
 django.db.backends.sqlite3.schema.py#L137] where `temp_model==<class
 '__fake__.User_groups'>`

 I also have a Groups model that refers to User. But there is no unique
 together constraint in the whole file:

 {{{
 class Groups(models.Model):
     owner = models.ForeignKey(settings.AUTH_USER_MODEL,
 related_name='owner')
     members = models.ManyToManyField(settings.AUTH_USER_MODEL,
 related_name='members')
     name = models.CharField(max_length=50, unique=True,
 validators=[RegexValidator(regex=r'^[\w.@+-]+$')])
     displayname = models.CharField(max_length=150, blank=True)
     description = models.CharField(max_length=5000, blank=True)
     default_moderators = models.ManyToManyField(settings.AUTH_USER_MODEL,
 related_name="group_default_moderators")
 }}}

--
Ticket URL: <https://code.djangoproject.com/ticket/24513#comment:2>
Django <https://code.djangoproject.com/>
The Web framework for perfectionists with deadlines.

-- 
You received this message because you are subscribed to the Google Groups 
"Django updates" 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].
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-updates/068.807406d573532b6e1ddbc703464e4c6d%40djangoproject.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to