Skip to content Skip to sidebar Skip to footer

'wsgirequest' Error When Trying To Create Model Object Based On Username For Logged In User

AIM I am attempting to set the Alarm.username to the username of the currently logged in User. The problem is identical to another query, although my code is a little different in

Solution 1:

It should be self.request.user.username:

username = User.objects.get(username=self.request.user.username)

Or since request.user already contains current user object better to use:

username = self.request.user

Post a Comment for "'wsgirequest' Error When Trying To Create Model Object Based On Username For Logged In User"