Edc custom django ModelAdmin mixins, tags and templates for clinicedc/edc projects


Keywords
django, modeladmin, edc, clinicedc, clinical, trials
Licenses
xpp/MIT-feh
Install
pip install edc-model-admin==0.3.1

Documentation

pypi actions codecov downloads

edc-model-admin

Edc custom django ModelAdmin mixins, tags and templates

ModelAdminFormAutoNumberMixin

Overrides ModelAdmin's get_form to insert question numbers and the DB field names.

ModelAdminNextUrlRedirectMixin

Skips the changelist and redirects to the next CRF or Requisition listed in an edc visit schedule if "[Save and Next]" is clicked instead of "[SAVE]"

You need to use the included change_form.html to override the submit buttons on the admin form.

See also:: edc_visit_schedule

ModelAdminRedirectOnDeleteMixin

Redirects the admin form on save to a view other than the default changelist if post_url_on_delete_name is set.

You can also store url names in the request object if used together with the Middleware from edc_dashboard and edc_subject_dashboard. This is useful if you do not know the namespace until deployment.

For example, add to settings:

and then declare the model admin class:

ModelAdminRedirectOnDeleteMixin will attempt to get the urlname from the request object using post_url_on_delete_name as a dictionary key.