diff --git a/core/__pycache__/models.cpython-311.pyc b/core/__pycache__/models.cpython-311.pyc index aa20da2..4d334bb 100644 Binary files a/core/__pycache__/models.cpython-311.pyc and b/core/__pycache__/models.cpython-311.pyc differ diff --git a/core/__pycache__/urls.cpython-311.pyc b/core/__pycache__/urls.cpython-311.pyc index 6803940..2928d32 100644 Binary files a/core/__pycache__/urls.cpython-311.pyc and b/core/__pycache__/urls.cpython-311.pyc differ diff --git a/core/__pycache__/views.cpython-311.pyc b/core/__pycache__/views.cpython-311.pyc index 84a3bab..3c50107 100644 Binary files a/core/__pycache__/views.cpython-311.pyc and b/core/__pycache__/views.cpython-311.pyc differ diff --git a/core/migrations/0007_maintenancepart.py b/core/migrations/0007_maintenancepart.py new file mode 100644 index 0000000..c156d2f --- /dev/null +++ b/core/migrations/0007_maintenancepart.py @@ -0,0 +1,28 @@ +# Generated by Django 5.2.7 on 2026-01-27 20:47 + +import django.db.models.deletion +from django.db import migrations, models + + +class Migration(migrations.Migration): + + dependencies = [ + ('core', '0006_fleetunit_contract_number_and_more'), + ] + + operations = [ + migrations.CreateModel( + name='MaintenancePart', + fields=[ + ('id', models.BigAutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')), + ('part_name', models.CharField(max_length=255, verbose_name='Наименование (фильтр, масло и т.д.)')), + ('article_number', models.CharField(blank=True, max_length=100, null=True, verbose_name='Артикул')), + ('quantity', models.CharField(max_length=50, verbose_name='Количество')), + ('maintenance', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, related_name='used_parts', to='core.maintenance', verbose_name='ТО')), + ], + options={ + 'verbose_name': 'Запчасть ТО', + 'verbose_name_plural': 'Запчасти ТО', + }, + ), + ] diff --git a/core/migrations/__pycache__/0007_maintenancepart.cpython-311.pyc b/core/migrations/__pycache__/0007_maintenancepart.cpython-311.pyc new file mode 100644 index 0000000..ca40dbb Binary files /dev/null and b/core/migrations/__pycache__/0007_maintenancepart.cpython-311.pyc differ diff --git a/core/models.py b/core/models.py index 832c3f0..a0f4ed5 100644 --- a/core/models.py +++ b/core/models.py @@ -216,4 +216,17 @@ class Document(models.Model): verbose_name_plural = "Документы" def __str__(self): - return f"{self.get_doc_type_display()} - {self.uploaded_at}" \ No newline at end of file + return f"{self.get_doc_type_display()} - {self.uploaded_at}" +class MaintenancePart(models.Model): + maintenance = models.ForeignKey(Maintenance, on_delete=models.CASCADE, related_name='used_parts', verbose_name='ТО') + part_name = models.CharField(max_length=255, verbose_name='Наименование (фильтр, масло и т.д.)') + article_number = models.CharField(max_length=100, blank=True, null=True, verbose_name='Артикул') + quantity = models.CharField(max_length=50, verbose_name='Количество') + + class Meta: + verbose_name = 'Запчасть ТО' + verbose_name_plural = 'Запчасти ТО' + + def __str__(self): + return f'{self.part_name} ({self.quantity})' + diff --git a/core/templates/base.html b/core/templates/base.html index 8f4dbf0..28bec5c 100644 --- a/core/templates/base.html +++ b/core/templates/base.html @@ -6,11 +6,6 @@