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.

Files for uidgenerator-utils, version 0.4.1
Filename, size File type Python version Upload date Hashes
Filename, size uidgenerator_utils-0.4.1.tar.gz (2.9 kB) File type Source Python version None Upload date Hashes View

Supported by

AWS AWS Cloud computing Datadog Datadog Monitoring DigiCert DigiCert EV certificate Facebook / Instagram Facebook / Instagram PSF Sponsor Fastly Fastly CDN Google Google Object Storage and Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Salesforce Salesforce PSF Sponsor Sentry Sentry Error logging StatusPage StatusPage Status page