.
This commit is contained in:
@@ -38,6 +38,19 @@ class SeriesFindingsForm(ModelForm):
|
|||||||
model = SeriesFindings
|
model = SeriesFindings
|
||||||
exclude = [""]
|
exclude = [""]
|
||||||
|
|
||||||
|
def __init__(self, *args, **kwargs):
|
||||||
|
if kwargs.get("series_id"):
|
||||||
|
# We get the 'initial' keyword argument or initialize it
|
||||||
|
# as a dict if it didn't exist.
|
||||||
|
initial = kwargs.setdefault("initial", {})
|
||||||
|
# The widget for a ModelMultipleChoiceField expects
|
||||||
|
# a list of primary key for the selected data.
|
||||||
|
initial["series"] = kwargs["series_id"].id
|
||||||
|
|
||||||
|
super(SeriesFindingsForm, self).__init__(*args, **kwargs)
|
||||||
|
|
||||||
|
ModelForm.__init__(self, *args, **kwargs)
|
||||||
|
|
||||||
class SeriesForm(ModelForm):
|
class SeriesForm(ModelForm):
|
||||||
class Media:
|
class Media:
|
||||||
# Django also includes a few javascript files necessary
|
# Django also includes a few javascript files necessary
|
||||||
|
|||||||
+1
-1
@@ -117,7 +117,7 @@ def series_detail(request, pk):
|
|||||||
|
|
||||||
# if request.user not in atlas.author.all():
|
# if request.user not in atlas.author.all():
|
||||||
# raise PermissionDenied
|
# raise PermissionDenied
|
||||||
series_finding_form = SeriesFindingsForm()
|
series_finding_form = SeriesFindingsForm(series_id=series.id)
|
||||||
|
|
||||||
|
|
||||||
# logging.debug(atlas.subspecialty.first().name.all())
|
# logging.debug(atlas.subspecialty.first().name.all())
|
||||||
|
|||||||
Reference in New Issue
Block a user