Skip to main content

A Django app to generate model id based on a snowflake of twitter.

Project description

##Installation
1. Get the code: pip install uidgenerator-utils
2. Add "uidgenerator" to your INSTALLED_APPS


##Usage

* To use it in your model class:

```
from django.db import models
from uidgenerator.models import UIDField

class Tag(models.Model):
tag_id = UIDField(primary_key=True)
....
```

* if you want to change the default configuration, alter the parameter in settings:

```
UIDGENERATOR_START_TIMESTAMP = 1514736000000 #2018-1-1 0:0:0
UIDGENERATOR_REGIONIDBITS = 3
UIDGENERATOR_WORKERIDBITS = 10
UIDGENERATOR_SEQUENCEBITS = 10

UIDGENERATOR_REGIONID = 1
UIDGENERATOR_WORKERID = 1
```

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

uidgenerator_utils-0.2.tar.gz (2.8 kB view details)

Uploaded Source

File details

Details for the file uidgenerator_utils-0.2.tar.gz.

File metadata

File hashes

Hashes for uidgenerator_utils-0.2.tar.gz
Algorithm Hash digest
SHA256 23c2693d4b5c028d06bce6ca17de847d12e206c2a784f225fe841c7a4c679aee
MD5 9445f797bf95e2a3fb995a6807b4820d
BLAKE2b-256 e4c7fccf02dce4faf16f42a58e8f00b9db47b446657a269c4b9385ba01a302d2

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