#24768: KeyError: u"Problem installing fixture '<filename>.json': u'manager'"
-------------------------------------+-------------------------------------
     Reporter:  brian                |                    Owner:  nobody
         Type:  Bug                  |                   Status:  new
    Component:  Database layer       |                  Version:  1.8
  (models, ORM)                      |
     Severity:  Normal               |               Resolution:
     Keywords:                       |             Triage Stage:
                                     |  Unreviewed
    Has patch:  0                    |      Needs documentation:  0
  Needs tests:  0                    |  Patch needs improvement:  0
Easy pickings:  0                    |                    UI/UX:  0
-------------------------------------+-------------------------------------

Comment (by brian):

 Ok, this is getting a tad confusing. For some reason the following code

 {{{
 group.project
 }}}

 returns a RelatedManager instead of a Project (did I miss something in the
 release notes about this?). As in, the following code:

 {{{
 print("======", type(group), type(group.project))
 }}}

 displays:

 {{{
 ('======', <class 'karaage.people.models.Group'>, <class
 'django.db.models.fields.related.RelatedManager'>)
 }}}

 Group.project is a reverse relationship from a Project:

 {{{
 from mptt.models import MPTTModel
 class Project(MPTTModel):
     ...
     group = models.OneToOneField(Group)
     ...
 }}}

 So I believe group.project is suppose to return a Project, not a
 RelatedManager. I then pass the "project" to the Django function:

 {{{
 query = query.filter(machine_category__projectquota__project=project)
 }}}

 Which gets confused because it has the wrong type.

--
Ticket URL: <https://code.djangoproject.com/ticket/24768#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/063.e80293862d66a016e9e43d437e485535%40djangoproject.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to