Поправил геофильтр и отображения источника в отметках
This commit is contained in:
@@ -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