Skip to main content

pypi actions coverage

edc-form-label

Customize Django’s form label in realtime

For a sequence of data collection timepoints, we ask the question, “Are you circumcised?”. At some time point we hope the response will be YES, but until then, we need to ask “Since we last saw you, were you circumcised?”. It is a lot better if we can ask, “Since we last saw you in ‘October 2018’, were you circumcised?”, where ‘October 2018’ represents the timepoint from which we got our last reponse.

This module shows how you can insert ‘October 2018’ into the ModelAdmin/ModelForm the 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.

from edc_form_label import FormLabel, CustomFormLabel, FormLabelModelAdminMixin


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


@register(MyModel)
class MyModelAdmin(FormLabelModelAdminMixin 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)
    ]

Metadata

Release files for edc-form-label 1.0.2

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for edc-form-label 1.0.2
File Size Uploaded
edc_form_label-1.0.2.tar.gz 30.9 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for edc-form-label 1.0.2
File Interpreter ABI Platform
edc_form_label-1.0.2-py3-none-any.whl Python 3 none any Details

Total release size: 61.4 kB

Release files / edc_form_label-1.0.2.tar.gz

Download URL edc_form_label-1.0.2.tar.gz
Size 30.9 kB
Tags Source
SHA-256 checksum
How to use checksums
44ab4ba73fef40ed235c767878f70c8535e51772376f6e0b5d8760cf05f0be23
BLAKE2b-256 checksum
How to use checksums
2f169e51493cc12520e36520b3121416ba516c96367854287af79399ec1b35a0
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.1.0 CPython/3.12.4

Release files / edc_form_label-1.0.2-py3-none-any.whl

Download URL edc_form_label-1.0.2-py3-none-any.whl
Size 30.5 kB
Tags Python 3
SHA-256 checksum
How to use checksums
e007ca5774c0c19a4a5f0d93e4101f9faa64d59ff9f9c9c8d03fd46b28585e78
BLAKE2b-256 checksum
How to use checksums
0f5d5a105df0bc01110a2570808153d91f98e20a3a2ac5f6be3f4d85c16e961e
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.1.0 CPython/3.12.4

Release history Release notifications | RSS feed

This release

1.0.2 This release

2 release files

1.0.1

2 release files

1.0.0

2 release files

0.3.19

2 release files

0.3.18

2 release files

0.3.16

2 release files

0.3.15

2 release files

0.3.13

2 release files

0.3.12

2 release files

0.3.9

2 release files

0.3.8

2 release files

0.3.7

2 release files

0.3.6

2 release files

0.3.5

2 release files

0.3.4

2 release files

0.3.3

1 release file

0.3.2

1 release file

0.3.1

1 release file

0.3.0

1 release file

0.1.7

1 release file

0.1.6

1 release file

0.1.5

1 release file

0.1.3

1 release file

0.1.2

2 release files

0.1.1

2 release files

0.1.0

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page