django-auto-models


Namedjango-auto-models JSON
Version 1.0.1 PyPI version JSON
download
home_page
SummaryModels with auto input fields for Django
upload_time2023-09-02 13:32:59
maintainer
docs_urlNone
author
requires_python>=3.9
licenseBSD 3-Clause License Copyright (c) 2023, Taogya Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met: 1. Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer. 2. Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution. 3. Neither the name of the copyright holder nor the names of its contributors may be used to endorse or promote products derived from this software without specific prior written permission. THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
keywords
VCS
bugtrack_url
requirements No requirements were recorded.
Travis-CI No Travis.
coveralls test coverage No coveralls.
            [en](README_en.md)

# DjangoAutoModels
自動入力フィールドを備えたDjango用のAbstract Model群です。  
適応させたいモデルに継承させて使用します。

## 導入
1. ライブラリをインストールする。
    ```sh
    pip install django-auto-models
     or
    pip install git+https://github.com/taogya/DjangoAutoModels.git
    ```
1. `settings.py`に以下を追加する。
    ```python
    INSTALLED_APPS = [
        :
        'django_auto_models'
    ]
    ```
1. 継承したいModelを継承する。
    ```python
    # 例) 作成日時/更新日時を自動生成したい場合
    from django_auto_models.models import AutoTimestampModel

    class YourModel(AutoTimestampModel):
        :
    ```

    以下のように複数継承することもできます。
    ```python
    # 例) IDをBigAutoFieldと明示、作成日時/更新日時を自動生成したい場合
    from django_auto_models.models import AutoTimestampModel, AutoIDModel

    class YourModel(AutoIDModel, AutoTimestampModel):
        :
    ```
1. migrateを行う。
    ```python
    python manage.py makemigrations
    python manage.py migrate
    ```

## Models
|カテゴリ|モデル名|カラム|フィールド|説明|
|---|---|---|---|---|
|datetime|AutoCreatedAtModel|created_at|DateTimeField|createした日時を格納|
|^       |AutoUpdateAtModel |updated_at|DateTimeField|create/updateした日時を格納|
|^       |AutoTimestampModel|created_at|DateTimeField|createした日時を格納|
|^       |^                 |updated_at|DateTimeField|create/updateした日時を格納|
|id|AutoIDModel   |id|AutoField    |integer の連番を格納<br>1 to 2,147,483,647<br>明示的にidがAutoFieldであると宣言|
|^ |AutoBigIDModel|id|AutoBigField |integer の連番を格納<br>1 to 9,223,372,036,854,775,807<br>明示的にidがAutoBigFieldであると宣言|
|^ |AutoUUIDModel |id|UUIDField    |ランダム128bit UUIDを格納<br>3×10^17回生成して1%の確率で重複の可能性|

## 補足
なし
            

