edc-list-data


Nameedc-list-data JSON
Version 0.3.27 PyPI version JSON
download
home_pagehttps://github.com/clinicedc/edc-list-data
SummaryPopulate list data and other static model data on startup in clinicedc/edc projects
upload_time2024-11-20 22:43:22
maintainerNone
docs_urlNone
authorErik van Widenfelt
requires_python>=3.12
licenseGPL license, see LICENSE
keywords django edc list data crf clinicedc clinical trials
VCS
bugtrack_url
requirements No requirements were recorded.
Travis-CI No Travis.
coveralls test coverage
            |pypi| |actions| |coverage|

edc-list-data
-------------

Populate list data and other static model data on ``Django`` startup.

To install add ``edc_list_data.apps.AppConfig`` to your `INSTALLED_APPS`, then create a ``list_data.py`` in the root of your app.

Most commonly used to populate M2M data known here as ``list_data``. M2M field models should use the ``ListModelMixin``.

The list models are populated using a ``post_migrate`` signal. Once everything is configured
or after changes are made, you need to run ``python manage.py migrate``.

For example:

.. code-block:: python

	class Antibiotic(ListModelMixin, BaseUuidModel):

	    class Meta(ListModelMixin.Meta):
	        pass


An example ``list_data.py``:


.. code-block:: python

	from edc_constants.constants import OTHER

	list_data = {
	    'my_lists_app.antibiotic': [
	        ('flucloxacillin', 'Flucloxacillin'),
	        ('gentamicin', 'Gentamicin'),
	        ('ceftriaxone', 'Ceftriaxone'),
	        ('amoxicillin_ampicillin', 'Amoxicillin/Ampicillin'),
	        ('doxycycline', 'Doxycycline'),
	        ('erythromycin', 'Erythromycin'),
	        ('ciprofloxacin', 'Ciprofloxacin'),
	        (OTHER, 'Other, specify')
	    ],
	}

Now run:
    >>> python manage.py migrate


The list data will be populated in the order in which the list items are declared.

See also call to ``site_list_data.autodiscover`` and ``site_list_data.load_data`` called in ``edc_list_data.apps.AppConfig``
using a ``post_migrate`` signal.



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

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

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

            

