|
1 | 1 | import base64 |
2 | 2 | import json |
3 | | -import structlog |
| 3 | +import logging |
4 | 4 |
|
5 | 5 | from django import forms |
6 | 6 | from django.conf import settings |
|
27 | 27 | from experiments.models import ProbeInsertion, FOV |
28 | 28 | from jobs.models import Task |
29 | 29 |
|
30 | | -logger = structlog.get_logger(__name__) |
| 30 | +logger = logging.getLogger(__name__) |
31 | 31 |
|
32 | 32 |
|
33 | 33 | # Filters |
@@ -213,6 +213,17 @@ def get_form(self, request, obj=None, **kwargs): |
213 | 213 | form.last_subject_id = self._get_last_subject(request) |
214 | 214 | return form |
215 | 215 |
|
| 216 | + def change_view(self, request, object_id, extra_context=None, **kwargs): |
| 217 | + context = extra_context or {} |
| 218 | + context = _pass_narrative_templates(context) |
| 219 | + return super(BaseActionAdmin, self).change_view( |
| 220 | + request, object_id, extra_context=context, **kwargs) |
| 221 | + |
| 222 | + def add_view(self, *args, extra_context=None): |
| 223 | + context = extra_context or {} |
| 224 | + context = _pass_narrative_templates(context) |
| 225 | + return super(BaseActionAdmin, self).add_view(*args, extra_context=context) |
| 226 | + |
216 | 227 | def formfield_for_foreignkey(self, db_field, request, **kwargs): |
217 | 228 | # Logged-in user by default. |
218 | 229 | if db_field.name == 'user': |
@@ -616,17 +627,6 @@ def get_form(self, request, obj=None, **kwargs): |
616 | 627 | ).distinct() |
617 | 628 | return form |
618 | 629 |
|
619 | | - def change_view(self, request, object_id, extra_context=None, **kwargs): |
620 | | - context = extra_context or {} |
621 | | - context = _pass_narrative_templates(context) |
622 | | - return super(SessionAdmin, self).change_view( |
623 | | - request, object_id, extra_context=context, **kwargs) |
624 | | - |
625 | | - def add_view(self, request, extra_context=None): |
626 | | - context = extra_context or {} |
627 | | - context = _pass_narrative_templates(context) |
628 | | - return super(SessionAdmin, self).add_view(request, extra_context=context) |
629 | | - |
630 | 630 | def project_(self, obj): |
631 | 631 | return [getattr(p, 'name', None) for p in obj.projects.all()] |
632 | 632 |
|
|
0 commit comments