.
This commit is contained in:
+10
-1
@@ -63,6 +63,8 @@ from crispy_forms.helper import FormHelper
|
||||
|
||||
from atlas.helpers import get_cases_available_to_user
|
||||
|
||||
from typing import Any
|
||||
|
||||
class CaseSelect(Select):
|
||||
template_name = "atlas/case_select_widget.html"
|
||||
|
||||
@@ -72,8 +74,14 @@ class CaseSelect(Select):
|
||||
|
||||
print(option)
|
||||
|
||||
|
||||
return option
|
||||
|
||||
def get_context(self, name: str, value, attrs) -> dict[str, Any]:
|
||||
context = super().get_context(name, value, attrs)
|
||||
return context
|
||||
|
||||
|
||||
pass
|
||||
|
||||
class ConditionForm(ModelForm):
|
||||
@@ -326,7 +334,8 @@ class CaseForm(ModelForm):
|
||||
# self.fields["series"].queryset =
|
||||
|
||||
if self.user.groups.filter(name="atlas_editor").exists():
|
||||
case_queryset = Case.objects.all().order_by("pk")
|
||||
case_queryset = Case.objects.all().order_by("pk").prefetch_related(
|
||||
)
|
||||
else:
|
||||
case_queryset = get_cases_available_to_user(self.user)
|
||||
self.fields["previous_case"].queryset=case_queryset
|
||||
|
||||
Reference in New Issue
Block a user