A tiny, secure, URL-friendly, unique string ID generator support in Django
Project description
django-nanoid
A tiny, secure, URL-friendly, unique string ID generator for Python. support in Django.
Status
This project is actively maintained.
Installation
To install django-nanoid from pip:
$ pip install django-nanoid
To install nanoid from source:
$ git clone git@github.com:yosephbernandus/django-nanoid.git
$ cd django-nanoid && python setup.py install
Usage
Adding a NANOID field to your Django models is straightforward, default length is 21. Can adjust the length using max_length
from django.db import models
from django_nanoid.models import NANOIDField
class Post(models.Model):
id = NANOIDField(secure_generated=True, editable=False)
Passing this will automatically generate a unique identifier, with secure generated
from django.db import models
from django_nanoid.models import NANOIDField
class Post(models.Model):
post_identifier = NANOIDField(size=10, alphabetically='mnhjksloiwnhA..!@$$$!#', secure_generated=False)
Passing this will automatically generate a unique identifier, with non_secure_generated with custom alphabetically and length
Contributing
If you would like to contribute, simply fork the repository, push your changes and send a pull request.
Pull requests will be brought into the master
branch via a rebase and fast-forward merge with the goal of having a linear branch history with no merge commits.
License
Dependencies
Changelog
Version 0.0.2 (2023-10-19)
- Support nanoid prefix. Thanks lodye509!
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-nanoid-0.0.2.tar.gz
.
File metadata
- Download URL: django-nanoid-0.0.2.tar.gz
- Upload date:
- Size: 7.4 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/4.0.2 CPython/3.7.12
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 68bd7b61ba6ea9beac4f945dcfe6718cfe9492440299818c7c7ce3ca433e3cfd |
|
MD5 | 0e8034aef098055a2d3d83aea789f314 |
|
BLAKE2b-256 | 83732b07a7bc1c8a2d896e21ca82fe52c6fa177cb7fe91a1db11270011a66569 |
File details
Details for the file django_nanoid-0.0.2-py3-none-any.whl
.
File metadata
- Download URL: django_nanoid-0.0.2-py3-none-any.whl
- Upload date:
- Size: 8.1 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/4.0.2 CPython/3.7.12
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | fa81d92bf4bc171a71226d983bee1501679407a50c627f906f38449182e79907 |
|
MD5 | 2b9de5ed49521db49dcb9cdb1ff78c8b |
|
BLAKE2b-256 | a87fb2467687bb43a07d9210a50c29002d9827519346a8781ec37294aab9659b |