Rudimentary but fully-functional entry permalink pages :3
This commit is contained in:
parent
d267df337f
commit
2b6691f8a5
13 changed files with 133 additions and 73 deletions
|
|
@ -6,7 +6,19 @@ app_name = 'entries'
|
|||
urlpatterns = []
|
||||
for k in kinds.all:
|
||||
index = k.plural + '_index'
|
||||
urlpatterns.extend((
|
||||
url(k.plural, views.index, name=index, kwargs={'kind': k}),
|
||||
))
|
||||
urlpatterns.append(
|
||||
url(r'^{k}$'.format(k=k.plural), views.index, name=index, kwargs={'kind': k})
|
||||
)
|
||||
breadcrumbs.add(app_name + ':' + index, label=k.plural, parent='home:index')
|
||||
|
||||
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)
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue