Remove django-shorturls with my own implementation, since it's incompatible with Django 2 and unmaintained

This commit is contained in:
Danielle McLean 2018-03-21 21:50:40 +11:00
parent 27e0cb9a34
commit 098284a617
Signed by: 00dani
GPG key ID: 5A5D2D1AFF12EEC5
18 changed files with 252 additions and 184 deletions

15
lemonshort/convert.py Normal file
View file

@ -0,0 +1,15 @@
from baseconv import BaseConverter
from string import ascii_lowercase, ascii_uppercase
# We have to create this collection ourselves because we want uppercase then
# lowercase, and string.ascii_letters is lowercase then uppercase.
chars = ascii_uppercase + ascii_lowercase
conv = BaseConverter(chars)
def abc_to_id(abc):
return int(conv.decode(abc))
def id_to_abc(id):
return conv.encode(id)