Saturday, June 7, 2014

Re: Model._meta.get_all_related_objects() returns [] in Django 1.7b4

While it is true that _meta is technically unsupported API, it is sufficiently "core" that it wouldn't be changed lightly.  I'm not aware of any changes to _meta semantics that have been introduced in 1.7 - especially not in the  basic reflection structure of relations.

I'm would also be deeply surprised if the bug is as simple as described (ie all calls to get_all_related_objects return []). That API is used internally, so if it were misfiring consistently, I would have expected that to be picked up by Django's own test suite.

So, Lucas - it sounds like there is something odd going on here, and it's probably related to something specific to your project. Are you able to reduce the behavior you are seeing to a simple reproducible test case? ie the minimal project that demonstrates the problem?

Yours,
Russ Magee %-)

On Sunday, June 8, 2014, Babatunde Akinyanmi <tundebabzy@gmail.com> wrote:

Hi Lucas. The development version of django is unstable so if you choose to use it, you should not be surprised if strange things like what you have described happen. Also, _meta is a private part of the code base that can change anytime.

On 7 Jun 2014 21:18, "Lucas Sampaio" <lucas@lsmagalhaes.com> wrote:
Hello everyone,

I'm new in this group, I'm a brazilian web developer trying to set up a new project using Django 1.7b4 (I couldn't wait to test the new migrations app).

Problem is: I need to write a Serializer, like Django-REST-Framework does[1], but there's a problem: I don't know why, but Model._meta.get_all_related_objects() always returns [ ]. The same code running with Django 1.6 works as expected. Also, the models I'm using for tests are defined on "libs.tests.examples.models". I don't know if it might be a problem.

Is there anything I can do to make it work or is it really a bug with 1.7?

[]s,
Lucas S.

[1]: https://github.com/tomchristie/django-rest-framework/blob/master/rest_framework/serializers.py#L734

--
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+unsubscribe@googlegroups.com.
To post to this group, send email to django-users@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/813a4ab4-215f-44cc-aec1-fa58919e8623%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

--
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+unsubscribe@googlegroups.com.
To post to this group, send email to django-users@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/CA%2BWjgXPgPk1V6xB%2BaPw6eGyhhZHgw9_0sFB52frMT4DfCugAPw%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.

--
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+unsubscribe@googlegroups.com.
To post to this group, send email to django-users@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/CAJxq84_uk%3DotK_X%3DBWTsXeg95NLVSJcX5Mq%3Dd_7M%2BWA0fYZj0A%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.

No comments:

Post a Comment