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.ktsiow@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+unsubscribe@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+unsubscribe@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/django-users?hl=en.
No comments:
Post a Comment