Django built in Logout view `Method Not Allowed (GET): /users/logout/`

Advertisements Method Not Allowed (GET): /users/logout/ Method Not Allowed: /users/logout/ [10/Dec/2023 12:46:21] "GET /users/logout/ HTTP/1.1" 405 0 This is happening when I went to url http://127.0.0.1:8000/users/logout/ urls.py: from django.contrib.auth import views as auth_views urlpatterns = [ …other urls… path(‘users/logout/’, auth_views.LogoutView.as_view(), name=’logout’), ] I am expecting user to logout >Solution : Since django-5, you need to… Read More Django built in Logout view `Method Not Allowed (GET): /users/logout/`

Django auth groups not finding groups and does not give permission to users, regardless of the group in which they are

Advertisements I’m making a simple real estate app where the users must be separated into two different groups. A regular user and a broker. I’m using the Django admin backend for creating user groups. I’m also using a post_save signal to assign all the new users to the regular users’ group. At first glance, it… Read More Django auth groups not finding groups and does not give permission to users, regardless of the group in which they are

Set is_staff to true for new users that created new accounts from CreateView

Advertisements I am having problem with Django. I am using UserCreationForm and generic CreateView in order for people to sign up and create an account. The code is as follows: Custom form: class SignUpCustomUserForm(UserCreationForm): first_name = forms.CharField(max_length=200) last_name = forms.CharField(max_length=200) email = forms.EmailField(max_length=200) class Meta: model = User fields = [‘first_name’, ‘last_name’, ‘username’, ’email’, ‘password1’,… Read More Set is_staff to true for new users that created new accounts from CreateView