Forms
Forms for creating and modifying database objects.
Please refer to django.forms for general information about Django forms (see also: Working with forms).
Custom Model Form
- class ycms.cms.forms.custom_model_form.CustomModelForm(**kwargs)
Bases:
ModelFormForm for populating all text widgets of a ModelForm with the default placeholder “Enter … here”. Use this form as base class instead of
django.forms.ModelForm.Form fields:
- __init__(**kwargs)
Initialize placeholder model form
- add_error_messages(request)
This function accepts the current request and adds the form’s error messages to the message queue of
django.contrib.messages.- Parameters:
request (HttpRequest) – The current request submitting the form
- clean()
This method extends the default
clean()-method of the baseModelFormto provide debug logging- Returns:
The cleaned data (see Overriding the clean() method)
- Return type:
- get_error_messages()
Return all error messages of this form and append labels to errors
- Returns:
The errors of this form
- Return type:
- property media
Return all media required to render the widgets on this form.
- save(commit=True)
This method extends the default
save()-method of the baseModelFormto provide debug logging- Parameters:
commit (bool) – Whether or not the changes should be written to the database
- Returns:
The saved object returned by The save() method
- Return type:
Intake Bed Assignment Form
- class ycms.cms.forms.intake_bed_assignment_form.IntakeBedAssignmentForm(*args, **kwargs)
Bases:
CustomModelFormForm for creating intake bed assignments. Not used for assignment by station managers.
Form fields:
admission_date: Admission date (DateTimeField)discharge_date: Estimated discharge date (DateTimeField)recommended_ward: Recommended ward (ModelChoiceField)accompanied: Accompanied (BooleanField)
- __init__(*args, **kwargs)
Initialize medical record form
- property media
Return all media required to render the widgets on this form.
Intake Record Form
- class ycms.cms.forms.intake_record_form.IntakeRecordForm(*args, **kwargs)
Bases:
CustomModelFormForm for creating intake records. Not used for general records.
Form fields:
patient: Patient (ModelChoiceField)diagnosis_code: Diagnosis code (ModelChoiceField)note: Note (CharField)
- __init__(*args, **kwargs)
Initialize medical record form
- property media
Return all media required to render the widgets on this form.
Patient Form
- class ycms.cms.forms.patient_form.PatientForm(**kwargs)
Bases:
CustomModelFormForm for creating patients
Form fields:
first_name: First name (CharField)last_name: Last name (CharField)gender: Gender (TypedChoiceField)date_of_birth: Date of birth (DateField)insurance_type: Insurance type (TypedChoiceField)
- property media
Return all media required to render the widgets on this form.
Unknown Patient Form
- class ycms.cms.forms.unknown_patient_form.UnknownPatientForm(**kwargs)
Bases:
CustomModelFormForm for creating placeholder patients
Form fields:
gender: Gender (TypedChoiceField)approximate_age: Approximate age (IntegerField)
- property media
Return all media required to render the widgets on this form.
- prefix = 'unknown'
User Form
- class ycms.cms.forms.user_form.UserForm(**kwargs)
Bases:
CustomModelFormForm for editing users
Form fields:
first_name: First name (CharField)last_name: Last name (CharField)assigned_ward: Ward (ModelChoiceField)ward_as_timeline: Ward as timeline (BooleanField)
- property media
Return all media required to render the widgets on this form.
Ward Form
- class ycms.cms.forms.ward_form.WardForm(**kwargs)
Bases:
CustomModelFormForm for creating wards
Form fields:
ward_number: Ward number (CharField)floor: Floor (IntegerField)name: Ward name (CharField)
- property media
Return all media required to render the widgets on this form.