Cannot resolve keyword -> on reverse ForeignKey after upgrade to 1.8

122 views
Skip to first unread message

Galia Ladiray

unread,
May 18, 2015, 7:49:17 PM5/18/15
to django...@googlegroups.com, Martyn CLEMENT
Hi,
I wonder if anyone can help me, or just share the pain ...

I have some code that goes like this (this is a very simplified version of my code):
---------------------------------------------------------------------
class Follower(models.Model):
    follower = models.ForeignKey(MyUser, related_name='followed_by')
    followed = models.ForeignKey(MyUser, related_name='follow')
    
Class MyUser(models.Model):
   .... some fields

    def get_followed(self, limit=16):
        return MyUser.objects.filter(follow__follower__id=self.pk)
---------------------------------------------------------------------

This used to work fine, BUT after upgrade to django 1.8 I get an error message:

Cannot resolve keyword 'follow' into field. Choices are: (some fields and ...), follow
(which is a bit frustrating error message)

I tried to recreate this on a new project (so I can post real code!) but I cannot recreate the error, maybe something to do with the way tables were names before and are named now on the DB?
I have a feeling it is something to do with the django 1.7 application loader (regarding naming) but it used to work fine in 1.7

Any ideas will be highly appreciated

Thanks
Galia Ladiray-Weiss  

James Schneider

unread,
May 18, 2015, 8:46:55 PM5/18/15
to django...@googlegroups.com, Martyn CLEMENT

My guess is a select_related('follow') call somewhere is causing the issue. The behavior for select_related() changed in 1.8.

Can you post the entire trace back?

-James

--
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 django-users...@googlegroups.com.
To post to this group, send email to django...@googlegroups.com.
Visit this group at http://groups.google.com/group/django-users.
To view this discussion on the web visit https://groups.google.com/d/msgid/django-users/d58285fb-b7cd-40c7-9750-ee89b3bddc54%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Galia Ladiray

unread,
May 19, 2015, 3:30:43 AM5/19/15
to django...@googlegroups.com, martyn....@gmail.com
AHhhhhhhhhhhh!
Thanks for the answer we found the problem!
No wonder no one but us had this problem, it was an old monkey-patch that we did not even know it exists, that modified the behaviour of the queryset
Sorry for the trouble

Galia
Reply all
Reply to author
Forward
0 new messages