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
django-numerators-0.0.1.tar.gz
(11.4 kB
view hashes)
Built Distribution
Close
Hashes for django_numerators-0.0.1-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 258b0276a07dd4bd45942d1e23b0e095c36e22cb0650bb1fe393f606feb3d0ac |
|
MD5 | cb8ba2c2917f81363c47091cd7a4ea3f |
|
BLAKE2b-256 | 07488234d4fe8314228a024d81d4242a075a43b19c60804c4b1173e70187ab0e |