Поправил геофильтр и отображения источника в отметках
This commit is contained in:
@@ -32,7 +32,7 @@
|
||||
<a class="nav-link" href="{% url 'mainapp:actions' %}">Действия</a>
|
||||
</li>
|
||||
<li class="nav-item">
|
||||
<a class="nav-link" href="{% url 'mainapp:object_marks' %}">Отметки</a>
|
||||
<a class="nav-link" href="{% url 'mainapp:object_marks' %}">Наличие сигнала</a>
|
||||
</li>
|
||||
<li class="nav-item">
|
||||
<a class="nav-link" href="{% url 'mapsapp:3dmap' %}">3D карта</a>
|
||||
|
||||
@@ -150,6 +150,7 @@
|
||||
<tr data-source-id="{{ source.id }}">
|
||||
<td class="source-info-cell" rowspan="{{ marks.count }}">
|
||||
<div><strong>ID:</strong> {{ source.id }}</div>
|
||||
<div><strong>Имя объекта:</strong> {{ source.objitem_name }}</div>
|
||||
<div><strong>Дата создания:</strong> {{ source.created_at|date:"d.m.Y H:i" }}</div>
|
||||
<div><strong>Кол-во объектов:</strong> {{ source.source_objitems.count }}</div>
|
||||
{% if source.coords_average %}
|
||||
@@ -218,6 +219,7 @@
|
||||
<tr data-source-id="{{ source.id }}">
|
||||
<td class="source-info-cell">
|
||||
<div><strong>ID:</strong> {{ source.id }}</div>
|
||||
<div><strong>Имя объекта:</strong> {{ source.objitem_name }}</div>
|
||||
<div><strong>Дата создания:</strong> {{ source.created_at|date:"d.m.Y H:i" }}</div>
|
||||
<div><strong>Кол-во объектов:</strong> {{ source.source_objitems.count }}</div>
|
||||
{% if source.coords_average %}
|
||||
|
||||
@@ -209,7 +209,10 @@ class SourceObjItemsAPIView(LoginRequiredMixin, View):
|
||||
if geo_date_from:
|
||||
try:
|
||||
geo_date_from_obj = datetime.strptime(geo_date_from, "%Y-%m-%d")
|
||||
objitems = objitems.filter(geo_obj__timestamp__gte=geo_date_from_obj)
|
||||
objitems = objitems.filter(
|
||||
geo_obj__isnull=False,
|
||||
geo_obj__timestamp__gte=geo_date_from_obj
|
||||
)
|
||||
except (ValueError, TypeError):
|
||||
pass
|
||||
|
||||
@@ -218,7 +221,10 @@ class SourceObjItemsAPIView(LoginRequiredMixin, View):
|
||||
geo_date_to_obj = datetime.strptime(geo_date_to, "%Y-%m-%d")
|
||||
# Add one day to include entire end date
|
||||
geo_date_to_obj = geo_date_to_obj + timedelta(days=1)
|
||||
objitems = objitems.filter(geo_obj__timestamp__lt=geo_date_to_obj)
|
||||
objitems = objitems.filter(
|
||||
geo_obj__isnull=False,
|
||||
geo_obj__timestamp__lt=geo_date_to_obj
|
||||
)
|
||||
except (ValueError, TypeError):
|
||||
pass
|
||||
|
||||
|
||||
@@ -46,13 +46,19 @@ class ObjectMarksListView(LoginRequiredMixin, ListView):
|
||||
context['satellites'] = Satellite.objects.all().order_by('name')
|
||||
|
||||
# Добавить информацию о возможности редактирования для каждой отметки
|
||||
# и получить имя первого объекта для каждого источника
|
||||
for source in context['sources']:
|
||||
# Получить имя первого объекта
|
||||
first_objitem = source.source_objitems.first()
|
||||
source.objitem_name = first_objitem.name if first_objitem and first_objitem.name else '-'
|
||||
|
||||
for mark in source.marks.all():
|
||||
mark.editable = mark.can_edit()
|
||||
|
||||
return context
|
||||
|
||||
|
||||
|
||||
class AddObjectMarkView(LoginRequiredMixin, View):
|
||||
"""
|
||||
API endpoint для добавления отметки источника.
|
||||
|
||||
Reference in New Issue
Block a user