switch case form to crispy and start using bootstrap nav
This commit is contained in:
+30
-2
@@ -48,6 +48,8 @@ from generic.models import Examination#, Sign
|
||||
|
||||
from django.contrib.admin.widgets import FilteredSelectMultiple
|
||||
from django.forms.widgets import RadioSelect, TextInput, Textarea, Select
|
||||
from crispy_forms.layout import Submit, Layout, Fieldset, Field, Div
|
||||
from crispy_forms.bootstrap import Accordion, AccordionGroup
|
||||
|
||||
from tinymce.widgets import TinyMCE
|
||||
|
||||
@@ -304,8 +306,6 @@ class CaseForm(ModelForm):
|
||||
js = ["jsi18n.js", "tesseract.min.js", "js/upload_form_helpers.js"]
|
||||
|
||||
def __init__(self, *args, **kwargs):
|
||||
logging.info("LOG")
|
||||
logging.debug(kwargs)
|
||||
self.user = kwargs.pop(
|
||||
"user"
|
||||
) # To get request.user. Do not use kwargs.pop('user', None) due to potential security hole
|
||||
@@ -340,6 +340,34 @@ class CaseForm(ModelForm):
|
||||
case_queryset = get_cases_available_to_user(self.user)
|
||||
self.fields["previous_case"].queryset=case_queryset
|
||||
|
||||
|
||||
self.helper = FormHelper()
|
||||
self.helper.form_id = "id-case-form"
|
||||
self.helper.form_class = "case-form"
|
||||
self.helper.form_method = "post"
|
||||
self.helper.form_action = "submit"
|
||||
self.helper.form_tag = False
|
||||
|
||||
self.helper.layout = Layout(
|
||||
Fieldset(
|
||||
"Case details",
|
||||
"title",
|
||||
"subspecialty",
|
||||
"description",
|
||||
"history",
|
||||
"presentation",
|
||||
"discussion",
|
||||
"condition",
|
||||
"pathological_process",
|
||||
"report",
|
||||
"open_access",
|
||||
"previous_case",
|
||||
"diagnostic_certainty",
|
||||
),
|
||||
|
||||
)
|
||||
|
||||
|
||||
def get_queryset(self, request):
|
||||
return (
|
||||
super()
|
||||
|
||||
Reference in New Issue
Block a user