tabo / django-treebeard

Efficient tree implementations for Django 1.0+ :: https://tabo.pe/projects/django-treebeard/

Clone this repository (size: 528.3 KB): HTTPS / SSH
$ hg clone http://code.tabo.pe/django-treebeard
commit 257: 0f2a87d336ee
parent 236: f45c785ede80
parent 256: b38bf3705bca
branch: 1.6.X
tags: tip
merging from 1.61 tag to 1.6.X branch
Gustavo Picon / tabo
7 weeks ago
r257:0f2a87d336ee 30 loc 1.0 KB embed / history / annotate / raw /
import os
from django.contrib import admin
from django.conf.urls.defaults import *
import treebeard
from tbexample.views import convo, load_random_data, delete_node, delete_all
from tbexample.views import choose

admin.autodiscover()

baseurl = r'^(?P<treetype>mp|al|ns)/'
lurls = [
    (r'loaddata/$', load_random_data, 'load-data'),
    (r'delete_all/$', delete_all, 'delete-all'),
    (r'(?P<node_id>\d+)/delete/$', delete_node, 'delete-node'),
    (r'(?P<node_id>\d+)/reply/$', convo, 'reply-view'),
    (r'(?P<node_id>\d+)/$', convo, 'node-view'),
    (r'$', convo, 'main-view')
]

path = os.path.dirname(treebeard.__file__)
static_path = os.path.normpath(os.path.join(path, 'static/'))

urlpatterns = patterns('',
    (r'^admin/', include(admin.site.urls)),
    (r'^static/(?P<path>.*)$', 'django.views.static.serve',
        {'document_root': static_path, 'show_indexes': True}))

for pat, view, name in lurls:
    urlpatterns += patterns('', url('%s%s' % (baseurl, pat), view, name=name))
urlpatterns += patterns('', url('^$', choose, name='choose-tree'))