Fwd: Django 1.7 polymorphism error

112 views
Skip to first unread message

Thiago Avelino

unread,
Sep 18, 2014, 10:52:25 AM9/18/14
to django-d...@googlegroups.com
Hi guys!

I think I found a error polymorphism in django 1.7, field slug exist in _meta.fields and run filter return error "FieldError: Cannot resolve keyword 'slug' into field. Choices".

Example: https://gist.github.com/avelino/793bdaf9f9732314912a


Slugged (abstract): https://github.com/opps/opps/blob/8e58a60c3cfea75b5cc4455d247a75b26f995b58/opps/core/models/core.py#L80

Article (abstract): https://github.com/opps/opps/blob/8e58a60c3cfea75b5cc4455d247a75b26f995b58/opps/containers/abstracts/articles.py#L12

Post: https://github.com/opps/opps/blob/8e58a60c3cfea75b5cc4455d247a75b26f995b58/opps/containers/types/posts.py#L8

Container: https://github.com/opps/opps/blob/8e58a60c3cfea75b5cc4455d247a75b26f995b58/opps/containers/models/core.py#L29


class Container(Publishable, Channeling):
class Article(Container, Slugged, Tagged):
class Post(Article):

In Post not exist slug (on filtrer) and _meta.fields exist!


Cheers,
Thiago Avelino

Carl Meyer

unread,
Sep 18, 2014, 11:11:30 AM9/18/14
to django-d...@googlegroups.com
Hi Thiago,
It certainly looks like there's a bug there somewhere, but there's so
much going on in your code (including inheriting from PolymorphicModel,
a third-party base class) that it's hard to say where the bug might be
(and whether it's even a bug in Django at all) without doing some direct
exploration (i.e. using pdb to trace into the filter call and figure out
exactly why a FieldError is being raised for 'slug' when a field of that
name appears to exist). I think if you want a resolution here, you'll
likely need to do that exploration yourself and try to narrow down the
source of the bug so that you can reproduce it with a simplest-case example.

Carl

Thiago Avelino

unread,
Sep 18, 2014, 11:48:59 AM9/18/14
to django-d...@googlegroups.com
Without PolymorphicModel he's the same error!

I'll write an example...



Cheers,
Thiago Avelino


Carl

--
You received this message because you are subscribed to the Google Groups "Django developers" group.
To unsubscribe from this group and stop receiving emails from it, send an email to django-develop...@googlegroups.com.
To post to this group, send email to django-d...@googlegroups.com.
Visit this group at http://groups.google.com/group/django-developers.
To view this discussion on the web visit https://groups.google.com/d/msgid/django-developers/541AF60D.6020502%40oddbird.net.
For more options, visit https://groups.google.com/d/optout.

Reply all
Reply to author
Forward
0 new messages