File tree Expand file tree Collapse file tree 4 files changed +23
-7
lines changed Expand file tree Collapse file tree 4 files changed +23
-7
lines changed Original file line number Diff line number Diff line change @@ -14,7 +14,7 @@ collectstatic:
1414 uv run python3 manage.py collectstatic --no-input
1515
1616start-server :
17- cd code && uv run manage.py runserver 0.0.0.0:3000
17+ uv run manage.py runserver 0.0.0.0:3000
1818
1919lint :
2020 ruff check .
Original file line number Diff line number Diff line change 11from django .contrib .auth .forms import UserCreationForm , UserChangeForm
22from django .contrib .auth .models import User
3-
4-
3+ from django import forms
4+ from django . contrib . auth . forms import AuthenticationForm
55
66
77
@@ -17,6 +17,20 @@ class Meta:
1717 model = User
1818 fields = ('username' , 'first_name' , 'last_name' , 'email' )
1919
20-
21-
20+ class LoginForm (forms .Form ):
21+ username = forms .CharField (
22+ max_length = 150 ,
23+ widget = forms .TextInput (attrs = {"placeholder" : "Имя пользователя" })
24+ )
25+ password = forms .CharField (
26+ widget = forms .PasswordInput (attrs = {"placeholder" : "Пароль" })
27+ )
28+
29+ class CustomAuthenticationForm (AuthenticationForm ):
30+ username = forms .CharField (
31+ widget = forms .TextInput (attrs = {"placeholder" : "Имя пользователя" })
32+ )
33+ password = forms .CharField (
34+ widget = forms .PasswordInput (attrs = {"placeholder" : "Пароль" })
35+ )
2236
Original file line number Diff line number Diff line change 88from django .contrib .auth .mixins import LoginRequiredMixin , UserPassesTestMixin
99
1010
11+
1112def register_view (request ):
1213 if request .method == 'POST' :
1314 form = UserCreationForm (request .POST )
Original file line number Diff line number Diff line change 88#from task_manager.models import Status, Task, Label
99#from task_manager.forms import StatusForm, TaskForm, LabelForm
1010#from task_manager.filters import TaskFilter
11- #
11+ from task_manager . users . forms import CustomAuthenticationForm
1212#
1313# def home_view(request):
1414# return render(request, 'index.html')
@@ -91,9 +91,10 @@ class UserListView(ListView):
9191# # Вход
9292class UserLoginView (LoginView ):
9393 template_name = 'users/login.html'
94+ authentication_form = CustomAuthenticationForm
9495
9596 def get_success_url (self ):
96- return reverse_lazy ('home' ) # замените на ваш URL главной страницы
97+ return reverse_lazy ('home' )
9798#
9899# # Выход
99100# class UserLogoutView(LogoutView):
You can’t perform that action at this time.
0 commit comments