Django simple numerator, tests included
Project description
Django Numerators
Django Numerators track autonumber style inner_id for model record This repository contains a Numerator model utils to create nice formatted Inner ID.
Installation
$ pip install django-numerators
or
$ pip install git+https://github.com/sasriawesome/django_numerators.git#egg=django-numerators
Usage
from django.db import models
from django_numerators.models import NumeratorMixin, NumeratorReset
class Product(NumeratorMixin):
doc_prefix = 'PD'
name = models.CharField(max_length=100)
Usage with Polymorphic
install django-polymorphic
$ pip install django-polymorphic
Using Parent Model doc_prefix
from django.db import models
from polymorphic.models import PolymorphicModel
from django_numerators.models import NumeratorMixin, NumeratorReset
class Product(NumeratorMixin):
doc_prefix = 'PD'
parent_prefix = True
parent_model = 'Parent2'
name = models.CharField(max_length=100)
class Inventory(Product):
pass
class Asset(Product)
pass
Using Child Model doc prefix
class Product(NumeratorMixin):
name = models.CharField(max_length=100)
class Inventory(Product):
doc_prefix = 'INV'
class Asset(Product)
doc_prefix = 'AST'
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
File details
Details for the file django-numerators-0.0.2.tar.gz
.
File metadata
- Download URL: django-numerators-0.0.2.tar.gz
- Upload date:
- Size: 6.9 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/3.1.1 pkginfo/1.5.0.1 requests/2.22.0 setuptools/40.8.0 requests-toolbelt/0.9.1 tqdm/4.45.0 CPython/3.7.4
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | a96bb2a00aa0c684aa051c4edc1bdc440947ab5cdc22884af3c962a3444c522b |
|
MD5 | bb64440faf65ab8bb3b255bdfd1a92d6 |
|
BLAKE2b-256 | 84d558904825413a357daaf66bcf26dec0a24e277a0957d7cce1a927c6836a91 |
File details
Details for the file django_numerators-0.0.2-py3-none-any.whl
.
File metadata
- Download URL: django_numerators-0.0.2-py3-none-any.whl
- Upload date:
- Size: 7.9 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/3.1.1 pkginfo/1.5.0.1 requests/2.22.0 setuptools/40.8.0 requests-toolbelt/0.9.1 tqdm/4.45.0 CPython/3.7.4
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | ebd178c45fdd964277f956fe87d2aaa3866c87ca3dc37f82d51bf15e91516a3e |
|
MD5 | 51dd8add5e1a69b46341f0b9b136e565 |
|
BLAKE2b-256 | a507418c27e85d3b75e76311fd463d2d8bbf2908a5b5bdab885853e1e6ad2d34 |