Добавил формы создания и пофиксил баг с пользователями
This commit is contained in:
@@ -286,6 +286,13 @@ class ObjItemListView(LoginRequiredMixin, View):
|
||||
elif has_sigma == "0":
|
||||
objects = objects.filter(parameter_obj__sigma_parameter__isnull=True)
|
||||
|
||||
# Filter by is_automatic
|
||||
is_automatic_filter = request.GET.get("is_automatic")
|
||||
if is_automatic_filter == "1":
|
||||
objects = objects.filter(is_automatic=True)
|
||||
elif is_automatic_filter == "0":
|
||||
objects = objects.filter(is_automatic=False)
|
||||
|
||||
if search_query:
|
||||
search_query = search_query.strip()
|
||||
if search_query:
|
||||
@@ -336,6 +343,8 @@ class ObjItemListView(LoginRequiredMixin, View):
|
||||
"-polarization": "-first_param_pol_name",
|
||||
"modulation": "first_param_mod_name",
|
||||
"-modulation": "-first_param_mod_name",
|
||||
"is_automatic": "is_automatic",
|
||||
"-is_automatic": "-is_automatic",
|
||||
}
|
||||
|
||||
# Apply sorting if valid, otherwise use default
|
||||
@@ -467,6 +476,7 @@ class ObjItemListView(LoginRequiredMixin, View):
|
||||
"has_sigma": has_sigma,
|
||||
"sigma_info": sigma_info,
|
||||
"mirrors": ", ".join(mirrors_list) if mirrors_list else "-",
|
||||
"is_automatic": "Да" if obj.is_automatic else "Нет",
|
||||
"obj": obj,
|
||||
}
|
||||
)
|
||||
@@ -477,6 +487,7 @@ class ObjItemListView(LoginRequiredMixin, View):
|
||||
# Get the new filter values
|
||||
has_source_type = request.GET.get("has_source_type")
|
||||
has_sigma = request.GET.get("has_sigma")
|
||||
is_automatic_filter = request.GET.get("is_automatic")
|
||||
|
||||
context = {
|
||||
"satellites": satellites,
|
||||
@@ -509,6 +520,7 @@ class ObjItemListView(LoginRequiredMixin, View):
|
||||
"date_to": date_to,
|
||||
"has_source_type": has_source_type,
|
||||
"has_sigma": has_sigma,
|
||||
"is_automatic": is_automatic_filter,
|
||||
"modulations": modulations,
|
||||
"polarizations": polarizations,
|
||||
"full_width_page": True,
|
||||
@@ -679,6 +691,10 @@ class ObjItemCreateView(ObjItemFormView, CreateView):
|
||||
|
||||
success_message = "Объект успешно создан!"
|
||||
|
||||
def get_object(self, queryset=None):
|
||||
"""Return None for create view."""
|
||||
return None
|
||||
|
||||
def set_user_fields(self):
|
||||
self.object.created_by = self.request.user.customuser
|
||||
self.object.updated_by = self.request.user.customuser
|
||||
|
||||
Reference in New Issue
Block a user