edc-list-data


Nameedc-list-data JSON
Version 0.3.26 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-02-22 07:27:04
maintainer
docs_urlNone
authorErik van Widenfelt
requires_python>=3.11
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": "",
    "docs_url": null,
    "requires_python": ">=3.11",
    "maintainer_email": "",
    "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/f7/4d/20242c8cee9af830a8d6af6af3b1d0ae3ca7162081b6acf769b63d690fa4/edc-list-data-0.3.26.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.26",
    "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": "89bcb56fba9913ff80aed2258542719bf9d8e1c8e739c893b68807c668928f48",
                "md5": "e013c76da122ade0031cc4a8d502c5a8",
                "sha256": "a7a4509aea39349106cdb360a55382c51f0f416523e48ed7e120d6802c1c6c9d"
            },
            "downloads": -1,
            "filename": "edc_list_data-0.3.26-py3-none-any.whl",
            "has_sig": false,
            "md5_digest": "e013c76da122ade0031cc4a8d502c5a8",
            "packagetype": "bdist_wheel",
            "python_version": "py3",
            "requires_python": ">=3.11",
            "size": 37077,
            "upload_time": "2024-02-22T07:27:02",
            "upload_time_iso_8601": "2024-02-22T07:27:02.831698Z",
            "url": "https://files.pythonhosted.org/packages/89/bc/b56fba9913ff80aed2258542719bf9d8e1c8e739c893b68807c668928f48/edc_list_data-0.3.26-py3-none-any.whl",
            "yanked": false,
            "yanked_reason": null
        },
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "f74d20242c8cee9af830a8d6af6af3b1d0ae3ca7162081b6acf769b63d690fa4",
                "md5": "23d446a007ff2cc19dff61575162d17b",
                "sha256": "f0db30fea7bd4966925bf248293215c276758c26aeae6ae26e88086d6ee68f27"
            },
            "downloads": -1,
            "filename": "edc-list-data-0.3.26.tar.gz",
            "has_sig": false,
            "md5_digest": "23d446a007ff2cc19dff61575162d17b",
            "packagetype": "sdist",
            "python_version": "source",
            "requires_python": ">=3.11",
            "size": 34776,
            "upload_time": "2024-02-22T07:27:04",
            "upload_time_iso_8601": "2024-02-22T07:27:04.872336Z",
            "url": "https://files.pythonhosted.org/packages/f7/4d/20242c8cee9af830a8d6af6af3b1d0ae3ca7162081b6acf769b63d690fa4/edc-list-data-0.3.26.tar.gz",
            "yanked": false,
            "yanked_reason": null
        }
    ],
    "upload_time": "2024-02-22 07:27:04",
    "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.18582s