Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- class Users(models.Model):
- group_id = models.IntegerField()
- name = models.CharField(max_length=100, null=True)
- email = models.CharField(max_length=100, null=True, unique=True)
- password = models.CharField(max_length=255, null=False)
- remember_token = models.CharField(max_length=255, null=True)
- activated = models.IntegerField(default=1)
- banned = models.IntegerField(default=0)
- ban_reason = models.CharField(max_length=255, null=True)
- otp = models.CharField(max_length=255, null=True)
- created_at = models.DateTimeField()
- updated_at = models.DateTimeField(null=True)
- USERNAME_FIELD = 'email'
- REQUIRED_FIELDS = ['username','password',]
- class Meta:
- managed = False
- db_table = 'users'
- File "/usr/local/lib/python2.7/dist-packages/django/core/handlers/base.py", line 149, in get_response
- response = self.process_exception_by_middleware(e, request)
- File "/usr/local/lib/python2.7/dist-packages/django/core/handlers/base.py", line 147, in get_response
- response = wrapped_callback(request, *callback_args, **callback_kwargs)
- File "/usr/local/lib/python2.7/dist-packages/django/views/decorators/csrf.py", line 58, in wrapped_view
- return view_func(*args, **kwargs)
- File "/usr/local/lib/python2.7/dist-packages/django/views/generic/base.py", line 68, in view
- return self.dispatch(request, *args, **kwargs)
- File "/usr/local/lib/python2.7/dist-packages/rest_framework/views.py", line 466, in dispatch
- response = self.handle_exception(exc)
- File "/usr/local/lib/python2.7/dist-packages/rest_framework/views.py", line 463, in dispatch
- response = handler(request, *args, **kwargs)
- File "/usr/local/lib/python2.7/dist-packages/rest_framework_jwt/views.py", line 56, in post
- if serializer.is_valid():
- File "/usr/local/lib/python2.7/dist-packages/rest_framework/serializers.py", line 213, in is_valid
- self._validated_data = self.run_validation(self.initial_data)
- File "/usr/local/lib/python2.7/dist-packages/rest_framework/serializers.py", line 410, in run_validation
- value = self.validate(value)
- File "/usr/local/lib/python2.7/dist-packages/rest_framework_jwt/serializers.py", line 50, in validate
- user = authenticate(**credentials)
- File "/usr/local/lib/python2.7/dist-packages/django/contrib/auth/__init__.py", line 74, in authenticate
- user = backend.authenticate(**credentials)
- File "/usr/local/lib/python2.7/dist-packages/django/contrib/auth/backends.py", line 17, in authenticate
- user = UserModel._default_manager.get_by_natural_key(username)
- AttributeError: 'Manager' object has no attribute 'get_by_natural_key'
- INSTALLED_APPS = [
- 'django.contrib.admin',
- 'django.contrib.auth',
- 'django.contrib.contenttypes',
- 'django.contrib.sessions',
- 'django.contrib.messages',
- 'django.contrib.staticfiles',
- 'testing',
- 'rest_framework',
- 'rest_framework_jwt',
- ]
- REST_FRAMEWORK = {
- 'DEFAULT_PERMISSION_CLASSES': (
- 'rest_framework.permissions.IsAuthenticated',
- ),
- 'DEFAULT_AUTHENTICATION_CLASSES': (
- 'rest_framework.authentication.SessionAuthentication',
- 'rest_framework.authentication.BasicAuthentication',
- 'rest_framework_jwt.authentication.JSONWebTokenAuthentication',
- ),
- }
- AUTH_USER_MODEL = 'testing.Users'
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement