django-users

How to customize the auth.User Admin page in Django CRUD ?

Hello, I just want to add the subscription date in the User list in the Django CRUD Administration site. How can I do that ? Thank you for your help ...

django access logged in user in custom manager

Hi, 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 similar to how it works in views where you can do request.user. Thanks ...

Django: Completely custom auth question. Please help.

I'm creating a multiple-tenant application that won't use any of the standard Django Admin (except for internal use which will have access to all tenants... that's simple enough). I'm trying to create an authorization system of my own and I'm not interested in using the standard User model (or any built-in application's model). My applic...

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 Django Admin access (like the Eye of Sauron), have the same type of User object as an "Accou...

How do I prevent permission escalation in Django admin when granting "user change" permission?

I have a django site with a large customer base. I would like to give our customer service department the ability to alter normal user accounts, doing things like changing passwords, email addresses, etc. However, if I grant someone the built-in auth | user | Can change user permission, they gain the ability to set the is_superuser flag ...

InlineFormSet - Get a User ModelForm when the relationship is in the User.Profile model

My end result is to provide a User Permissions Matrix. (django.contrib.auth.models.Permission) Working with three models in this scenario: Office, User, and UserProfile. Users are related to an Office model through the UserProfile model. See below for my model setup: class User(models.Model): # the included django User model class Use...

Extending User object in Django: User model inheritance or use UserProfile?

To extend the User object with custom fields, the Django docs recommend using UserProfiles. However, according to this answer to a question about this from a year or so back: extending django.contrib.auth.models.User also works better now -- ever since the refactoring of Django's inheritance code in the models API. And articles suc...

Cannot assign - must be a "UserProfile" instance

I have a class UserProfile defined which takes the default user as a foreign key. Now another class A has a foreign key to UserProfile. So for saving any instance in class A, how do i give it the userprofile object. Also, does making a class UserProfile mean that class user is still used and class UserProfile is just some other table?...

Django User model, adding function

Hello, I want to add a new function to the default User model of Django for retrieveing a related list of Model type. Such Foo model: class Foo(models.Model): owner = models.ForeignKey(User, related_name="owner") likes = models.ForeignKey(User, related_name="likes") ........ #at some view user = request.user foos...

extending django usermodel

Hi 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): class Meta: model=register fields = ('latitude', 'longitude', 'status') class Met...

How to make django messages StackOverflow style?

I'd like to use Django's Messages module, however, I would like my messages to persist until the user clicks an X next to the message as opposed to having messages disappear as soon as the user reloads the page. I am stumped with two issues: How do I make the messages' context processor not delete the messages once they are accessed? Ho...

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 fields only) and for RealUser subclass both FieldUser and User, but for FakeUser subclass on...

Django: When extending User, better to use OneToOneField(User) or ForeignKey(User, unique=True)?

I'm finding conflicting information on whether to use OneToOneField(User) or ForeignKey(User, unique=True) when creating a UserProfile model by extending the Django User model. Is it better to use this?: class UserProfile(models.Model): user = models.ForeignKey(User, unique=True) or this?: class UserProfile(models.Model): us...

Django user.is_authenticated works some places, not others

In my template, I have the following: <ul class="tabbed" id="network-tabs"> {% if user.is_authenticated %} <li><a href="{% url acct-my-profile %}">My Account</a></li> <li><a href="{% url acct-logout %}">Log Out</a></li> {% else %} <li><a href="{% url acct-login %}">Log ...

How do I inline edit a django user profile in the admin interface?

If you want to store extra information about a user (django.contrib.auth.models.User) in Django you can use the nifty AUTH_PROFILE_MODULE to plug in a "profile" model. Each user then gets a profile. It's all described here: http://docs.djangoproject.com/en/dev/topics/auth/#storing-additional-information-about-users http://www.djangoboo...

Modify Django user delete method?

If I go to the Django admin page and delete a user, I want it to run some code before/after it deletes the user. I know about overriding models' delete() methods, but I'm not sure how to apply it to a built-in model. Also, I'd like to be able to do it without 'subclassing' the User model and creating a (for instance) MyUser model. Is t...

Django - redirect to login page if UserProfile matching query does not exist error

I have extended the user model using the UserProfile method. However I occasionally get the Django error message UserProfile matching query does not exist when running the query request.user.get_profile() I think this is happening when I have become logged out of the system so my user becomes an AnonymousUser. Is there any way I can aut...

Adding custom action to UserModel's Admin page

Is there any possibility to create custom action in admin page for django UserModel? I want automatize adding user to group (like adding him to staff, set some extra values, etc.), and of course create actions that take these changes back. Thanks for your help. ...

Getting last created user to link user profile to in django

Hi, I've hit a bit of a wall when trying to add data to a UserProfile model created to hold user info beyond what is catered for in django's built in Auth component. My question is how do I get an instance of the user just registered in order to create the the UserProfile? I thought it would be something like below: # Registration for...