DjangoAutoModels
自動入力フィールドを備えたDjango用のAbstract Model群です。
適応させたいモデルに継承させて使用します。
導入
-
ライブラリをインストールする。
pip install django-auto-models or pip install git+https://github.com/taogya/DjangoAutoModels.git
-
settings.pyに以下を追加する。INSTALLED_APPS = [ : 'django_auto_models' ]
-
継承したいModelを継承する。
# 例) 作成日時/更新日時を自動生成したい場合 from django_auto_models.models import AutoTimestampModel class YourModel(AutoTimestampModel): :
以下のように複数継承することもできます。
# 例) IDをBigAutoFieldと明示、作成日時/更新日時を自動生成したい場合 from django_auto_models.models import AutoTimestampModel, AutoIDModel class YourModel(AutoIDModel, AutoTimestampModel): :
-
migrateを行う。
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 の連番を格納 1 to 2,147,483,647 明示的にidがAutoFieldであると宣言 |
| ^ | AutoBigIDModel | id | AutoBigField | integer の連番を格納 1 to 9,223,372,036,854,775,807 明示的にidがAutoBigFieldであると宣言 |
| ^ | AutoUUIDModel | id | UUIDField | ランダム128bit UUIDを格納 3×10^17回生成して1%の確率で重複の可能性 |
補足
なし
Metadata
Release files for django-auto-models 1.0.1
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| django_auto_models-1.0.1.tar.gz | 3.9 kB | Without provenance | Details for django_auto_models-1.0.1.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| django_auto_models-1.0.1-py3-none-any.whl | Python 3 | none | any | Details for django_auto_models-1.0.1-py3-none-any.whl |
Total release size: 10.5 kB
Release files / django_auto_models-1.0.1.tar.gz
| Download URL | django_auto_models-1.0.1.tar.gz |
|---|---|
| Size | 3.9 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
564807d3573ff60390cbd9b02bcb91e066e7dcf7ef9e2e4d9ca512de4b84f7d9
|
|
BLAKE2b-256 checksum How to use checksums |
364b5960aaeaa6431fbb3df3f4e0bc4af3a89f0ddeb0ceb010be62fc62c73557
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/4.0.2 CPython/3.9.16
|
Release files / django_auto_models-1.0.1-py3-none-any.whl
| Download URL | django_auto_models-1.0.1-py3-none-any.whl |
|---|---|
| Size | 6.6 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
a5a725fac8fc20ac72091c8836b86103ac6930c8a686cc96aea6098489e90890
|
|
BLAKE2b-256 checksum How to use checksums |
1a9c610f784005de476422418160059f3782e56c9c4e46764fb18fb3dca4c46b
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/4.0.2 CPython/3.9.16
|
Security for django-auto-models 1.0.1
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.