django-authentication

NoReverseMatch at / Reverse for 'password_change_done' with arguments '()' and keyword arguments '{}' not found. 0 pattern(s) tried: []

安稳与你 提交于 2020-01-05 08:34:06
问题 my views part: @login_required def password_change(request, template_name='register.html', password_change_form=PasswordChangeForm,): if post_change_redirect is None: post_change_redirect = reverse('student:login') else: post_change_redirect = reverse_url(post_change_redirect) if request.method == 'POST': form = password_change_form(user=request.user, data=request.POST) if form.is_valid(): form.save() update_session_auth_hash(request, form.user) return HttpResponseRedirect(post_change

Python - Django signup for custom user model with multiple types of users

心已入冬 提交于 2020-01-05 04:09:08
问题 I'm working on a project using Python(3.7) and Django(2.2) in which I have created multiple types of users with a custom user model by extending the AbstractBaseUser model. I have done with the login but I'm confused about how should I implement the signup page as there's multiple types of users and I need a different form for each type of user. Here's How I have implemented my models. From models.py : class UserManager(BaseUserManager): def _create_user(self, email, password, is_staff, is

custom django-user object has no attribute 'has_module_perms'

无人久伴 提交于 2020-01-03 06:49:09
问题 My custom user model for login via email: class MyUser(AbstractBaseUser): id = models.AutoField(primary_key=True) # AutoField? is_superuser = models.IntegerField(default=False) username = models.CharField(unique=True,max_length=30) first_name = models.CharField(max_length=30, default='') last_name = models.CharField(max_length=30, default='') email = models.EmailField(unique=True,max_length=75) is_staff = models.IntegerField(default=False) is_active = models.IntegerField(default=False) date

auth.views.Loginview shows “__init__() got an unexpected keyword argument 'request' ”

杀马特。学长 韩版系。学妹 提交于 2020-01-02 12:55:13
问题 I am trying to use djangos built-in LoginView , but it showed an error: __init__() got an unexpected keyword argument 'request' batchbook/user/urls.py from django.urls import path from django.contrib.auth.views import LoginView, LogoutView from django.shortcuts import reverse from .forms import LoginForm app_name = 'user' urlpatterns = [ path( 'login', LoginView.as_view( authentication_form=LoginForm, success_url='/', template_name='user/login.html'), name='login'), path( 'logout', LogoutView

auth.views.Loginview shows “__init__() got an unexpected keyword argument 'request' ”

筅森魡賤 提交于 2020-01-02 12:55:11
问题 I am trying to use djangos built-in LoginView , but it showed an error: __init__() got an unexpected keyword argument 'request' batchbook/user/urls.py from django.urls import path from django.contrib.auth.views import LoginView, LogoutView from django.shortcuts import reverse from .forms import LoginForm app_name = 'user' urlpatterns = [ path( 'login', LoginView.as_view( authentication_form=LoginForm, success_url='/', template_name='user/login.html'), name='login'), path( 'logout', LogoutView

Django registration email not sending

无人久伴 提交于 2020-01-01 10:28:07
问题 I've been trying to get the django-registration-redux account activation email to send to newly registered users. I've gotten all non-email related parts to work, such as loggin in/out and actually registering the user! When i register, it automatically logs my in as that user. But i never get the activation email. I've tried various different things to try get this to work, I've followed some tutorials on setting whole thing up but the emails still dont work. heres some of the code setup, im

How to manually authenticate after get django user?

我只是一个虾纸丫 提交于 2020-01-01 02:34:04
问题 Im writing a facebook-connect app that login user after authenticate session on facebook, question is how can i authenticate user on django after get user object? user = User.objects.get(email=email) user = authenticate(username=user.username, password=user.password) login(request, user) Is there another way to achieve this ? 回答1: You don't actually need to authenticate() first if you do this (but I didn't tell you!): user.backend = 'django.contrib.auth.backends.ModelBackend' login(request,

django 1.5 extend the default User model or substitute it

泪湿孤枕 提交于 2019-12-30 10:24:07
问题 Env: Django 1.5.1 + Django CMS 2.4.1 + Zinnia latest + my custom apps + custom Django CMS plugin Basically I can extend the default Django (1.5.X) User model like Django Ribbit Tutorial on NetTuts+ or Substitute a completely customized model like Django Dev doc or Django2Scoops example in the paragraph: "Dealing With the User Model" To test I decided for Subclass AbstractUser From Django2Scoops book:"Choose this option if you like Django’s User model fields the way they are, but need extra .

What's the difference between authenticate and login?

↘锁芯ラ 提交于 2019-12-30 06:07:13
问题 Documentation: https://docs.djangoproject.com/en/1.7/topics/auth/default/#django.contrib.auth.login When you’re manually logging a user in, you must call authenticate() before you call login(). authenticate() sets an attribute on the User noting which authentication backend successfully authenticated that user (see the backends documentation for details), and this information is needed later during the login process. An error will be raised if you try to login a user object retrieved from the

What's the difference between authenticate and login?

本小妞迷上赌 提交于 2019-12-30 06:07:06
问题 Documentation: https://docs.djangoproject.com/en/1.7/topics/auth/default/#django.contrib.auth.login When you’re manually logging a user in, you must call authenticate() before you call login(). authenticate() sets an attribute on the User noting which authentication backend successfully authenticated that user (see the backends documentation for details), and this information is needed later during the login process. An error will be raised if you try to login a user object retrieved from the