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

Django show options

I have a database filled with values for first_name. I also made a form, which calls for an input of first_name. How can i give the user suggestions as they type of names that are already in the database? Also, if i have someone entering 2 in one…
Abhishek Patel
  • 587
  • 2
  • 8
  • 25
0
votes
1 answer

Django User Class (django.contrib.auth) fname not working

In my website, I can't display the user.fname. Everything else in user, like user.username, user.email, and user.password work, but i cant display the name. PS: ive tried user.fname, user.name, user.name, user.first_name so far, none display…
Abhishek Patel
  • 587
  • 2
  • 8
  • 25
0
votes
1 answer

type object 'User' has no attribute 'is_staff' in Django Application

if you see the link, they have given that User object has an attribute is_staff. I am trying to see what is the default value of is_staff when we create a new user in unit testing. The code is fairly very simple: def test_login_user(self): …
python
  • 4,403
  • 13
  • 56
  • 103
0
votes
1 answer

Worried about the use of built in django auth system set to emails, knock on effects

I set django default user authentication to use an email address instead of a user name. My worry is about the possible future effects. If the user changes his email will the primary keys need to be changed as I assume the primary key for a user is…
red8alice
  • 199
  • 1
  • 12
0
votes
1 answer

Django unique_together across models

So, I have these two models: class User(AbstractBaseUser): """ Custom user class """ email = models.EmailField(verbose_name = 'email address', unique = True, db_index = True) joined = models.DateTimeField(auto_now_add = True) is_active =…
EarlyCoder
  • 1,213
  • 2
  • 18
  • 42
0
votes
1 answer

Does not work get_context_data in Django

I use custom user model with two entities: class WeddyUser(AbstractBaseUser): username = models.CharField( 'Юзернейм', max_length=50, unique=True, db_index=True ) email = models.EmailField( 'Электронная почта', …
user4251615
0
votes
2 answers

Django UserCreationForm modification: password not setting

With this setup, the password isn't stored when someone submits the form on the register page. However, the username and email are stored. Everything displays accurately, with 'password1' and 'password2' linking to a "Password" and "Password…
Marcus Dash
  • 55
  • 1
  • 5
0
votes
1 answer

Import Class AUTH_USER_MODEL of custom User model into 3 party app

I need to import a custom User model into a third party app, problem is this app import django's default User model, so: from django.contrib.auth.models import User I have a custom User, I could do this: from myapp.models import User but I want a…
aslheyrr
  • 372
  • 1
  • 4
  • 15
0
votes
1 answer

is there a difference between request.user and actual User object?

I have defined my UserDetail model, which has one to one relation with User. class UserDetail(models.Model): user = models.OneToOneField(User) .... but when I am trying to access UserDetail object through request.user in my view it is…
vivek
  • 5
  • 1
0
votes
1 answer

django- adding new user from the frontend

I have been learning django for like 1 month now and i felt the best way is to do a project. i settled on a simple school management project but I am kind of stacked. This project has different categories of users i.e students and administrator. the…
0
votes
1 answer

Create user without calling manager create_user method in Django

From what I have read, the create_user (and create_superuser) method receives required parameters only. I;m trying to create an user whit required and non-required parameters, by adding another argument to the create_user function I've got errors. I…
0
votes
0 answers

django: how to get logged in user credantials from terminal and store it in xml

I have an django project that i have created using django-rest framework and i also have an xml file which contains tags for both username and password. Now i want to store logged-in users username and password in that xml either automatically or…
0
votes
0 answers

Django different user types to extend default user type

I'm new for Django. In my project I need to have two different user type: User_type_1: with some custom fields; User_type_2: with some custom fields (different from User_type_1); User_type_1 and User_type_2 have some common fields (username,…
Safari
  • 11,437
  • 24
  • 91
  • 191
0
votes
2 answers

How to save user in Django?

I can't find the answer to this problem which I guessed was very easy for Django. I simply want to define an author field in a model, like this: class Article(models.Model): author = models.ForeignKey(User) It seems there is no easy way like…
jeff
  • 13,055
  • 29
  • 78
  • 136
0
votes
2 answers

Django -- Requiring a certain access level for pages

In my Django project, I want to restrict a page depending on if they have an access level of 100, 200, etc. I tried making a wrapper for this like login_required, however I'm not sure how to access the user model. Any advice? Example: def…
Magic
  • 362
  • 1
  • 4
  • 13