Questions tagged [django-authentication]

django-authentication refers to the built-in auth module for authentication & authorization that can be extended.

django-authentication refers to the built-in auth module for authentication & authorization that can be extended. It handles user accounts, groups, permissions and cookie-based user sessions.

See documentation.

1888 questions
14
votes
4 answers

Create user notification system in Django

I am adding a system to leave "notifications" for users that can be displayed the next time they log in. I created a simple Notification class in the models.py file. I have this UserInfo class (in the same models.py) to add on some attributes to…
gohnjanotis
  • 6,513
  • 6
  • 37
  • 57
14
votes
4 answers

How do I access auth User's User.objects.create_user(...) in a south migration?

Instead of using django's auth module I've used my own and already regret it a lot. In an effort to rectify the situation, I'm trying to migrate the data from my User model to django.auth.models.User. I've created a data migration as follows: def…
Gezim
  • 7,112
  • 10
  • 62
  • 98
14
votes
2 answers

Django Nested Groups: Groups in Groups

In Django (when using django.contrib.auth) may I add a Group to another Group? Ie a a Group be a member of another Group? If so how do I do this? I add Users to a Group using the user_set, but from what I gather the default Group model does not have…
Alex Rothberg
  • 10,243
  • 13
  • 60
  • 120
14
votes
2 answers

how to create a group permission in django

I am attempting to create a row in the auth_group_permission table. I have tried the following: group_permission = group_permissions.add(group=group, permission=permission) group_permission =…
Atma
  • 29,141
  • 56
  • 198
  • 299
13
votes
9 answers

Django: Remove "view on site" button in the admin User change form

get_absolute_url() method is cool, but in some cases is not needed. django.contrib.auth.models.User has it set by default, this cause my projects to have a broken link in the admin. How can I prevent that from happening? In one of my old projects I…
nemesisdesign
  • 8,159
  • 12
  • 58
  • 97
13
votes
3 answers

How to limit number of concurrent users logging in to same account in Django

My site is a digital marketplace website written in Django. Digital content(text, images, videos) on the site is 'locked' by default. Only users who bought those content can view it. There's a story that certain user(who bought the content) give…
13
votes
2 answers

custom password validation in django 1.7

I am trying to add custom password validation to the create user and change password admin forms. I did not see anything in the django docs about how to do this. I found this post on SO: Enforcing password strength requirements with…
Larry Martell
  • 3,526
  • 6
  • 40
  • 76
13
votes
3 answers

Inform user that email is invalid using Django's Password Reset

I am using the built-in django password reset functionality. The documentation states: If the email address provided does not exist in the system, this view won’t send an email, but the user won’t receive any error message either. This prevents…
Vlad Schnakovszki
  • 8,434
  • 6
  • 80
  • 114
13
votes
1 answer

Is there a way to use the browsable API for Django Rest Framework with Authtoken

How can I use the Django Rest Framework browsable API for a particular user by authenticating via authtoken (instead of username/pwd)? The same way I would do for POSTMAN in Chrome Thanks
dowjones123
  • 3,695
  • 5
  • 40
  • 83
13
votes
9 answers

Django: reset-password not sending email

I am using the Django password reset. I have this code in my settings.py: EMAIL_USE_TLS = True EMAIL_HOST = 'smtp.gmail.com' EMAIL_PORT = 587 EMAIL_HOST_USER = 'myusername@gmail.com' EMAIL_HOST_PASSWORD = 'mypassword' DEFAULT_FROM_EMAIL =…
user1670032
  • 750
  • 3
  • 12
  • 27
12
votes
3 answers

Django password reset. Not sending mail

I'm trying to get the django password reset working but the reset email does not get sent. I know my email is properly configured because the following works both in the shell and in one of my views (I'm using it to get support email to…
Darkade
  • 897
  • 1
  • 9
  • 26
12
votes
1 answer

Django : Syncdb incorrectly warns that many-to-many field is stale

I have a django application where one application has many-to-many relationship with a UserProfile. But whenever I do a syncdb, it warns me that app_users is stale field The following content types are stale and need to be deleted: Apps |…
Neo
  • 13,179
  • 18
  • 55
  • 80
12
votes
2 answers

How to programmably create an User in Django?

I have 3 apps in one project. App1 : use from enduser(web view based app) App2 : use from service provider(web service) App3 : use from system administrator. I want to use django authentication system for each apps. I can make django project to…
Kazzz Studio
  • 449
  • 1
  • 6
  • 19
12
votes
3 answers

'AnonymousUser' object is not iterable

if not request.user.is_authenticated: return None try: return ClientProfile.objects.get(user=request.user) except ClientProfile.DoesNotExist: return None This code should return None, if I'm not logged in and trying to call it. But as…
artem
  • 16,382
  • 34
  • 113
  • 189
12
votes
3 answers

Login to webpage from script using Requests and Django

I have written a web application in Django. I need to post some data to a form from a python script. The post (r2) works correctly when login is disabled. I have the request working correctly for the login (r1), but it gives me a 404 error now for…
Jason Hawkins
  • 625
  • 1
  • 9
  • 24