Questions tagged [django-users]

User model is the default model in Django. It provides many APIs which are helpful for working with users. Django user model is overridable in a Project according to required field.

Django(a high-level Python Web framework) comes with a user authentication system. It handles user accounts, groups, permissions and cookie-based user sessions.

894 questions
6
votes
3 answers

How to Encrypt Password before saving it to User Model Django?

I've created a user-signup page which adds users to User Model in Django But when the data is saved, the Password is not encrypted, i.e. stored as Text only. This creates a problem when the user tries to log in (as Django tries to Decrypt the…
6
votes
1 answer

seperate 'admin' interfaces for different user types in django

I have recently being trying to create a project which has several levels of user involved. (Just an example of an abbreviated and rough schema) ME (Super User) Client(s) Customer(s) Survey…
6
votes
6 answers

Django: ImportError: cannot import name 'User'

I'm new to django and I'm facing some difficulties in creating a user from the AbstractBaseUser model. Now I'm starting wondering if my user model is not being build in the right way. This is my User model from django.db import models from…
WisdomPill
  • 720
  • 4
  • 11
  • 25
6
votes
2 answers

Django - Removing username from user model

In order to create a new user model in Django 1.5.x, there are two approaches: Inherit AbstractUser class which is the default user model you get, this way you can extend it with any attributes you want. However, if you want to remove any field,…
Aziz Alfoudari
  • 5,193
  • 7
  • 37
  • 53
6
votes
2 answers

Error: "relation "django_comments" does not exist"

I'm trying to delete users from the admin and get this error: DatabaseError at /admin/users/neverlateuser/ relation "django_comments" does not exist LINE 1: ..._admin", "users_neverlateuser"."date_joined" FROM "django_co... but I don't have…
misschoksondik
  • 561
  • 2
  • 6
  • 19
6
votes
1 answer

How can I import the user model in Django and select all of the objects

When I use from django.conf import settings in my DjangoRestFramework views, class UserList(ListCreateAPIView): queryset = settings.AUTH_USER_MODEL.objects.all() serializer_class = UserSerializer my I receive the error AttributeError at…
user1876508
  • 12,864
  • 21
  • 68
  • 105
6
votes
1 answer

Django : Invalid password format or unknown hashing algorithm

I have problem when I want to use simple CreateView for creating new user. Everything is ok, I can create user, but when I want logging with new created user, I cant do it. I got this type of my password in admin: Invalid password format or unknown…
prog.Dusan
  • 1,324
  • 2
  • 12
  • 25
6
votes
1 answer

Automatically create username in User model in Django based on other fields

I have been searching for best practice, but I did not found it. I was even unable to find solution I need used by anyone else. I need to generate username of the user based on his other data (first name & last name), optionally appending integer at…
Tadeck
  • 132,510
  • 28
  • 152
  • 198
5
votes
1 answer

How to add new fields in django user model

How to add new fields in the django user model. The django user model comes with the standard username email and password, however I want users to have more details linked with their account, like let's say phone number or something. What would be…
Styxin
  • 115
  • 1
  • 9
5
votes
1 answer

Using UserPassesTestMixin (class based view) AND redirect as well

I'm trying to instead use the Class based view, and all I end up with the default 403 Forbidden page.. Is the order of the mixin classes correct? Does the code even get used -as in get/post or does everything get bypassed and the default 403…
5
votes
1 answer

how to set default group for new user in django?

how can I set default group for new users that I create? I didn't create custom model of user and My django version is 1.11.
5
votes
1 answer

Django / duplicate key value violates unique constraint

I try to extend django auth user model with OneToOneField but couldn't solve this problem. duplicate key value violates unique constraint "users_profile_user_id_key" DETAIL: Key (user_id)=(67) already exists. I look through this issue , some…
Kaan San
  • 123
  • 2
  • 13
5
votes
3 answers

How can I implement custom user manager in django?

I create custom User model inheriting from AbstractUser in Django: class ChachaUser(AbstractUser): birth = models.DateField() gender = models.CharField(max_length=1, choices=GENDER_CHOICES) and my CustomUserCreationForm : GENDER_CHOICES =…
user3595632
  • 5,380
  • 10
  • 55
  • 111
5
votes
1 answer

django 1.9 not creating table for custom user model

My project name is timecapture Here is relevant portion of timecapture/settings.py INSTALLED_APPS = [ # 'django.contrib.admin', 'django.contrib.auth', 'django.contrib.contenttypes', 'django.contrib.sessions', …
t0il3ts0ap
  • 530
  • 4
  • 18
5
votes
2 answers

Django user.is_authenticated works some places, not others

In my template, I have the following: