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:
> 
> 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 08:57, Stanwin Siow <stanwin.kts...@gmail.com> wrote:
> 
> 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 a trivial question but i've been through the tutorials 
> https://docs.djangoproject.com/en/dev/topics/db/queries/
> 
> and i don't unds where this error is coming from.
> 
> Do appreciate any help rendered. 
> 
> Thank you.
> 
> 
> Best Regards,
> 
> Stanwin Siow
> 
> 
> 
> 
> -- 
> 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.
> 
> 
> 
> -- 
> I'm using Linux because i'm freedom dependent.
> 
> 
> -- 
> 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.

-- 
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