I tried to create an instance of a user in python shell using the following commands.
from django.contrib.auth.models import User
User.objects.all()
<QuerySet [<User: admin>]>
me = User.objects.get(username='rohan')
After which I got the following errors. Can someone please help.
Traceback (most recent call last):
File "<console>", line 1, in <module>
File "C:\Users\Rohan Jain\AppData\Local\Programs\Python\Python36\lib\site-packages\django\db\models\manager.py", line 85, in manager_method
return getattr(self.get_queryset(), name)(*args, **kwargs)
File "C:\Users\Rohan Jain\AppData\Local\Programs\Python\Python36\lib\site-packages\django\db\models\query.py", line 380, in get
self.model._meta.object_name
django.contrib.auth.models.DoesNotExist: User matching query does not exist.
You have no User with username rohan. You seems to have a user with username admin though.
me = User.objects.get(username='admin')