Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

django-shortuuidfield

Package Overview
Dependencies
Maintainers
1
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

django-shortuuidfield

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

  • 0.1.3
  • PyPI
  • Socket score

Maintainers
1

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

FAQs


Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc