From 388753ba3148437e02bfa590f4757ed29e74f3ca Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=D0=9A=D0=BE=D1=88=D0=BA=D0=B8=D0=BD=20=D0=A1=D0=B5=D1=80?= =?UTF-8?q?=D0=B3=D0=B5=D0=B9?= Date: Tue, 25 Nov 2025 17:45:34 +0300 Subject: [PATCH] =?UTF-8?q?=D0=94=D0=BE=D0=B1=D0=B0=D0=B2=D0=B8=D0=BB=20?= =?UTF-8?q?=D1=82=D1=80=D0=B5=D0=BA=20=D0=B8=20=D0=BF=D0=BE=D0=BB=D0=B5=20?= =?UTF-8?q?=D0=9F=D1=80=D0=B8=D0=BC=D0=B5=D1=87=D0=B0=D0=BD=D0=B8=D0=B5=20?= =?UTF-8?q?=D0=BA=20Source?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- dbapp/mainapp/forms.py | 12 +- dbapp/mainapp/migrations/0014_source_note.py | 18 ++ dbapp/mainapp/models.py | 6 + .../templates/mainapp/source_form.html | 11 ++ .../templates/mainapp/source_list.html | 20 ++- .../mainapp/source_with_points_map.html | 157 ++++++++++++++++-- dbapp/mainapp/views/source.py | 1 + 7 files changed, 207 insertions(+), 18 deletions(-) create mode 100644 dbapp/mainapp/migrations/0014_source_note.py diff --git a/dbapp/mainapp/forms.py b/dbapp/mainapp/forms.py index 43015bf..1359b76 100644 --- a/dbapp/mainapp/forms.py +++ b/dbapp/mainapp/forms.py @@ -45,7 +45,7 @@ class LoadExcelData(forms.Form): required=False, initial=False, widget=forms.CheckboxInput(attrs={"class": "form-check-input"}), - help_text="Если отмечено, точки не будут добавляться к объектам (Source)", + help_text="Если отмечено, точки не будут добавляться к объектам", ) @@ -59,7 +59,7 @@ class LoadCsvData(forms.Form): required=False, initial=False, widget=forms.CheckboxInput(attrs={"class": "form-check-input"}), - help_text="Если отмечено, точки не будут добавляться к объектам (Source)", + help_text="Если отмечено, точки не будут добавляться к объектам", ) @@ -477,7 +477,7 @@ class SourceForm(forms.ModelForm): class Meta: model = Source - fields = ['info', 'ownership'] + fields = ['info', 'ownership', 'note'] widgets = { 'info': forms.Select(attrs={ 'class': 'form-select', @@ -487,10 +487,16 @@ class SourceForm(forms.ModelForm): 'class': 'form-select', 'id': 'id_ownership', }), + 'note': forms.Textarea(attrs={ + 'class': 'form-control', + 'rows': "3", + 'id': 'id_note', + }) } labels = { 'info': 'Тип объекта', 'ownership': 'Принадлежность объекта', + 'note': 'Примечание' } help_texts = { 'info': 'Стационарные: координата усредняется. Подвижные: координата = последняя точка. При изменении типа координата пересчитывается автоматически.', diff --git a/dbapp/mainapp/migrations/0014_source_note.py b/dbapp/mainapp/migrations/0014_source_note.py new file mode 100644 index 0000000..2224fe4 --- /dev/null +++ b/dbapp/mainapp/migrations/0014_source_note.py @@ -0,0 +1,18 @@ +# Generated by Django 5.2.7 on 2025-11-25 12:46 + +from django.db import migrations, models + + +class Migration(migrations.Migration): + + dependencies = [ + ('mainapp', '0013_add_is_automatic_to_objitem'), + ] + + operations = [ + migrations.AddField( + model_name='source', + name='note', + field=models.TextField(blank=True, help_text='Дополнительное описание объекта', null=True, verbose_name='Примечание'), + ), + ] diff --git a/dbapp/mainapp/models.py b/dbapp/mainapp/models.py index 0429932..d68b03f 100644 --- a/dbapp/mainapp/models.py +++ b/dbapp/mainapp/models.py @@ -491,6 +491,12 @@ class Source(models.Model): verbose_name="Принадлежность объекта", help_text="Принадлежность объекта (страна, организация и т.д.)", ) + note = models.TextField( + null=True, + blank=True, + verbose_name="Примечание", + help_text="Дополнительное описание объекта", + ) confirm_at = models.DateTimeField( null=True, blank=True, diff --git a/dbapp/mainapp/templates/mainapp/source_form.html b/dbapp/mainapp/templates/mainapp/source_form.html index a75045e..024fca3 100644 --- a/dbapp/mainapp/templates/mainapp/source_form.html +++ b/dbapp/mainapp/templates/mainapp/source_form.html @@ -238,6 +238,17 @@ +
+
+ + {{ form.note }} + {% if form.note.errors %} +
+ {{ form.note.errors }} +
+ {% endif %} +
+
diff --git a/dbapp/mainapp/templates/mainapp/source_list.html b/dbapp/mainapp/templates/mainapp/source_list.html index ecec3ae..7a0ba37 100644 --- a/dbapp/mainapp/templates/mainapp/source_list.html +++ b/dbapp/mainapp/templates/mainapp/source_list.html @@ -148,11 +148,13 @@
  • -
  • -
  • -
  • -
  • -
  • +
  • +
  • +
  • +
  • +
  • +
  • + @@ -457,6 +459,7 @@ Координаты Кубсата Координаты визуального наблюдения Координаты справочные + Примечание {% include 'mainapp/components/_sort_header.html' with field='created_at' label='Создано' current_sort=sort %} @@ -503,6 +506,7 @@ {{ source.coords_kupsat }} {{ source.coords_valid }} {{ source.coords_reference }} + {{ source.note }} {{ source.created_at|date:"d.m.Y H:i" }} {{ source.updated_at|date:"d.m.Y H:i" }} {{ source.confirm_at|date:"d.m.Y H:i"|default:"-" }} @@ -1122,6 +1126,7 @@ function initColumnVisibility() { // Default state: hide Создано and Обновлено columns const createdAtCheckbox = document.querySelector('input[data-column="11"]'); const updatedAtCheckbox = document.querySelector('input[data-column="12"]'); + const noteCheckbox = document.querySelector('input[data-column="13"]'); if (createdAtCheckbox) { createdAtCheckbox.checked = false; @@ -1132,6 +1137,11 @@ function initColumnVisibility() { updatedAtCheckbox.checked = false; toggleColumnWithoutSave(updatedAtCheckbox); } + + if (noteCheckbox) { + noteCheckbox.checked = false; + toggleColumnWithoutSave(noteCheckbox); + } // Save initial state saveColumnVisibility(); diff --git a/dbapp/mainapp/templates/mainapp/source_with_points_map.html b/dbapp/mainapp/templates/mainapp/source_with_points_map.html index e3bdabc..9f714b6 100644 --- a/dbapp/mainapp/templates/mainapp/source_with_points_map.html +++ b/dbapp/mainapp/templates/mainapp/source_with_points_map.html @@ -69,6 +69,7 @@ +