Почистил коменты

This commit is contained in:
2026-02-22 12:37:22 +05:00
parent f042c1669e
commit 24712588f8
5 changed files with 6 additions and 6 deletions

View File

@@ -31,7 +31,7 @@ pip --version
```powershell ```powershell
python -m venv venv python -m venv venv
# Активация (нужно делать каждый раз при работе с проектом) # Активация
venv\Scripts\activate venv\Scripts\activate
``` ```
После активации в начале строки появится (venv) После активации в начале строки появится (venv)
@@ -39,7 +39,7 @@ venv\Scripts\activate
### 3. Установка зависимостей ### 3. Установка зависимостей
```powershell ```powershell
# Обнови pip (рекомендуется) # Обнови pip
python -m pip install --upgrade pip python -m pip install --upgrade pip
# или # или
.\venv\Scripts\python.exe -m pip install --upgrade pip .\venv\Scripts\python.exe -m pip install --upgrade pip
@@ -54,7 +54,7 @@ pip install pip install Django==5.2.11
# Применить миграции (создать/обновить таблицы в базе) # Применить миграции (создать/обновить таблицы в базе)
python manage.py migrate python manage.py migrate
# (Опционально) Создать суперпользователя для админки # Создать суперпользователя для админки
python manage.py createsuperuser python manage.py createsuperuser
# → введи username, email и пароль # → введи username, email и пароль

View File

@@ -7,7 +7,7 @@ class AutoForm(forms.ModelForm):
model = Auto model = Auto
fields = ['brand', 'model', 'year', 'color'] fields = ['brand', 'model', 'year', 'color']
# Настройка виджетов и стилей (опционально, но улучшает внешний вид) # Настройка виджетов и стилей
widgets = { widgets = {
'brand': forms.TextInput(attrs={ 'brand': forms.TextInput(attrs={
'class': 'form-control', 'class': 'form-control',
@@ -29,7 +29,7 @@ class AutoForm(forms.ModelForm):
}), }),
} }
# Дополнительная валидация (опционально) # Дополнительная валидация
def clean_year(self): def clean_year(self):
year = self.cleaned_data.get('year') year = self.cleaned_data.get('year')
if year and (year < 1900 or year > 2100): if year and (year < 1900 or year > 2100):

View File

@@ -9,7 +9,7 @@ class AutoCreateView(CreateView):
model = Auto model = Auto
form_class = AutoForm form_class = AutoForm
template_name = 'autoapp/add_auto.html' template_name = 'autoapp/add_auto.html'
success_url = reverse_lazy('auto_list') # или другая страница success_url = reverse_lazy('auto_list')
def form_valid(self, form): def form_valid(self, form):
response = super().form_valid(form) response = super().form_valid(form)