Questions tagged [django-auth-models]
39 questions
4
votes
1 answer
How to have multiple AUTH_USER_MODEL in django
I have two different app that has separate models that inherits from AbstractionBaseUser like below
# in doctor/models.py
...
class Patient(AbstractBaseUser):
email = models.EmailField(blank=True, unique=True)
phone_number =…

Alleh parast
- 63
- 1
- 6
3
votes
2 answers
In Django's auth contrib module, how do I validate a token submitted from a reset password form?
I'm using Django 3.1 with its auth contrib module. I have an API-only application, in which I initiate a password reset using the following Django view
class ResetPasswordView(SuccessMessageMixin, PasswordResetView):
…

Dave
- 15,639
- 133
- 442
- 830
3
votes
3 answers
How to use AUTH_USER_MODEL if I just want to use the standard user model
I have seen several posts and read the documentation about how it's best practice to set AUTH_USER_MODEL in settings.py, but do not see any actual examples on how to do that. I have tried several configurations but keep getting this…

Tom
- 364
- 2
- 19
3
votes
2 answers
Django password field custom class
I would like to render the password field with a custom class, so I tried this:
from django.contrib.auth import get_user_model
from django.db import transaction
User = get_user_model()
class SignupForm(forms.ModelForm):
first_name =…

4m1nh4j1
- 4,289
- 16
- 62
- 104
2
votes
3 answers
Django user model override
I'm not advanced in Django and would like to know how and if it's possible to do it.
I need to override Django's user model, and change the fields "username" to "sr_usuario" and "password" to "sr_password", but I would like to continue using all…

Rafael Noronha
- 21
- 2
2
votes
2 answers
Custom User Model Django Error , No such table
Models.py
class UserManager(BaseUserManager):
def create_user(self, email, password=None):
if not email:
raise ValueError('Users must have an email address')
user = self.model(
…

Harish Kumar
- 51
- 2
2
votes
1 answer
Logout function in Django not working as Expected
I have not used any middleware, when i click on logout button on my Home Page template, the logout function execute without any error.but when i go back to main page without jumping to login page.. i see myself as logged in user
here is my…
user12818329
2
votes
1 answer
Django Auth : How are many-to-many relationship models created?
django.contrib.auth.models have only 3 models, User, Group, Permission, as per the doc and code.
Doc does say groups and permissions are many-to-many relationships.
But when we migrate how come other relations user_group, user_permissions,…

Kishor Pawar
- 3,386
- 3
- 28
- 61
2
votes
1 answer
How to extend Django auth model User with UserProfile, avoiding RelatedObjectDoesNotExist error?
I am trying to create UserProfile modal by extending default django User. Additional value cannot be saved because User has no user profile:RelatedObjectDoesNotExist:
user = User.objects.create_user(username=username, password=password)
…
user3475724
1
vote
1 answer
How to check for three fields in authenticate function of django?
I want to check three fields before logging in. Username and password are default in authenticate function but I want to check whether user is live member or not. I have created field is_live in auth_user model. But when I put this third argument in…

AMAN CHAVAN
- 15
- 2
1
vote
1 answer
When using custom AuthBackend, unable to use request.user.is_authenticated or @login_required decorator
Firstly I'm coming from a PHP background and new to Django. And I'm trying to upgrade a webapp from a PHP framework to Django, keeping the database unchanged.
The built-in authentication in Django is bit confusing, as my User table is different to…

crishym
- 23
- 5
1
vote
1 answer
django.db.utils.OperationalError: sequence must have same owner as table it is linked to
I am trying to update the USER auth model in Django in the middle of a project. I am also trying to learn a bit more, so I chose to do the "hard way" and switch out the standard auth model with a modified AbstractUserModel than doing the 'profile'…

chris Frisina
- 19,086
- 22
- 87
- 167
1
vote
1 answer
How to have multiple Auth models in django
I have an application where I've two models both models have same fields
client
buyer
I'm using separate models because client can also signs up as a buyer using the same email and vice versa. I don't want to use single model for both client and…

ikrma ahmad
- 61
- 6
1
vote
1 answer
Cannot login to Django admin with custom superuser
I am developing a custom Author user model for my blog site. The authors in this user model connect to my post application, another application of mine, with a foreign key and create the author-post relationship. However, I can't even log in to the…

Yusuf Doğan
- 35
- 6
1
vote
0 answers
problems logging in with Django custom backend
I have been trying to get my Django custom backend to work and it refuses to accept my credentials, which are correct in the database (I have verified this). It just keeps saying email and password are incorrect.
I am lost and don't know where to go…

guitardave77
- 23
- 5