Remove django-shorturls with my own implementation, since it's incompatible with Django 2 and unmaintained
This commit is contained in:
parent
27e0cb9a34
commit
098284a617
18 changed files with 252 additions and 184 deletions
15
lemonshort/convert.py
Normal file
15
lemonshort/convert.py
Normal 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)
|
||||
Loading…
Add table
Add a link
Reference in a new issue