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
3
votes
2 answers

Django: when creating custom user, ValueError: Dependency on unknown app

I'm building a brand-new web project with Python 3.4.3 and Django 1.8 without any migrations made so far. For the project, I'm creating a custom user inheriting from AbstractBaseUser in an app called users. I've also correctly referred…
3
votes
2 answers

How to get the current user in custom save method?

I am using Django 1.8 and I am trying to implement a simple logging to a model. I have overridden the save method of the class. However, I also want to log which user is responsible for the change but the request object is not available since it's…
Utku Turunç
  • 334
  • 1
  • 7
3
votes
2 answers

extending django usermodel

i am trying to create a signup form for my django app. for this i have extended the user model. This is my Forms.py from contact.models import register from django import forms from django.contrib import auth class registerForm(forms.ModelForm): …
MajorGeek
  • 495
  • 1
  • 13
  • 31
3
votes
0 answers

django auth_group geting selected when auth_user is selected

I have created a custom User model class User(AbstractUser): phone_no = models.CharField(blank=True, null=True, max_length=20, default="") class Meta: db_table = 'auth_user' When I am accessing an object of User, auth_group and…
Sar009
  • 2,166
  • 5
  • 29
  • 48
3
votes
2 answers

Django - Ability to assign permissions and groups for custom user model in admin console

I just created a custom user model in django called Subscriber which inherits from AbstractBaseUser and PermissionsMixin. I then subclassed the necessary form classes in my admin.py file in order to register my custom user model with the admin…
BDUB
  • 387
  • 6
  • 18
3
votes
1 answer

How do I define multiple user types in Django using the existing User model?

Django has an awesome user model coupled with authentication. Using that, I want to define multiple user types, say a student and a professor. I want to do this using minimal change to the existing model. One of the ways would be the User Groups.…
Ranveer
  • 6,683
  • 8
  • 45
  • 92
3
votes
1 answer

AUTH_USER_MODEL does not accept sub application

I am having problems with my custom user model while using Django 1.7.1 and Python 3.4. I have declared a Custom user model in an apps.users.AuthUser. I then have another application (apps.pets) that will use the AuthUser as a ForeignKey in a Pet…
Frankline
  • 40,277
  • 8
  • 44
  • 75
3
votes
1 answer

django access logged in user in custom manager

I want to access the currently logged in user in a custom manager I have wrote. I want to do this so that I can filter down results to only show objects they have access to. Is there anyway of doing this without actually passing it in? Something…
John
  • 21,047
  • 43
  • 114
  • 155
3
votes
0 answers

How to write tests that account for custom User model in Django?

TL;DR: I don't wanna use @skipIfCustomUser What can I do? Django allows a custom user model to be defined in settings.py, and says we should use get_user_model() to reference the current (swapped) User model, in the docs. Forthermore, the docs…
frnhr
  • 12,354
  • 9
  • 63
  • 90
3
votes
2 answers

django 1.6 authentication in Custom User model

I define a custom User model: from django.contrib.auth.models import AbstractUser class CustomUser(AbstractUser): somefield = models.CharField(max_length=60) and I add AUTH_USER_MODEL to settengs : AUTH_USER_MODEL = 'userm.CustomUser' but when…
nim4n
  • 1,813
  • 3
  • 21
  • 36
3
votes
1 answer

Choosing the right user inheritance method for django 1.5

I have a situation where I need to subclass a custom user model for a django 1.5 project (related question/background here: Subclassing AbstractUser in Django for two types of users ) I need an abstract user class SchoolPerson and a number of…
askvictor
  • 3,621
  • 4
  • 32
  • 45
3
votes
2 answers

django 1.5 extend the default User model or substitute it

Env: Django 1.5.1 + Django CMS 2.4.1 + Zinnia latest + my custom apps + custom Django CMS plugin Basically I can extend the default Django (1.5.X) User model like Django Ribbit Tutorial on NetTuts+ or Substitute a completely customized model like…
3
votes
1 answer

How to setup django with unique settings.py per SITE_ID

I have been researching the various (and there are many) ways to have multiple sites under a single Django framework. I still don't see a solution that fits well for my use case. The use case being: A single database, as the majority of data (95%+)…
user658587
3
votes
2 answers

Django: error with "username" in my custom user model - 'UserProfile' object has no attribute 'username'

I'm new with Django and I'm having some problems creating a custom user model. I followed every steps from the django documentation. Here is my model : class UserProfile(models.Model): user = models.OneToOneField(User) comment =…
Marcolac
  • 901
  • 4
  • 14
  • 27
3
votes
1 answer

Django - Could i18n.set_language() store in User profile

I would like i18n.set_language() to store the language into an eventually available user profile when a language is selected by a user. Django should also use this to discover my language. Is it a good idea ? If yes how could I do it ?
Pierre de LESPINAY
  • 44,700
  • 57
  • 210
  • 307