Skip to main content

A extension abstract Model from django.db.models.Model

Project description

oceanho-dj-share-lib 是个人(OceanHo)的 django 通用 library, 包括 model, utils, middleware, validators 等等.

Quick start

  1. Define your models like this:

    import django.db.models
    from oceanho.dj.share.models import BigPkModel
    from oceanho.dj.share.models import HasCreationState
    from oceanho.dj.share.models import HasModificationState
    from oceanho.dj.share.models import HasSoftDeletionState
    from oceanho.dj.share.models import HasTenantIdState
    from oceanho.dj.share.models import HasActivationState
    
    class MyUser(BigIntPKAbstractModel, HasCreationState):
        email = models.CharField(max_length=200)
  2. Execute ./manage.py makemigrations && ./mange.py migrate, then go to your db, your tables like this:

    +------------+--------------+------+-----+---------+----------------+
    | Field      | Type         | Null | Key | Default | Extra          |
    +------------+--------------+------+-----+---------+----------------+
    | id         | bigint       | NO   | PRI | NULL    | auto_increment |
    | created_at | datetime(6)  | NO   |     | NULL    |                |
    | name       | varchar(200) | NO   |     | NULL    |                |
    +------------+--------------+------+-----+---------+----------------+

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

oceanho-dj-share-lib-0.7.tar.gz (2.2 kB view details)

Uploaded Source

File details

Details for the file oceanho-dj-share-lib-0.7.tar.gz.

File metadata

  • Download URL: oceanho-dj-share-lib-0.7.tar.gz
  • Upload date:
  • Size: 2.2 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.2.0 pkginfo/1.5.0.1 requests/2.24.0 setuptools/47.1.1 requests-toolbelt/0.9.1 tqdm/4.47.0 CPython/3.7.7

File hashes

Hashes for oceanho-dj-share-lib-0.7.tar.gz
Algorithm Hash digest
SHA256 9ccb673ac5a8a58c775f5cc94b0c9b92538d3234f1b8482da12df1864d527a52
MD5 94aa3f5a7cca66ae28387fac3bdef885
BLAKE2b-256 3157445142672c52aeb15cd524bfecc628515b5a263c899fc4ddce9f1103d59b

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page