Trouble with objects.all() and objects.get()

37 views
Skip to first unread message

NoviceSortOf

unread,
Mar 13, 2016, 4:01:52 PM3/13/16
to Django users

I can't manage to figure out why I consistently get a syntax error when attempted to 
use objects.all or objects.get.

From my code in view.py

>>from books.models    import Interests 

The Interests model imports without a problem, 
but when I try to access the model with any of the following I get syntax errors.

>> interests_obj = Interests.objects.get(pk=1)

>> interests_obj = Interests.objects.all()
  


Please advise 


Daniel Roseman

unread,
Mar 13, 2016, 5:11:03 PM3/13/16
to Django users
If you're asking about an error, you should post it, along with the full traceback, so we can see where it is coming from. 

Often a syntax error is due to a problem on the previous line, such as an unclosed parenthesis.
-- 
DR.

Darrell Jonsson

unread,
Mar 13, 2016, 7:00:34 PM3/13/16
to django...@googlegroups.com
Thanks for the reply.

Looking at the line before the problem
had to do with End of line formatting going
between Windows and Linux editors.

Will take your advice in the future and post more trace back
information.

Thanks.
--
You received this message because you are subscribed to a topic in the Google Groups "Django users" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/django-users/u3lIohyO2vc/unsubscribe.
To unsubscribe from this group and all its topics, send an email to django-users...@googlegroups.com.
To post to this group, send email to django...@googlegroups.com.
Visit this group at https://groups.google.com/group/django-users.
To view this discussion on the web visit https://groups.google.com/d/msgid/django-users/7af75ce3-2706-49e8-94ef-c8988104a7d4%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply all
Reply to author
Forward
0 new messages