edc-form-label


Nameedc-form-label JSON
Version 0.3.19 PyPI version JSON
download
home_pagehttps://github.com/clinicedc/edc-form-label
SummaryCustomize Django form label in realtime in clinicedc/edc projects
upload_time2024-11-20 22:49:18
maintainerNone
docs_urlNone
authorErik van Widenfelt
requires_python>=3.12
licenseGPL license, see LICENSE
keywords django edc modelform clinicedc clinical trials
VCS
bugtrack_url
requirements No requirements were recorded.
Travis-CI No Travis.
coveralls test coverage No coveralls.
            |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.

.. code-block:: python

	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)
	    ]



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

.. |actions| image:: https://github.com/clinicedc/edc-form-label/actions/workflows/build.yml/badge.svg
  :target: https://github.com/clinicedc/edc-form-label/actions/workflows/build.yml

.. |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

            

Raw data

            {
    "_id": null,
    "home_page": "https://github.com/clinicedc/edc-form-label",
    "name": "edc-form-label",
    "maintainer": null,
    "docs_url": null,
    "requires_python": ">=3.12",
    "maintainer_email": null,
    "keywords": "django Edc modelform, clinicedc, clinical trials",
    "author": "Erik van Widenfelt",
    "author_email": "ew2789@gmail.com",
    "download_url": "https://files.pythonhosted.org/packages/af/7c/9d4ce9cdc9c55d5f3e174d4a22538cfbd98836f9535c7de20e29b0017e92/edc_form_label-0.3.19.tar.gz",
    "platform": null,
    "description": "|pypi| |actions| |coverage|\n\nedc-form-label\n--------------\nCustomize Django's form label in realtime\n\nFor 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.\n\nThis module shows how you can insert 'October 2018' into the ModelAdmin/ModelForm the form label in realtime.\n\n\nFor example:\n\nFor 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.\n\n.. code-block:: python\n\n\tfrom edc_form_label import FormLabel, CustomFormLabel, FormLabelModelAdminMixin\n\n\n\tclass MyCustomLabelCondition(CustomLabelCondition):\n\t    def check(self, **kwargs):\n\t        if self.previous_obj.circumcised == NO:\n\t            return True\n\t        return False\n\n\n\t@register(MyModel)\n\tclass MyModelAdmin(FormLabelModelAdminMixin admin.ModelAdmin):\n\n\t    fieldsets = (\n\t        (None, {\n\t            'fields': (\n\t                'subject_visit',\n\t                'report_datetime',\n\t                'circumcised')},\n\t         ),\n\t    )\n\n\t    custom_form_labels = [\n\t        FormLabel(\n\t            field='circumcised',\n\t            custom_label='Since we last saw you in {previous_visit}, were you circumcised?',\n\t            condition_cls=MyCustomLabelCondition)\n\t    ]\n\n\n\n.. |pypi| image:: https://img.shields.io/pypi/v/edc-form-label.svg\n    :target: https://pypi.python.org/pypi/edc-form-label\n\n.. |actions| image:: https://github.com/clinicedc/edc-form-label/actions/workflows/build.yml/badge.svg\n  :target: https://github.com/clinicedc/edc-form-label/actions/workflows/build.yml\n\n.. |coverage| image:: https://coveralls.io/repos/github/clinicedc/edc-form-label/badge.svg?branch=develop\n    :target: https://coveralls.io/github/clinicedc/edc-form-label?branch=develop\n",
    "bugtrack_url": null,
    "license": "GPL license, see LICENSE",
    "summary": "Customize Django form label in realtime in clinicedc/edc projects",
    "version": "0.3.19",
    "project_urls": {
        "Homepage": "https://github.com/clinicedc/edc-form-label"
    },
    "split_keywords": [
        "django edc modelform",
        " clinicedc",
        " clinical trials"
    ],
    "urls": [
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "a24f84a19a1966f301def6e360eac1614e3336ae98a28a84951604e52fde4351",
                "md5": "1ebb06e3da64c9ab2ba6c0d394f5c0c3",
                "sha256": "4d5cd519de5a9537f0c382664b77b0660db63afa14772d00025b1bb6f2d98246"
            },
            "downloads": -1,
            "filename": "edc_form_label-0.3.19-py3-none-any.whl",
            "has_sig": false,
            "md5_digest": "1ebb06e3da64c9ab2ba6c0d394f5c0c3",
            "packagetype": "bdist_wheel",
            "python_version": "py3",
            "requires_python": ">=3.12",
            "size": 29470,
            "upload_time": "2024-11-20T22:49:17",
            "upload_time_iso_8601": "2024-11-20T22:49:17.249420Z",
            "url": "https://files.pythonhosted.org/packages/a2/4f/84a19a1966f301def6e360eac1614e3336ae98a28a84951604e52fde4351/edc_form_label-0.3.19-py3-none-any.whl",
            "yanked": false,
            "yanked_reason": null
        },
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "af7c9d4ce9cdc9c55d5f3e174d4a22538cfbd98836f9535c7de20e29b0017e92",
                "md5": "06301b8463629b5afe7050a96b2727bd",
                "sha256": "30bc5100be79ce04a2d59d2cedbba34b1416895af1bc251f3f0d1e44c7715c57"
            },
            "downloads": -1,
            "filename": "edc_form_label-0.3.19.tar.gz",
            "has_sig": false,
            "md5_digest": "06301b8463629b5afe7050a96b2727bd",
            "packagetype": "sdist",
            "python_version": "source",
            "requires_python": ">=3.12",
            "size": 30637,
            "upload_time": "2024-11-20T22:49:18",
            "upload_time_iso_8601": "2024-11-20T22:49:18.177005Z",
            "url": "https://files.pythonhosted.org/packages/af/7c/9d4ce9cdc9c55d5f3e174d4a22538cfbd98836f9535c7de20e29b0017e92/edc_form_label-0.3.19.tar.gz",
            "yanked": false,
            "yanked_reason": null
        }
    ],
    "upload_time": "2024-11-20 22:49:18",
    "github": true,
    "gitlab": false,
    "bitbucket": false,
    "codeberg": false,
    "github_user": "clinicedc",
    "github_project": "edc-form-label",
    "travis_ci": false,
    "coveralls": false,
    "github_actions": true,
    "lcname": "edc-form-label"
}
        
Elapsed time: 0.36507s