Skip to content

Commit c29cc31

Browse files
committed
fix placeholders
1 parent f4c3e71 commit c29cc31

File tree

4 files changed

+23
-7
lines changed

4 files changed

+23
-7
lines changed

Makefile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ collectstatic:
1414
uv run python3 manage.py collectstatic --no-input
1515

1616
start-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

1919
lint:
2020
ruff check .

task_manager/users/forms.py

Lines changed: 18 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
from django.contrib.auth.forms import UserCreationForm, UserChangeForm
22
from 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

task_manager/users/views.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@
88
from django.contrib.auth.mixins import LoginRequiredMixin, UserPassesTestMixin
99

1010

11+
1112
def register_view(request):
1213
if request.method == 'POST':
1314
form = UserCreationForm(request.POST)

task_manager/views.py

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
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
# # Вход
9292
class 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):

0 commit comments

Comments
 (0)