Sunday, March 13, 2016

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

On Sunday, 13 March 2016 20:01:52 UTC, NoviceSortOf wrote:

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 



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.

--
You received this message because you are subscribed to the Google Groups "Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to django-users+unsubscribe@googlegroups.com.
To post to this group, send email to django-users@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.

No comments:

Post a Comment