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
2
votes
1 answer

Work with two Users table

I wonder if is it possible to use the default django.contrib.auth.models.User to store admins users, users created with python manage.py createsuperuser, but use another table to store registered by form users, also users that will be registered…
Gocht
  • 9,924
  • 3
  • 42
  • 81
2
votes
1 answer

Custom admin form not showing extra fields

I have a custom user model: class User(AbstractUser): # First Name and Last Name do not cover name patterns # around the globe. name = models.CharField(_("Name of User"), blank=True, max_length=255) # Customer account …
bixente57
  • 1,328
  • 4
  • 14
  • 29
2
votes
1 answer

How does django knows what the password is in create_user() function

I am following django's doc on creating a custom user model and I am confused in defining the create_user() and create_superuser(). When defining create_user() the password arg passed is None def create_user(self, email, date_of_birth,…
Benjamin Smith Max
  • 2,668
  • 8
  • 33
  • 56
2
votes
3 answers

Get a related profile via request.user in django 1.8+

I have a Profile model: class Profile(models.Model): user = models.OneToOneField(settings.AUTH_USER_MODEL, related_name="profile_user") preferred_name = models.CharField() # more profile fields that I want to access in a template via…
43Tesseracts
  • 4,617
  • 8
  • 48
  • 94
2
votes
1 answer

Python/django inherit from 2 classes

In my django project I have 2 variations of users. One subclasses User class from django.auth and second uses almost the same fields but is not a real user (so it doesn't inherit from User). Is there a way to create a FieldUser class (that stores…
crivateos
  • 925
  • 3
  • 10
  • 19
2
votes
2 answers

Django: Filter users by user role

I am using the django admin site for my web app, but i am having a problem. I need that the staff users can change, create and delete another staff users, but i don't want that they change the informations of the superusers. I want to know if is…
eduCan
  • 180
  • 1
  • 9
2
votes
1 answer

django 'User' object has no attribute 'get' error

I am writing an simple django application and got stuck into this error, can some one please help me my views.py looks exactly as def custom_login(request): if request.user.is_authenticated(): return…
jay j
  • 285
  • 1
  • 6
  • 16
2
votes
1 answer

How do I get a basic working example for django-user-account?

I followed the installation instructions on django-user-accounts. When calling http://[mysite]/account/signup I could see:{# This template intentionally left blank to satisfy test suites. Your project should always provide a site_base.html itself.…
ralfr
  • 146
  • 1
  • 7
2
votes
1 answer

accessing in (passing to) django models signal methods like pre_save, pre_delete the request.user?

I have to track the history of all of changes, which occure to my models. I also keep track of user making this changes. For now I was dealing with in views.py but I would like to utilitize this functionallity using django signals like pre_save,…
andilabs
  • 22,159
  • 14
  • 114
  • 151
2
votes
2 answers

Check user account model type

What would be the best way to check model type of an account that has extended Django User model? I have two types of User accounts (students and teachers, let say) that extend django User model: class Student(models.Model): student_bd =…
Ljubisa Livac
  • 819
  • 3
  • 13
  • 38
2
votes
2 answers

Reasons to use 'through' parameter on an M2M relationship in Django

Concise question: What are the advantages and disadvantages of Modeling a many-to-many relationship in Django (1.5) on an external table without using the through parameter? Details: Say, I have a custom User model UserProfile and I want to define a…
Leonardo
  • 4,046
  • 5
  • 44
  • 85
2
votes
1 answer

Using a Django model that has a foreign key relation to the default User model

I am writing a Django program where Department/Position fields are associated with the User model. On the registration page, a person is required to enter first/last name, email, username, password, which are default User model fields, as well as…
2
votes
2 answers

NoReverseMatch: in the password reset form in Django-registration?

I get the following error when I access this URL http://127.0.0.1:8000/accounts/password/reset/ Request Method: GET Request URL: http://127.0.0.1:8000/accounts/password/reset/ Django Version: 1.6.2 Exception Type: NoReverseMatch Exception Value: …
eagertoLearn
  • 9,772
  • 23
  • 80
  • 122
2
votes
2 answers

why is the firstname and lastname field not saved in django-registration?

I have included field for firstname and lastname in django-registration form. but After registration my admin page is not showing the registered first name and last name, it is blank, but the username and email address are shown. Please read the…
eagertoLearn
  • 9,772
  • 23
  • 80
  • 122
2
votes
2 answers

Django AbstractUser not working properly

I am trying to inherit from AbstractUSer my models.py looks like: class MyUser(AbstractUser): created = models.DateTimeField(auto_now_add=True) USERNAME_FIELD = 'email' REQUIRED_FIELDS =…
saurabh
  • 293
  • 2
  • 7
  • 19