edc-form-label


Nameedc-form-label JSON
Version 0.3.18 PyPI version JSON
download
home_pagehttps://github.com/clinicedc/edc-form-label
SummaryCustomize Django form label in realtime in clinicedc/edc projects
upload_time2024-03-26 04:59:10
maintainerNone
docs_urlNone
authorErik van Widenfelt
requires_python>=3.11
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.11",
    "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/47/66/7af4878709fbfceb05058761966afd755315c91b39a2060368f29107b67c/edc-form-label-0.3.18.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.18",
    "project_urls": {
        "Homepage": "https://github.com/clinicedc/edc-form-label"
    },
    "split_keywords": [
        "django edc modelform",
        " clinicedc",
        " clinical trials"
    ],
    "urls": [
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "aedbb1796302307c7485b6c1ec6329c37fc81258983c1f17f07a7b9becb9f892",
                "md5": "4127c01ea59376017c612eb7ca384e22",
                "sha256": "172748f2c01147982e683be01e463a584eae9f2d212ba3a2e430702d8f8d6129"
            },
            "downloads": -1,
            "filename": "edc_form_label-0.3.18-py3-none-any.whl",
            "has_sig": false,
            "md5_digest": "4127c01ea59376017c612eb7ca384e22",
            "packagetype": "bdist_wheel",
            "python_version": "py3",
            "requires_python": ">=3.11",
            "size": 29469,
            "upload_time": "2024-03-26T04:59:08",
            "upload_time_iso_8601": "2024-03-26T04:59:08.590404Z",
            "url": "https://files.pythonhosted.org/packages/ae/db/b1796302307c7485b6c1ec6329c37fc81258983c1f17f07a7b9becb9f892/edc_form_label-0.3.18-py3-none-any.whl",
            "yanked": false,
            "yanked_reason": null
        },
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "47667af4878709fbfceb05058761966afd755315c91b39a2060368f29107b67c",
                "md5": "0371db1b2df94165c61b3f9fa83d75af",
                "sha256": "e1c07c5edf074a80131651e81109a75703dc97e7c075c104dc0c1df4ebf460a3"
            },
            "downloads": -1,
            "filename": "edc-form-label-0.3.18.tar.gz",
            "has_sig": false,
            "md5_digest": "0371db1b2df94165c61b3f9fa83d75af",
            "packagetype": "sdist",
            "python_version": "source",
            "requires_python": ">=3.11",
            "size": 30491,
            "upload_time": "2024-03-26T04:59:10",
            "upload_time_iso_8601": "2024-03-26T04:59:10.543546Z",
            "url": "https://files.pythonhosted.org/packages/47/66/7af4878709fbfceb05058761966afd755315c91b39a2060368f29107b67c/edc-form-label-0.3.18.tar.gz",
            "yanked": false,
            "yanked_reason": null
        }
    ],
    "upload_time": "2024-03-26 04:59:10",
    "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.39771s