Source

pentasubmitter / src / pentasubmitter / urls.py

from django.conf.urls.defaults import patterns, include
from django.conf import settings
from django.views.generic.simple import direct_to_template
from django.conf.urls.defaults import *
from django.views.generic import RedirectView
from haystack.views import SearchView
from haystack.query import SearchQuerySet

# The next two lines enable the admin and load each admin.py file:
from django.contrib import admin
admin.autodiscover()


index = None

urlpatterns = patterns(
    '',
    #('^$', redirect_to, {'url': '/submit/'}),
    ('^$', RedirectView.as_view(url='/submit/')),
)

urlpatterns += patterns(
    '',
    (r'^about.html', direct_to_template, {'template': 'about.html'}),
    (r'^nojavascripthere.html', direct_to_template,
     {'template': 'nojavascripthere.html'}),
)


sqs = SearchQuerySet().order_by('-submit_date')

urlpatterns += patterns(
    '',
    (r'^account/user.html$', 'pentasubmitter.views.user_account_management'),
    ('^account/$', RedirectView.as_view(url='/')),
    (r'^account/', include('django_authopenid.urls')),
    (r'^avatar/', include('avatar.urls')),
    (r'^comments/', include('django.contrib.comments.urls')),
    #(r'^accounts/', include('registration.backends.default.urls')),
    #(r'^profiles/', include('profiles.urls')),
    (r'^submit/', include('submitter.urls')),
    (r'^show/', include('show.urls')),
#    (r'^search/', include('haystack.urls')),
    url(r'^search/', SearchView(load_all=False,  searchqueryset=sqs),
        name='haystack_search',),

    # Uncomment the admin/doc line below and add 'django.contrib.admindocs' 
    # to INSTALLED_APPS to enable admin documentation:
    (r'^admin/doc/', include('django.contrib.admindocs.urls')),

    # Uncomment the next line to enable the admin:
    (r'^admin/', include(admin.site.urls)),
)

# serve static files w/ Django build in server
#if settings.LOCAL_DEVELOPMENT:
    #    urlpatterns += patterns("django.views",
    #    (r"%s(?P<path>.*)$" % settings.MEDIA_URL[1:], "static.serve", {
    #        "document_root": settings.MEDIA_ROOT,
    #    })
    #)

# vim: ts=4 et sw=4 fileencoding=utf-8 :