On Tue, Mar 27, 2012 at 1:57 AM, Stanwin Siow wrote:
> queryset = Memberships.objects.get(id__exact=4)
the .get() method doesn't return a queryset, it returns a record
object, so your 'queryset' variable is the 'membership' object itself.
the error you get:
> Memberships has no attribute all.
ok i managed to get it to work by using filter.
Cheers
Best Regards,
Stanwin Siow
On Mar 27, 2012, at 3:32 PM, Denis Darii wrote:
> I think the error "Memberships has no attribute all" is not related to your
> QuerySet. Try to look deeply into your code.
>
> BTW, your QuerySet must be:
>
>
I tried changing it to what you said.
It's still showing the error.
"Memberships object has no attribute all"
This only happens when i use get. When i use order_by. the page shows but with
unnecessary options.
Best Regards,
Stanwin Siow
On Mar 27, 2012, at 3:32 PM, Denis Darii wrote:
>
I think the error "Memberships has no attribute all" is not related to your
QuerySet. Try to look deeply into your code.
BTW, your QuerySet must be:
queryset = Memberships.objects.get(id=4)
or better, if your id is also the primary key:
queryset = Memberships.objects.get(pk=4)
On 27 March 2012
Hello,
How do i transform this SQL query into a queryset?
select membership_type from memberships where id ='4'
i tried the following:
queryset = Memberships.objects.get(id__exact=4)
however django is throwing me an error with the following:
Memberships has no attribute all.
I know this is
5 matches
Mail list logo