On Thu, Jun 9, 2011 at 11:00 AM, javatina <serge.i...@gmail.com> wrote:

> I need a list of all IDs for model records. So, I do this
> concept_ids = Concept.objects.values_list('concept_id', flat=True)
>
> concept_ids is a ValuesListQuerySet - I got it. According to docs
> since ValuesListQuerySet is a subclass of QuerySet I can do
> list(concept_ids) - see
>
> https://docs.djangoproject.com/en/dev/ref/models/querysets/#when-querysets-are-evaluated
>
> However, I am getting on this line
> 'ValuesListQuerySet' object has no attribute 'META' error.
>
> For the sake of experimentation, if I try
> concept_ids = list(Concept.objects.all())
>
> I am getting 'QuerySet' object has no attribute 'META'. But this is
> like in docs (see link above):
> entry_list = list(Entry.objects.all())
>
> What am I doing wrong?
>


What are you doing with the list once you generate it? Are you just running
that single line of code, for instance, in a Python shell, or is this error
generated in a view?

"META", in all caps like that, is only used in Django as an attribute of an
HttpRequest object. The string "META" doesn't even occur in the db package,
so I can't imagine how simply wrapping a QuerySet in a list() call could
trigger an exception like that.

Can you post the rest of the code around this, or at least more of a
traceback, unless that is really all that there is? And if it is, then I'd
really like to take a look at your model definition.

-- 
Regards,
Ian Clelland
<clell...@gmail.com>

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@googlegroups.com.
To unsubscribe from this group, send email to 
django-users+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en.

Reply via email to