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

Manually validate a django session id is currently authenticated

I need to have a function tell me if a Django session-id is currently authenticated or not. I understand this is already built into Django and I have that working just fine. But I have an external app that gets passed a session id, and when it…
adam
  • 3,498
  • 6
  • 34
  • 46
4
votes
1 answer

Extending the Django 1.11 User Model

I am attempting to work out how to extend the Django user model to add information to a user. I can't seem to get it to work. What am I doing wrong? Is it okay to have foreignkeys within the same model I am extending in to? How do you create a…
addohm
  • 2,248
  • 3
  • 14
  • 40
4
votes
1 answer

Why can't I import User model in django?

I am building a django web app with a custom user model which extends the AbstractBaseUser. In one of my models I need to use this custom user model: from accounts.models import User class History(models.Model): user = models.ForeignKey(User) …
Tom Finet
  • 2,056
  • 6
  • 30
  • 54
4
votes
3 answers

InconsistentMigrationHistory error with custom django user model

I am creating a custom user model. I ran the command python manage.py makemigrations accounts and then ran python manage.py migrate accounts which outputs the following error: Traceback (most recent call last): File "manage.py", line 22, in…
Tom Finet
  • 2,056
  • 6
  • 30
  • 54
4
votes
1 answer

How to implement Facebook AccountKit based login system with custom django User Model

Facebook introduced AccountKit that helps you quickly register for apps using just your phone number or email address — no password needed. It's reliable, easy to use and gives you a choice about how you sign up for apps. I have read the docs but…
4
votes
2 answers

Anonymous user error

I'm trying to save form data to an anonymous user, however I get the below error when trying to save some form data in a CreateView". I'm not clear what the issue is? ValueError: Cannot assign "
Yunti
  • 6,761
  • 12
  • 61
  • 106
4
votes
1 answer

Django rest serializer Breaks when data exists

I have this model: class MyModel(User): #others fields and this serializer: class MySerializer(serializers.ModelSerializer): class Meta: model = MyModel fields = ('username', 'password', 'some_field') I get data from ajax…
Andres
  • 4,323
  • 7
  • 39
  • 53
4
votes
2 answers

django - Accessible url pattern only for certain group of users

Is there a way to limit access to url pattern only for certain group of django users? for example, everything that starts with /settings/ shuld be accessible only for the administration group. or maybe it is possible to create a new decorator such…
user2216190
  • 784
  • 5
  • 10
  • 25
4
votes
1 answer

How does passing a lambda function for a property() work when extending Django's user model?

I have been looking at extending the Django user model, and while I am confident I can make it work, there is a line of code that I really want to understand. I have been referencing the following…
user1422456
4
votes
7 answers

Django UserProfile... without a password

I'd like to create a subset of Users that don't have a login... basically as a way to add a photographer field to photos without having a full blown account associated with that person (since in many cases, they'll never actually log in to the…
4
votes
1 answer

Subclassing AbstractUser in Django for two types of users

I'm developing a school database system in Django 1.5, and was planning on having a number of different user types (Student, Staff, Parent) which subclass AbstractUser (actually, another abstract subclass of AbstractUser). I was just attempting to…
askvictor
  • 3,621
  • 4
  • 32
  • 45
4
votes
2 answers

Migrating existing models to Django built-in User Models

I am running a Django 1.4.2 project. I have a database of class User(models.Model), and would now like to change this so that I used the built in model User from django.contrib.auth.models. Can I simply use my existing code and simply make my own…
Matt Stern
  • 717
  • 11
  • 23
4
votes
2 answers

Store unicode first_name & last_name in Django user record

Trying: new_user = User.objects.create_user(username, email, password) new_user.first_name = first_name new_user.last_name = last_name new_user.save() but if first or last name is foreign accented letters (unicode?) I get garbage in the user's…
user967722
  • 1,213
  • 1
  • 20
  • 26
3
votes
4 answers

Can't login to Django Admin with custom User Model

I create a custom model for User, By this I can create superuser from command line, and its create successfully. But when I trying to login to Django admin with created Super user its show me This error @property def is_staff(self): return…
3
votes
2 answers

Django admin - how to hide some fields in User edit?

How can I hide fields in admin User edit? Mainly I want to hide permissions and groups selecting in some exceptions, but exclude variable doesn't work :/
robos85
  • 2,484
  • 5
  • 32
  • 36