.
This commit is contained in:
+6
-12
@@ -337,15 +337,6 @@ CaseDifferentialFormSet = inlineformset_factory(
|
|||||||
)
|
)
|
||||||
|
|
||||||
|
|
||||||
class BaseSeriesFormSet(BaseInlineFormSet):
|
|
||||||
def __init__(self, *args, **kwargs):
|
|
||||||
|
|
||||||
super(BaseSeriesFormSet, self).__init__(*args, **kwargs)
|
|
||||||
|
|
||||||
self.queryset = Series.case.through.objects.filter(series__author__id=99)
|
|
||||||
|
|
||||||
# for form in self.forms:
|
|
||||||
# form.fields['series'].queryset = series_queryset
|
|
||||||
|
|
||||||
|
|
||||||
class CaseSeriesForm(ModelForm):
|
class CaseSeriesForm(ModelForm):
|
||||||
@@ -362,9 +353,14 @@ class CaseCollectionCaseForm(ModelForm):
|
|||||||
def __init__(self, *args, user, **kwargs):
|
def __init__(self, *args, user, **kwargs):
|
||||||
super(CaseCollectionCaseForm, self).__init__(*args, **kwargs)
|
super(CaseCollectionCaseForm, self).__init__(*args, **kwargs)
|
||||||
|
|
||||||
|
if not user.groups.filter(name="atlas_editor").exists():
|
||||||
|
queryset = Case.objects.filter(author__id=user.id)
|
||||||
|
else:
|
||||||
|
queryset = Case.objects.all()
|
||||||
|
|
||||||
self.fields["case"] = ModelChoiceField(
|
self.fields["case"] = ModelChoiceField(
|
||||||
required=False,
|
required=False,
|
||||||
queryset=Case.objects.filter(author__id=user.id),
|
queryset=queryset,
|
||||||
# widget=Select(verbose_name="Series", is_stacked=False),
|
# widget=Select(verbose_name="Series", is_stacked=False),
|
||||||
)
|
)
|
||||||
|
|
||||||
@@ -372,7 +368,6 @@ SeriesFormSet = inlineformset_factory(
|
|||||||
Case,
|
Case,
|
||||||
Series.case.through,
|
Series.case.through,
|
||||||
form=CaseSeriesForm,
|
form=CaseSeriesForm,
|
||||||
# formset=BaseSeriesFormSet,
|
|
||||||
exclude=[],
|
exclude=[],
|
||||||
can_delete=True,
|
can_delete=True,
|
||||||
extra=0,
|
extra=0,
|
||||||
@@ -383,7 +378,6 @@ CaseCollectionCaseFormSet = inlineformset_factory(
|
|||||||
CaseCollection,
|
CaseCollection,
|
||||||
Case.casecollection_set.through,
|
Case.casecollection_set.through,
|
||||||
form=CaseCollectionCaseForm,
|
form=CaseCollectionCaseForm,
|
||||||
# formset=BaseSeriesFormSet,
|
|
||||||
exclude=[],
|
exclude=[],
|
||||||
can_delete=True,
|
can_delete=True,
|
||||||
extra=0,
|
extra=0,
|
||||||
|
|||||||
Reference in New Issue
Block a user