lemoncurry/lemonshort/urls.py

13 lines
367 B
Python

from django.conf import settings
from django.urls import path, register_converter
from .convert import AbcIdConverter
from .views import unshort
register_converter(AbcIdConverter, "abc_id")
app_name = "lemonshort"
urlpatterns = tuple(
path("{0!s}<abc_id:tiny>".format(k), unshort, name=m, kwargs={"model": m})
for k, m in settings.SHORTEN_MODELS.items()
)