fix logout and signup

sync_v2
Raz 8 months ago
parent 800a76ecfd
commit 34c28ac7a7
  1. 2
      tournaments/forms.py
  2. 2
      tournaments/templates/profile.html
  3. 2
      tournaments/urls.py
  4. 5
      tournaments/views.py

@ -11,6 +11,7 @@ from django.contrib.sites.shortcuts import get_current_site
from django.utils.encoding import force_bytes
class CustomUserCreationForm(UserCreationForm):
usable_password = None
class Meta:
model = CustomUser
@ -30,6 +31,7 @@ class CustomUserCreationForm(UserCreationForm):
fields = UserCreationForm.Meta.fields + ('umpire_code', 'clubs', 'phone', 'first_name', 'last_name', 'licence_id', 'country')
class SimpleCustomUserCreationForm(UserCreationForm):
usable_password = None
class Meta:
model = CustomUser

@ -11,7 +11,7 @@
{% if user.is_authenticated %}
<a href="{% url 'my-tournaments' %}" class="orange">Mes tournois</a>
<a href="{% url 'profile' %}">Mon compte</a>
<a href="{% url 'logout' %}" class="red">Se déconnecter</a>
<a href="{% url 'custom_logout' %}" class="red">Se déconnecter</a>
{% else %}
<a href="{% url 'login' %}">Se connecter</a>
{% endif %}

@ -62,7 +62,7 @@ urlpatterns = [
),
name='password_change'
),
path('logout/', auth_views.LogoutView.as_view(), name='logout'),
path('logout/', views.custom_logout, name='custom_logout'),
path('signup/', views.signup, name='signup'), # URL pattern for signup
# path('profile/', views.profile, name='profile'), # URL pattern for signup
path('my-tournaments/', views.my_tournaments, name='my-tournaments'), # URL pattern for signup

@ -1049,6 +1049,11 @@ def tournament_prog(request, tournament_id):
}
return render(request, 'tournaments/prog.html', context)
def custom_logout(request):
from django.contrib.auth import logout
logout(request)
return redirect('index') # or whatever URL you want to redirect to
class UserListExportView(LoginRequiredMixin, View):
def get(self, request, *args, **kwargs):
users = CustomUser.objects.order_by('date_joined')

Loading…
Cancel
Save