Skip to main content

Short UUIDField for Django. Good for use in urls & file names. (Base 57, 22 characters)

Project description

django-shortuuidfield
----------------

Provides a ShortUUIDField for your Django models which uses the base-57 "Short UUID" package at https://github.com/stochastic-technologies/shortuuid/ .

Originally, a fork from David Cramer's excellent django-uuidfield, but not much is left of that besides a bit of structure.

Installation
============

Install it with pip (or easy_install)::

pip install django-shortuuidfield

Usage
=====

First you'll need to attach a ShortUUIDField to your class. This acts as a char(22) to maintain compatibility with SQL versions::

from shortuuidfield import ShortUUIDField

class MyModel(models.Model):
uuid = ShortUUIDField()

Enjoy!

Notes
=====

* ShortUUIDField is a subclass of django.db.models.CharField

* You can pass usual Django CharField parameters on init, although some of them are added/overwritten:
+ max_length=22 (since we are using base-57 format which is fixed at 22 characters)
+ blank=True, editable=False (set auto=False to remove these fields enforcement)

* Uses shortuuid.uuid() that generates uuid4 random values

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

django-shortuuidfield-0.1.3.tar.gz (3.4 kB view details)

Uploaded Source

File details

Details for the file django-shortuuidfield-0.1.3.tar.gz.

File metadata

File hashes

Hashes for django-shortuuidfield-0.1.3.tar.gz
Algorithm Hash digest
SHA256 a292c0fe5538abe947b131e2b914edd9ac44afcc6a40eaec71448e6231a3ef00
MD5 51fd3e8c8f2b9e314dba1c997e345d38
BLAKE2b-256 7c01e192e8be3bdbcbfc63b9f4c33dbe874badd0bb49416fd98a20928fc3739b

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page