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
7
votes
3 answers

How add group for custom user in django?

I created custom model of user using this official docs customizing authentication in Django But how can add groups and premissions? My django is version 1.9
7
votes
2 answers

Django - Login User without model

I am trying to implement an SSO login, deriving all the authorization rights from saml response: class SAMLServiceProviderBackend(object): def authenticate(self, saml_authentication=None): if not saml_authentication: # Using another…
ProfHase85
  • 11,763
  • 7
  • 48
  • 66
7
votes
3 answers

Django Error - Reverse for 'password_reset_confirm' with arguments '()' and keyword arguments '

I am trying to create a reset password functionality in my application and added the following lines in my urls.py. urls.py url(r'^resetpassword/passwordsent/$', 'django.contrib.auth.views.password_reset_done', name='password_reset_done'), …
python
  • 4,403
  • 13
  • 56
  • 103
7
votes
2 answers

Django 1.7 multisite User model

I want to serve a Django application that serves multiple web sites by single database but different user sets. Think like a blog application, it will be used by several domains with different themes, but use same database by adding a site field to…
7
votes
1 answer

Django ver 1.7 AppRegistryNotReady: Models aren't loaded yet

I am trying to work through the authentication tutorials to make sure everything works as expected. I entered the following code. >>> from django.contrib.auth.models import User >>> user = User.objects.create_user('john', 'lennon@thebeatles.com',…
7
votes
2 answers

Adding user to group on creation in Django

I'm looking to add a User to a group only if a field of this User is specified as 'True' once the User is created. Every User that is created would have a 'UserProfile' associated with it. Would this be the correct way to implement such a…
austin15140
  • 103
  • 1
  • 7
7
votes
1 answer

Get current user in view

I'm using django authentication to login the user: def signin(request): if request.method == "POST": username = request.POST.get("username").lower() password = request.POST.get("password").lower() …
Aloke Desai
  • 1,029
  • 8
  • 17
  • 27
7
votes
1 answer

How to re-use Django Admin login form from custom LoginRequired middleware

Background & attempted code: I'm using Django 1.6.2 (on Python 3.3) and would like all views to effectively have the login_required decorator applied to them and re-use the actual admin login form. Note that the admin app will also be in use with…
Jon Clements
  • 138,671
  • 33
  • 247
  • 280
7
votes
1 answer

How to get date of registration?

How to get date of registration? What is the name of this field? I use django-registration. I don't see this in the documentation User.objects.filter(date_of_registration_field__lt = my_date)
amarkon
  • 91
  • 1
  • 5
7
votes
3 answers

How to reset user password from the admin interface

In my website, I want to let the admins reset the password of any user. With reset I mean exactly what the password_reset view does (under contrib.auth): Send a confirmation link to that user email. How would be the best way of doing that? Is there…
Oscar Mederos
  • 29,016
  • 22
  • 84
  • 124
7
votes
3 answers

User authentication in tests with Django factory_boy

When trying to unit test some part of my code, I need a user to be logged in. For reducing the number of fixtures I am using django_factory_boy User factory but the User generated is unable to authenticate. from django_factory_boy.auth import…
sebastibe
  • 586
  • 3
  • 13
6
votes
2 answers

OneToOne relation with the User model (django.contrib.auth) without cascading delete

I'm a bit confused about how the OneToOneField works when deletion comes into play. The only quasi-authoritative info I can find is from this thread on django-developers: I don't know if you discovered this yet, but the delete is working in one…
Jordan Reiter
  • 20,467
  • 11
  • 95
  • 161
6
votes
2 answers

Django to return a view with TokenAuthentication for WebView

I am trying to create a flutter app which will use webview to display authenticated data from my Django App. Steps Involved: Flutter app sends authentication request Django validates the user credentials (user id & Password) and returns…
6
votes
1 answer

How to change the default permission name?

I want to change the default permission name created by django after migrating django model. The docs says Providing default_permissions = [] in the class Meta works but It must be specified on the model before the model is created by migrate in…
D_P
  • 802
  • 10
  • 32
6
votes
2 answers

How to call the authenticate() method of Custom written AuthenticationBackend of django in views.py?

I am working on a Django project in which I have defined a custom user model for which I have required to write the custom authentication method, by following the documentation I have written it like following But I have a problem in calling it in…
RIO
  • 148
  • 1
  • 8