Raw data

            {
    "_id": null,
    "home_page": "",
    "name": "django-auto-models",
    "maintainer": "",
    "docs_url": null,
    "requires_python": ">=3.9",
    "maintainer_email": "",
    "keywords": "",
    "author": "",
    "author_email": "Taogya <132679709+taogya@users.noreply.github.com>",
    "download_url": "https://files.pythonhosted.org/packages/36/4b/5960aaeaa6431fbb3df3f4e0bc4af3a89f0ddeb0ceb010be62fc62c73557/django_auto_models-1.0.1.tar.gz",
    "platform": null,
    "description": "[en](README_en.md)\n\n# DjangoAutoModels\n\u81ea\u52d5\u5165\u529b\u30d5\u30a3\u30fc\u30eb\u30c9\u3092\u5099\u3048\u305fDjango\u7528\u306eAbstract Model\u7fa4\u3067\u3059\u3002  \n\u9069\u5fdc\u3055\u305b\u305f\u3044\u30e2\u30c7\u30eb\u306b\u7d99\u627f\u3055\u305b\u3066\u4f7f\u7528\u3057\u307e\u3059\u3002\n\n## \u5c0e\u5165\n1. \u30e9\u30a4\u30d6\u30e9\u30ea\u3092\u30a4\u30f3\u30b9\u30c8\u30fc\u30eb\u3059\u308b\u3002\n    ```sh\n    pip install django-auto-models\n     or\n    pip install git+https://github.com/taogya/DjangoAutoModels.git\n    ```\n1. `settings.py`\u306b\u4ee5\u4e0b\u3092\u8ffd\u52a0\u3059\u308b\u3002\n    ```python\n    INSTALLED_APPS = [\n        :\n        'django_auto_models'\n    ]\n    ```\n1. \u7d99\u627f\u3057\u305f\u3044Model\u3092\u7d99\u627f\u3059\u308b\u3002\n    ```python\n    # \u4f8b) \u4f5c\u6210\u65e5\u6642/\u66f4\u65b0\u65e5\u6642\u3092\u81ea\u52d5\u751f\u6210\u3057\u305f\u3044\u5834\u5408\n    from django_auto_models.models import AutoTimestampModel\n\n    class YourModel(AutoTimestampModel):\n        :\n    ```\n\n    \u4ee5\u4e0b\u306e\u3088\u3046\u306b\u8907\u6570\u7d99\u627f\u3059\u308b\u3053\u3068\u3082\u3067\u304d\u307e\u3059\u3002\n    ```python\n    # \u4f8b) ID\u3092BigAutoField\u3068\u660e\u793a\u3001\u4f5c\u6210\u65e5\u6642/\u66f4\u65b0\u65e5\u6642\u3092\u81ea\u52d5\u751f\u6210\u3057\u305f\u3044\u5834\u5408\n    from django_auto_models.models import AutoTimestampModel, AutoIDModel\n\n    class YourModel(AutoIDModel, AutoTimestampModel):\n        :\n    ```\n1. migrate\u3092\u884c\u3046\u3002\n    ```python\n    python manage.py makemigrations\n    python manage.py migrate\n    ```\n\n## Models\n|\u30ab\u30c6\u30b4\u30ea|\u30e2\u30c7\u30eb\u540d|\u30ab\u30e9\u30e0|\u30d5\u30a3\u30fc\u30eb\u30c9|\u8aac\u660e|\n|---|---|---|---|---|\n|datetime|AutoCreatedAtModel|created_at|DateTimeField|create\u3057\u305f\u65e5\u6642\u3092\u683c\u7d0d|\n|^       |AutoUpdateAtModel |updated_at|DateTimeField|create/update\u3057\u305f\u65e5\u6642\u3092\u683c\u7d0d|\n|^       |AutoTimestampModel|created_at|DateTimeField|create\u3057\u305f\u65e5\u6642\u3092\u683c\u7d0d|\n|^       |^                 |updated_at|DateTimeField|create/update\u3057\u305f\u65e5\u6642\u3092\u683c\u7d0d|\n|id|AutoIDModel   |id|AutoField    |integer \u306e\u9023\u756a\u3092\u683c\u7d0d<br>1 to 2,147,483,647<br>\u660e\u793a\u7684\u306bid\u304cAutoField\u3067\u3042\u308b\u3068\u5ba3\u8a00|\n|^ |AutoBigIDModel|id|AutoBigField |integer \u306e\u9023\u756a\u3092\u683c\u7d0d<br>1 to 9,223,372,036,854,775,807<br>\u660e\u793a\u7684\u306bid\u304cAutoBigField\u3067\u3042\u308b\u3068\u5ba3\u8a00|\n|^ |AutoUUIDModel |id|UUIDField    |\u30e9\u30f3\u30c0\u30e0128bit UUID\u3092\u683c\u7d0d<br>3\u00d710^17\u56de\u751f\u6210\u3057\u30661%\u306e\u78ba\u7387\u3067\u91cd\u8907\u306e\u53ef\u80fd\u6027|\n\n## \u88dc\u8db3\n\u306a\u3057",
    "bugtrack_url": null,
    "license": "BSD 3-Clause License  Copyright (c) 2023, Taogya  Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met:  1. Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer.  2. Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution.  3. Neither the name of the copyright holder nor the names of its contributors may be used to endorse or promote products derived from this software without specific prior written permission.  THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS \"AS IS\" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.",
    "summary": "Models with auto input fields for Django",
    "version": "1.0.1",
    "project_urls": {
        "Bug Tracker": "https://github.com/taogya/DjangoAutoModels/issues",
        "Homepage": "https://github.com/taogya/DjangoAutoModels"
    },
    "split_keywords": [],
    "urls": [
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "1a9c610f784005de476422418160059f3782e56c9c4e46764fb18fb3dca4c46b",
                "md5": "a15d01ce53d5d793d1d3f3024e752b8f",
                "sha256": "a5a725fac8fc20ac72091c8836b86103ac6930c8a686cc96aea6098489e90890"
            },
            "downloads": -1,
            "filename": "django_auto_models-1.0.1-py3-none-any.whl",
            "has_sig": false,
            "md5_digest": "a15d01ce53d5d793d1d3f3024e752b8f",
            "packagetype": "bdist_wheel",
            "python_version": "py3",
            "requires_python": ">=3.9",
            "size": 6642,
            "upload_time": "2023-09-02T13:32:57",
            "upload_time_iso_8601": "2023-09-02T13:32:57.116858Z",
            "url": "https://files.pythonhosted.org/packages/1a/9c/610f784005de476422418160059f3782e56c9c4e46764fb18fb3dca4c46b/django_auto_models-1.0.1-py3-none-any.whl",
            "yanked": false,
            "yanked_reason": null
        },
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "364b5960aaeaa6431fbb3df3f4e0bc4af3a89f0ddeb0ceb010be62fc62c73557",
                "md5": "0fc14cc2336de8987136ff0834a8664b",
                "sha256": "564807d3573ff60390cbd9b02bcb91e066e7dcf7ef9e2e4d9ca512de4b84f7d9"
            },
            "downloads": -1,
            "filename": "django_auto_models-1.0.1.tar.gz",
            "has_sig": false,
            "md5_digest": "0fc14cc2336de8987136ff0834a8664b",
            "packagetype": "sdist",
            "python_version": "source",
            "requires_python": ">=3.9",
            "size": 3854,
            "upload_time": "2023-09-02T13:32:59",
            "upload_time_iso_8601": "2023-09-02T13:32:59.506027Z",
            "url": "https://files.pythonhosted.org/packages/36/4b/5960aaeaa6431fbb3df3f4e0bc4af3a89f0ddeb0ceb010be62fc62c73557/django_auto_models-1.0.1.tar.gz",
            "yanked": false,
            "yanked_reason": null
        }
    ],
    "upload_time": "2023-09-02 13:32:59",
    "github": true,
    "gitlab": false,
    "bitbucket": false,
    "codeberg": false,
    "github_user": "taogya",
    "github_project": "DjangoAutoModels",
    "github_not_found": true,
    "lcname": "django-auto-models"
}
        
Elapsed time: 0.46681s