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:
|
2017-10-24 21:31:08 -04:00
|
|
|
urlpatterns.append(
|
2017-10-25 18:01:36 -04:00
|
|
|
url(r'^{k}$'.format(k=k.plural), views.index, name=k.index, kwargs={'kind': k})
|
2017-10-24 21:31:08 -04:00
|
|
|
)
|
2017-10-25 18:01:36 -04:00
|
|
|
breadcrumbs.add(app_name + ':' + k.index, label=k.plural, parent='home:index')
|
2017-10-24 21:31:08 -04:00
|
|
|
|
|
|
|
pattern = r'^{k}/(?P<id>\d+)'.format(k=k.plural)
|
|
|
|
urlpatterns.append(
|
2017-10-25 18:01:36 -04:00
|
|
|
url(pattern + '$', views.entry, name=k.entry)
|
2017-10-24 21:31:08 -04:00
|
|
|
)
|
2017-10-25 18:01:36 -04:00
|
|
|
breadcrumbs.add(app_name + ':' + k.entry, parent=app_name + ':' + k.index)
|
2017-10-24 21:31:08 -04:00
|
|
|
if k.has('slug'):
|
|
|
|
urlpatterns.append(
|
2017-10-25 18:01:36 -04:00
|
|
|
url(pattern + r'/(?P<slug>.+)$', views.entry, name=k.entry_slug)
|
2017-10-24 21:31:08 -04:00
|
|
|
)
|
2017-10-25 18:01:36 -04:00
|
|
|
breadcrumbs.add(app_name + ':' + k.entry_slug, parent=app_name + ':' + k.index)
|