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

Django REST API Logout request

For logging in, I'm doing something like: function setHeader(xhr) { // as per HTTP authentication spec [2], credentials must be // encoded in base64. Lets use window.btoa [3] xhr.setRequestHeader("Authorization", "Basic " +…
0
votes
1 answer

Problems in django Custom User

Hi I have a rare problem with my custom user for Django. This is my CustomUser code. class CustomUser(AbstractBaseUser, PermissionsMixin): """ Custom User model. This class replace the default django user. """ nick_validator = [ …
0
votes
1 answer

Extending django auth.models.User with more attributes

Is my way of extending the auth.models.User of django correct? should I inherit from AbstractUser or User? Here is the way I am implementing it now: but should I consider having a OneToOneField connecting to the User table from UserProfile? from…
Saher Ahwal
  • 9,015
  • 32
  • 84
  • 152
0
votes
1 answer

Django: templates don't see custom user fields

I have a custom User model in Django 1.6: from django.contrib.auth import models as usermodels class User(usermodels.User): sid = models.CharField(max_length=20, unique=True) slug = models.SlugField(default="slug") objects =…
tao_oat
  • 1,011
  • 1
  • 15
  • 33
0
votes
1 answer

Django custom User and Super User Model

I have a Django project in which I need a custom user, I followed the steps of Django Documentation to achieve a custom User but Super User shares the same properties. I really dont need those for my admin users. Is there a way to have a specific…
torresomar
  • 2,219
  • 2
  • 16
  • 28
0
votes
2 answers

Using Django Users for all logged in users, and registering them

I have a site that - other than the signup process - will be only used by logged in users. It's my first Django site, and I'm wondering whether I can use the Django user model (slightly extended) to work with all my users, or should it only be used…
Rob Grant
  • 7,239
  • 4
  • 41
  • 61
0
votes
1 answer

Django: Using custom AUTH system, why is the User model always still needed?

I'm developing an SAAS and having the hardest time wrapping my brain around why I need to use "User" for anything other than myself. I don't know why but it makes me queezy to think that I, as the developer/admin of the entire software, with full…
orokusaki
  • 55,146
  • 59
  • 179
  • 257
0
votes
0 answers

Update django user model when it's linked to another model

.... from django.contrib.auth.models import User class Person(models.Model): user = models.OneToOneField(User) avatar = models.ImageField(upload_to="photos/") level = models.IntegerField(default=0) def __unicode__(self): …
smarber
  • 4,829
  • 7
  • 37
  • 78
0
votes
1 answer

django get the logged in user in the form to build queryset?

I have this model: class Searches(models.Model): user = models.ForeignKey(User) .....other fields Each user has certain saved searches. I want to display a form(a choiceSelect widget) to select one of the several searches and click go. I…
brain storm
  • 30,124
  • 69
  • 225
  • 393
0
votes
1 answer

how to attach multiple ModelAdmins to UserAdmin in Django?

I have a search model which has a ForeignKey relation to User class Searches(models.Model): user = models.ForeignKey(User) ...... I have a UserProfile model which has a OnetoOne Relationship to User class UserProfile(models.Model): user…
brain storm
  • 30,124
  • 69
  • 225
  • 393
0
votes
1 answer

Django upgrade from 1.1 to 1.5 auth app password encryption

I am working on a upgrade from django 1.1 to django 1.5 and have followed this guide: Upgrade Django from 1.1 to 1.5.1 apart from reading the manuals and release notes. One thing I didn't expect though is the backward incompability of the auth app…
T.S.
  • 192
  • 2
  • 13
0
votes
2 answers

How to add fields to Django User model and show it on registration form with django-registration?

I noticed that the User model that Django provides does not have a Date of Birth Field. I do not want to write my own custom User class just to include this attribute. I am wondering if it is possible in some way to "attach" date of birth to the…
eagertoLearn
  • 9,772
  • 23
  • 80
  • 122
0
votes
1 answer

why is the UserCreationForm has UserName field explicity defined in model class in Django?

I am looking at source code for UserCreationForm in django.contrib.auth.forms what I notice is that the following: class Meta: model = User fields = ("username",) why is there a need to explicitly mention this ("username",)…
eagertoLearn
  • 9,772
  • 23
  • 80
  • 122
0
votes
1 answer

Getting error in refering user object django

def itemconfirmation(request, pk): item = Food_item.objects.get(id=pk) userobj = request.user user = UserProfile.objects.get(user=userobj) if request.method == 'POST': count_form = CountForm(data=request.POST) if…
Tony Tom
  • 73
  • 12
0
votes
1 answer

Whenever a new user is created, I want to create a "starter kit" of records for that user that is the same for all users

I've read the docs for Django that indicate using Fixtures or SQL when the APP is created. But I want to add the same fixture every time a new user is added. I'm not seeing an easy way to do this. I think that signals.py might be a way to do it, but…