Поправил геофильтр и отображения источника в отметках

This commit is contained in:
2025-11-17 10:45:32 +03:00
parent c55a41f5fe
commit f438e74946
4 changed files with 17 additions and 3 deletions

View File

@@ -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