2017-10-24 21:01:52 -04:00
|
|
|
from django.conf.urls import url
|
|
|
|
from . import kinds, views
|
|
|
|
from lemoncurry import breadcrumbs
|
|
|
|
|
|
|
|
app_name = 'entries'
|
|
|
|
urlpatterns = []
|
|
|
|
for k in kinds.all:
|
|
|
|
index = k.plural + '_index'
|
2017-10-24 21:31:08 -04:00
|
|
|
urlpatterns.append(
|
|
|
|
url(r'^{k}$'.format(k=k.plural), views.index, name=index, kwargs={'kind': k})
|
|
|
|
)
|
2017-10-24 21:01:52 -04:00
|
|
|
breadcrumbs.add(app_name + ':' + index, label=k.plural, parent='home:index')
|
2017-10-24 21:31:08 -04:00
|
|
|
|
|
|
|
entry = k.plural + '_entry'
|
|
|
|
pattern = r'^{k}/(?P<id>\d+)'.format(k=k.plural)
|
|
|
|
urlpatterns.append(
|
|
|
|
url(pattern + '$', views.entry, name=entry)
|
|
|
|
)
|
|
|
|
breadcrumbs.add(app_name + ':' + entry, parent=app_name + ':' + index)
|
|
|
|
if k.has('slug'):
|
|
|
|
urlpatterns.append(
|
|
|
|
url(pattern + r'/(?P<slug>.+)$', views.entry, name=entry + '_slug')
|
|
|
|
)
|
|
|
|
breadcrumbs.add(app_name + ':' + entry + '_slug', parent=app_name + ':' + index)
|