Questions tagged [django-custom-user]

Tag for questions related to custom User model functionality introduced in Django 1.6

268 questions
1
vote
0 answers

Django signal creates UserProfile from listening to User, but it's empty?

I'm new to Django and trying to create a signal that listens to a custom User model I've built. My intention is that when a new User is created, that a profile for them will also be automatically created. To me it seems that my signal itself works,…
1
vote
2 answers

What's the difference between get_user_model() and importing CustomUser model directly?

This is my views.py in a API server running Django REST framework. from rest_framework import generics from users.models import CustomUser from .serializers import CustomUserSerializer class APIView(generics.ListAPIView): queryset =…
user3848207
  • 3,737
  • 17
  • 59
  • 104
1
vote
0 answers

Properly rename column name using display decorator in Django admin.py panel

I'm trying to rename the IS STAFF to STAFF STATUS here: I'm just wondering if it's possible to rename it from admin.py & NOT use the verbose_name inside the model. I wrote this code in admin.py: @admin.register(User) class…
Ali Abdi
  • 408
  • 7
  • 21
1
vote
2 answers

Query Django custom user model with many-to-many field

I'm very new at Django. I have a custom user model: accounts\models.py: from django.contrib.auth.models import AbstractUser from django.db import models from tradestats.models import Webhook class CustomUser(AbstractUser): webhook =…
1
vote
1 answer

How to create a serializer with multiple models, that are connected to each other?

So I have UserAccount model, which has this fields: class UserAccount(AbstractBaseUser, PermissionsMixin): email = models.EmailField(max_length=255, unique=True) iin = models.CharField(max_length=255, unique=True) first_name =…
1
vote
3 answers

Cannot login a normal user in a django website having a custom user model

I have made a Custom user model for my website. I have used AbstractBaseUser to make the model and also set it up at the settings. The creation of user and superuser is working fine without any problems and also a super user can login from the admin…
1
vote
1 answer

calling create_superuser and create_user function in abstractuser in DRF

I have customuser model which inherits the Abstratuser from Django. However, I didn't understand the create_user and create_superuser. For eg when is the create_user function is called and when the create_superuser function is called. The model…
1
vote
1 answer

Please enter the correct Email and password for a staff account. Note that both fields may be case-sensitive

I complete makemigrations and migrate then create a superuser. After this http://127.0.0.1:8000/admin i try to log in then show this error Please enter the correct Email and password for a staff account. Note that both fields may be…
1
vote
1 answer

Django Custom User Model migration return error : ValueError: Related model 'user_profile.customuser' cannot be resolved

I have modified the the user authentication to create a custom user. In my user_profile model I log in with email instead of username. I have extended AbstractUserModel for this purpose and have implemented manager and serializer as mentioned…
Dark Sorrow
  • 1,681
  • 14
  • 37
1
vote
1 answer

I am trying to create a login view that works for Customuser. Presently,the Loginform just redirects even when the fields are empty /incorrect input

I have allauth installed to handle the login yet, I don't seem to find a breakthrough with having a proper login as the redirect just takes everyone to the destination page without any authentication.. The signup works fine as I can see created…
Oprahjosh
  • 7
  • 1
1
vote
1 answer

How do I run Django test using a CustomUser(AbstractUser) class instead of default AbstractUser for correct ForeignKey assignment during test?

I have a CustomUser model in 'accounts' app that overrides Django's default auth.User: class CustomUser(AbstractUser): age = PositiveIntegerField(null=True, blank=True) user_type = CharField(max_length=8, null=False, choices=[('customer',…
1
vote
1 answer

Custom user model: Please enter the correct email and password for a staff account. Note that both fields may be case-sensitive

I always get the message "Please enter the correct email and password for a staff account. Note that both fields may be case-sensitive." I write in settings.py AUTH_USER_MODEL = 'eCommerce.User'. And after I run makemigrations and migrate command I…
1
vote
1 answer

CustomUser relation doesn't exist : Django migration error

I'm quite new to Django and ran into a problem while trying to create a custom user. I followed all the steps outlined to create one, but because I initially started out with the default User model I deleted all my migrations and my postgres db to…
1
vote
1 answer

Django Find custom user with the same value of JSONfield

I have a django application, where I use custom user model. Model has a JSONfield, which represents which programming languages do this user use. It looks like this: {"langs": [1, 2, 3, 4]} These numbers are ID's of Language DB model. So is it…
1
vote
1 answer

Django registration profile

I am new in django. I would like to create registration profile. I found some code but it doesn´t work for me. When I want to makemigrations I always get this error AttributeError: Manager isn't available; 'auth.User' has been swapped for…