Пример #1
0
import datetime

from django.conf.urls.defaults import patterns, url
from django.views.generic.base import TemplateView

from localtv.listing.views import VideoSearchView
from localtv.models import Video
from localtv.search.query import SmartSearchQuerySet

urlpatterns = patterns(
    'localtv.listing.views',
    url(r'^$', TemplateView.as_view(template_name="localtv/browse.html"),
                name='localtv_list_index'),
    url(r'^new/$', VideoSearchView.as_view(
                    template_name='localtv/video_listing_new.html',
                    default_sort='-date'
                ), name='localtv_list_new'),
    url(r'^this-week/$', VideoSearchView.as_view(
                    template_name='localtv/video_listing_new.html',
                    approved_since=datetime.timedelta(days=7),
                    default_sort='-approved'
                ), name='localtv_list_this_week'),
    url(r'^popular/$', VideoSearchView.as_view(
                    template_name='localtv/video_listing_popular.html',
                    default_sort='-popular'
                ), name='localtv_list_popular'),
    url(r'^featured/$', VideoSearchView.as_view(
                    template_name='localtv/video_listing_featured.html',
                    default_sort='-featured'
                ), name='localtv_list_featured'),
    url(r'^tag/(?P<name>.+)/$', VideoSearchView.as_view(
Пример #2
0
# "Base" patterns
urlpatterns = patterns(
    "localtv.views",
    url(r"^$", "index", name="localtv_index"),
    url(r"^about/$", "about", name="localtv_about"),
    url(r"^share/(\d+)/(\d+)", "share_email", name="email-share"),
    url(r"^video/(?P<video_id>[0-9]+)/(?P<slug>[\w-]*)/?$", "view_video", name="localtv_view_video"),
    url(r"^newsletter/$", "newsletter", name="localtv_newsletter"),
)

# Listing patterns
category_videos = CategoryVideoSearchView.as_view(template_name="localtv/category.html", default_filter="category")
urlpatterns += patterns(
    "localtv.listing.views",
    url(
        r"^search/$", VideoSearchView.as_view(template_name="localtv/video_listing_search.html"), name="localtv_search"
    ),
    url(
        r"^category/$",
        SiteListView.as_view(
            template_name="localtv/categories.html", queryset=Category.objects.filter(parent=None), paginate_by=15
        ),
        name="localtv_category_index",
    ),
    url(r"^category/(?P<slug>[-\w]+)/$", category_videos, name="localtv_category"),
    url(
        r"^author/$",
        ListView.as_view(template_name="localtv/author_list.html", model=User, context_object_name="authors"),
        name="localtv_author_index",
    ),
    url(
Пример #3
0
    url(r'^share/(\d+)/(\d+)', 'share_email', name='email-share'),
    url(r'^video/(?P<video_id>[0-9]+)/(?P<slug>[\w-]*)/?$', 'view_video',
                    name='localtv_view_video'),
    url(r'^newsletter/$', 'newsletter', name='localtv_newsletter'))

# Listing patterns
category_videos = CategoryVideoSearchView.as_view(
    template_name='localtv/category.html',
    url_filter='category',
    url_filter_kwarg='slug',
    default_sort='-date'
)
urlpatterns += patterns(
    'localtv.listing.views',
    url(r'^search/$', VideoSearchView.as_view(
                        template_name='localtv/video_listing_search.html',
                    ), name='localtv_search'),
    url(r'^category/$', SiteListView.as_view(
                        template_name='localtv/categories.html',
                        queryset=Category.objects.filter(parent=None),
                        paginate_by=15
                    ), name='localtv_category_index'),
    url(r'^category/(?P<slug>[-\w]+)/$', category_videos,
                    name='localtv_category'),
    url(r'^author/$', ListView.as_view(
                        template_name='localtv/author_list.html',
                        model=User,
                        context_object_name='authors'
                    ), name='localtv_author_index'),
    url(r'^author/(?P<pk>\d+)/$', VideoSearchView.as_view(
                        template_name='localtv/author.html',
Пример #4
0
    url(r'^share/(\d+)/(\d+)', 'share_email', name='email-share'),
    url(r'^video/(?P<video_id>[0-9]+)/(?P<slug>[\w-]*)/?$',
        'view_video',
        name='localtv_view_video'),
    url(r'^newsletter/$', 'newsletter', name='localtv_newsletter'))

# Listing patterns
category_videos = CategoryVideoSearchView.as_view(
    template_name='localtv/category.html',
    url_filter='category',
    url_filter_kwarg='slug',
    default_sort='-date')
urlpatterns += patterns(
    'localtv.listing.views',
    url(r'^search/$',
        VideoSearchView.as_view(
            template_name='localtv/video_listing_search.html', ),
        name='localtv_search'),
    url(r'^category/$',
        SiteListView.as_view(template_name='localtv/categories.html',
                             queryset=Category.objects.filter(parent=None),
                             paginate_by=15),
        name='localtv_category_index'),
    url(r'^category/(?P<slug>[-\w]+)/$',
        category_videos,
        name='localtv_category'),
    url(r'^author/$',
        ListView.as_view(template_name='localtv/author_list.html',
                         model=User,
                         context_object_name='authors'),
        name='localtv_author_index'),
    url(r'^author/(?P<pk>\d+)/$',