Raw data

            {
    "_id": null,
    "home_page": "https://github.com/clinicedc/edc-list-data",
    "name": "edc-list-data",
    "maintainer": null,
    "docs_url": null,
    "requires_python": ">=3.12",
    "maintainer_email": null,
    "keywords": "django Edc list data, CRF, clinicedc, clinical trials",
    "author": "Erik van Widenfelt",
    "author_email": "ew2789@gmail.com",
    "download_url": "https://files.pythonhosted.org/packages/7b/2a/0ca2fb6badf5211ba62c2108d5c0db7adb81fec3b73667b34c896c500291/edc_list_data-0.3.27.tar.gz",
    "platform": null,
    "description": "|pypi| |actions| |coverage|\n\nedc-list-data\n-------------\n\nPopulate list data and other static model data on ``Django`` startup.\n\nTo install add ``edc_list_data.apps.AppConfig`` to your `INSTALLED_APPS`, then create a ``list_data.py`` in the root of your app.\n\nMost commonly used to populate M2M data known here as ``list_data``. M2M field models should use the ``ListModelMixin``.\n\nThe list models are populated using a ``post_migrate`` signal. Once everything is configured\nor after changes are made, you need to run ``python manage.py migrate``.\n\nFor example:\n\n.. code-block:: python\n\n\tclass Antibiotic(ListModelMixin, BaseUuidModel):\n\n\t    class Meta(ListModelMixin.Meta):\n\t        pass\n\n\nAn example ``list_data.py``:\n\n\n.. code-block:: python\n\n\tfrom edc_constants.constants import OTHER\n\n\tlist_data = {\n\t    'my_lists_app.antibiotic': [\n\t        ('flucloxacillin', 'Flucloxacillin'),\n\t        ('gentamicin', 'Gentamicin'),\n\t        ('ceftriaxone', 'Ceftriaxone'),\n\t        ('amoxicillin_ampicillin', 'Amoxicillin/Ampicillin'),\n\t        ('doxycycline', 'Doxycycline'),\n\t        ('erythromycin', 'Erythromycin'),\n\t        ('ciprofloxacin', 'Ciprofloxacin'),\n\t        (OTHER, 'Other, specify')\n\t    ],\n\t}\n\nNow run:\n    >>> python manage.py migrate\n\n\nThe list data will be populated in the order in which the list items are declared.\n\nSee also call to ``site_list_data.autodiscover`` and ``site_list_data.load_data`` called in ``edc_list_data.apps.AppConfig``\nusing a ``post_migrate`` signal.\n\n\n\n.. |pypi| image:: https://img.shields.io/pypi/v/edc-list-data.svg\n    :target: https://pypi.python.org/pypi/edc-list-data\n\n.. |actions| image:: https://github.com/clinicedc/edc-list-data/actions/workflows/build.yml/badge.svg\n  :target: https://github.com/clinicedc/edc-list-data/actions/workflows/build.yml\n\n.. |coverage| image:: https://coveralls.io/repos/github/clinicedc/edc-list-data/badge.svg?branch=develop\n    :target: https://coveralls.io/github/clinicedc/edc-list-data?branch=develop\n",
    "bugtrack_url": null,
    "license": "GPL license, see LICENSE",
    "summary": "Populate list data and other static model data on startup in clinicedc/edc projects",
    "version": "0.3.27",
    "project_urls": {
        "Homepage": "https://github.com/clinicedc/edc-list-data"
    },
    "split_keywords": [
        "django edc list data",
        " crf",
        " clinicedc",
        " clinical trials"
    ],
    "urls": [
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "dc52233b8bb55f7940728d39db586842f2150d3a12cc291909ac17c52d04acfb",
                "md5": "f5c22de24ebb99b9859612a36ef899b9",
                "sha256": "a5ec95d105a728fc77d1bc9e6af8dc187401098dc7becddb25abd129cfa85bd8"
            },
            "downloads": -1,
            "filename": "edc_list_data-0.3.27-py3-none-any.whl",
            "has_sig": false,
            "md5_digest": "f5c22de24ebb99b9859612a36ef899b9",
            "packagetype": "bdist_wheel",
            "python_version": "py3",
            "requires_python": ">=3.12",
            "size": 37077,
            "upload_time": "2024-11-20T22:43:20",
            "upload_time_iso_8601": "2024-11-20T22:43:20.826522Z",
            "url": "https://files.pythonhosted.org/packages/dc/52/233b8bb55f7940728d39db586842f2150d3a12cc291909ac17c52d04acfb/edc_list_data-0.3.27-py3-none-any.whl",
            "yanked": false,
            "yanked_reason": null
        },
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "7b2a0ca2fb6badf5211ba62c2108d5c0db7adb81fec3b73667b34c896c500291",
                "md5": "35d9bb72b43ed4025c7b42a47c4c1eb0",
                "sha256": "043e44ca7fd43e2ea52390f541b26b55a68fafd2133a9509d17ccaec4613380b"
            },
            "downloads": -1,
            "filename": "edc_list_data-0.3.27.tar.gz",
            "has_sig": false,
            "md5_digest": "35d9bb72b43ed4025c7b42a47c4c1eb0",
            "packagetype": "sdist",
            "python_version": "source",
            "requires_python": ">=3.12",
            "size": 34900,
            "upload_time": "2024-11-20T22:43:22",
            "upload_time_iso_8601": "2024-11-20T22:43:22.487481Z",
            "url": "https://files.pythonhosted.org/packages/7b/2a/0ca2fb6badf5211ba62c2108d5c0db7adb81fec3b73667b34c896c500291/edc_list_data-0.3.27.tar.gz",
            "yanked": false,
            "yanked_reason": null
        }
    ],
    "upload_time": "2024-11-20 22:43:22",
    "github": true,
    "gitlab": false,
    "bitbucket": false,
    "codeberg": false,
    "github_user": "clinicedc",
    "github_project": "edc-list-data",
    "travis_ci": false,
    "coveralls": true,
    "github_actions": true,
    "lcname": "edc-list-data"
}
        
Elapsed time: 0.40411s