[Answer]-Getting error in refering user object django

1👍

Is the request.user authenticated? is it an AnonymousUser?

UserProfile.objects.get() method is not for creating an object but to get it from the database.
if it doesn’t exist an exception will be raised.
use UserProfile.objects.create(..) with the initial data you may need for it.

hope this helps!

== edit ==

also, note that you are referring count_form in the RequestContext even when it wasn’t initialized in case that the request.method was not “POST” (i.e. “GET”)

Leave a comment