Skip to main content

Customize Django's form label in realtime

Project description

|pypi| |travis| |coverage|

edc-form-label
-------------
Customize Django's form label in realtime



For example:

For a sequence of data collection timepoints, we ask the question, "Are you circumcised". At some point we hope the response will be YES. But until then we need to ask "Since we last saw you in October 2018, were you circumcised?", etc.

.. code-block:: python

from edc_form_label import FormLabel, CustomFormLabel


class MyCustomLabelCondition(CustomLabelCondition):
def check(self, **kwargs):
if self.previous_obj.circumcised == NO:
return True
return False


@register(MyModel)
class MyModelAdmin(admin.ModelAdmin):

fieldsets = (
(None, {
'fields': (
'subject_visit',
'report_datetime',
'circumcised')},
),
)

custom_form_labels = [
FormLabel(
field='circumcised',
custom_label='Since we last saw you in {previous_visit}, were you circumcised?',
condition_cls=MyCustomLabelCondition)
]



.. |pypi| image:: https://img.shields.io/pypi/v/edc-form-label.svg
:target: https://pypi.python.org/pypi/edc-form-label

.. |travis| image:: https://travis-ci.com/clinicedc/edc-form-label.svg?branch=develop
:target: https://travis-ci.com/clinicedc/edc-form-label

.. |coverage| image:: https://coveralls.io/repos/github/clinicedc/edc-form-label/badge.svg?branch=develop
:target: https://coveralls.io/github/clinicedc/edc-form-label?branch=develop


Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

edc-form-label-0.1.0.macosx-10.13-x86_64.tar.gz (14.2 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

edc_form_label-0.1.0-py3-none-any.whl (10.7 kB view details)

Uploaded Python 3

File details

Details for the file edc-form-label-0.1.0.macosx-10.13-x86_64.tar.gz.

File metadata

  • Download URL: edc-form-label-0.1.0.macosx-10.13-x86_64.tar.gz
  • Upload date:
  • Size: 14.2 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/1.12.1 pkginfo/1.4.2 requests/2.19.1 setuptools/40.1.0 requests-toolbelt/0.8.0 tqdm/4.25.0 CPython/3.7.0

File hashes

Hashes for edc-form-label-0.1.0.macosx-10.13-x86_64.tar.gz
Algorithm Hash digest
SHA256 b76bf2219df6e724226974ae61484f55485bf89b2009e51a056284466d27f17c
MD5 80176ebb9b8db32f0bc4314b3814cf24
BLAKE2b-256 493bb7378f7374489e9fc1936bb447727fdb1fe947341cbe85f24cf70a654acb

See more details on using hashes here.

File details

Details for the file edc_form_label-0.1.0-py3-none-any.whl.

File metadata

  • Download URL: edc_form_label-0.1.0-py3-none-any.whl
  • Upload date:
  • Size: 10.7 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/1.12.1 pkginfo/1.4.2 requests/2.19.1 setuptools/40.1.0 requests-toolbelt/0.8.0 tqdm/4.25.0 CPython/3.7.0

File hashes

Hashes for edc_form_label-0.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 46df28ef3180700e2e94ee72d1b09824dcee0632198284c92a29ab9dd0ec2980
MD5 41780777cd5370aee0563cb55af0d9cb
BLAKE2b-256 76f8cdfef7807780b2bfefefe66009fb5e9d6028441855e7966cb93762e63fcf

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page