Example #1
0
# 비 로그인 시 공개된 것만 봐라
class PostDetailView(DetailView):
    model = Post

    # queryset = Post.objects.filter(is_public=True)
    def get_queryset(self):
        qs = super().get_queryset()
        if not self.request.user.is_authenticated:  # 로그인 여부
            qs = qs.filter(is_public=True)
        return qs


post_detail = PostDetailView.as_view()

# def archives_year(request,year):
#     return HttpResponse(f"{year}년 archives")

post_archive = ArchiveIndexView.as_view(model=Post,
                                        date_field='created_at',
                                        paginate_by=10)

post_archive_year = YearArchiveView.as_view(model=Post,
                                            date_field='created_at',
                                            make_object_list=True)

post_archive_month = MonthArchiveView.as_view(model=Post,
                                              date_field='created_at')

post_archive_day = DayArchiveView.as_view(model=Post, date_field='created_at')

# django authentication system (장고 인증 시스템)
Example #2
0
from django.conf.urls.defaults import patterns, include, url
from cms.media.models import Video
from django.views.generic import ListView, YearArchiveView, MonthArchiveView, DayArchiveView, ArchiveIndexView, DateDetailView
from cms.media.views import VideoDetailView

urlpatterns = patterns('',
	(r'^(?P<year>\d{4})/(?P<month>[a-z]{3})/(?P<day>\w{1,2})/(?P<slug>[\w-]+)/$', VideoDetailView.as_view()),
	(r'^(?P<year>\d{4})/(?P<month>[a-z]{3})/(?P<day>\w{1,2})/$', DayArchiveView.as_view(
		queryset = Video.live.all(),
		date_field = "created",
		template_name = "media/video_archive_day.html",
		context_object_name = "video_list",		
	)),
	(r'^(?P<year>\d{4})/(?P<month>[a-z]{3})/$', MonthArchiveView.as_view(
		queryset = Video.live.all(),
		date_field = "created",
		template_name = "media/video_archive_month.html",
		context_object_name = "video_list",	
	)),
	(r'^(?P<year>\d{4})/$', YearArchiveView.as_view(
		queryset = Video.live.all(),
		date_field = "created",
		template_name = "media/video_archive_year.html",
		context_object_name = "video_list",
		make_object_list = True,
	)),
	(r'^$', ListView.as_view(
		queryset = Video.live.all().order_by('-created'),
		template_name = "media/video_list.html",
		context_object_name = "video_list",
		paginate_by = 15,
	)),
Example #3
0
File: urls.py Project: Jwpe/jw.pe
 url(r'^$',
     ListView.as_view(model=Post, paginate_by=5,
         context_object_name="posts"), name="blog_index"),
 #Returns one blog post (based on slug)
 url(r'^post/(?P<slug>[-\w]+)/$',
     DetailView.as_view(model=Post, context_object_name="post"),
     name="blog_detail"),
 #Returns the blog posts for a certain day
 url(r'^(?P<year>\d{4})/(?P<month>\d{2})/(?P<day>\d{1,2})/$',
     DayArchiveView.as_view(model=Post, paginate_by=5,
         context_object_name="posts", month_format='%m',
         date_field='publish'), name="blog_archive_day"),
 #Returns the blog posts for a certain month
 url(r'^(?P<year>\d{4})/(?P<month>\d{2})/$',
     MonthArchiveView.as_view(model=Post, paginate_by=5,
         context_object_name="posts", month_format='%m',
         date_field='publish', allow_empty=True),
     name="blog_archive_month"),
 #Returns the blog posts for a certain year
 url(r'^(?P<year>\d{4})/$',
     YearArchiveView.as_view(model=Post, date_field='publish',
         allow_empty=True), name="blog_archive_year"),
 #Returns the blog posts for a certain category
 url(r'^categories/(?P<slug>[-\w]+)/$',
     CategoryListView.as_view(allow_empty=True, paginate_by=5),
     name="category_detail"),
 #RSS URL
 url(r'rss/$', LatestEntriesFeed()),
 # Draft post URL
 url(r'^{}/'.format(settings.DRAFT_POST_URL), process_draft_post,
     name='process_draft_post'),
Example #4
0
"""URLs for the links both external and internal."""

from django.conf.urls import patterns, url
from django.views.generic import YearArchiveView, MonthArchiveView, DayArchiveView, ArchiveIndexView, DateDetailView

from charleston.models import Link

urlpatterns = patterns(
    '',

    url(r'^$',
        ArchiveIndexView.as_view(queryset=Link.objects.all(), date_field='pub_date')),
    url(r'^(?P<year>\d{4})/$',
        YearArchiveView.as_view(queryset=Link.objects.all(), date_field='pub_date')),
    url(r'^(?P<year>\d{4})/(?P<month>\w{3})/$',
        MonthArchiveView.as_view(queryset=Link.objects.all(), date_field='pub_date')),
    url(r'^(?P<year>\d{4})/(?P<month>\w{3})/(?P<day>\d{2})/$',
        DayArchiveView.as_view(queryset=Link.objects.all(), date_field='pub_date')),
    url(r'^(?P<year>\d{4})/(?P<month>\w{3})/(?P<day>\d{2})/(?P<slug>[-\w]+)/$',
        DateDetailView.as_view(queryset=Link.objects.all(), date_field='pub_date'),
        name="charleston.views.charleston_link_detail")
)
Example #5
0
from django.views.generic import YearArchiveView
from django.views.generic import ArchiveIndexView
from django.views.generic import MonthArchiveView

from .models import Post
from .views import PostDetailView
from .views import PostDateDetailView


urlpatterns = patterns('',
    url(r'^(?P<year>\d{4})/(?P<month>\d{2})/(?P<day>\d{2})/$',
        DayArchiveView.as_view(queryset=Post.objects.all().select_subclasses(), date_field='pub_date', month_format='%m'),
        name='poste_post_archive_day'
    ),
    url(r'^(?P<year>\d{4})/(?P<month>\d{2})/$',
        MonthArchiveView.as_view(
            queryset=Post.objects.all().select_subclasses(), date_field='pub_date', month_format='%m'),
        name='poste_post_archive_month'
    ),
    url(r'^(?P<year>\d{4})/$',
        YearArchiveView.as_view(queryset=Post.objects.all().select_subclasses(), date_field='pub_date', make_object_list=True),
        name='poste_post_archive_year'
    ),
    url(r'^(?P<year>\d+)/(?P<month>[-\w]+)/(?P<day>\d+)/(?P<slug>.*)/$',
        PostDateDetailView.as_view(queryset=Post.objects.all().select_subclasses(), month_format='%m', date_field="pub_date"),
        name="poste_post_date_detail"
    ),
    url(r'^(?P<slug>.*)/$',
        PostDetailView.as_view(
            queryset=Post.objects.all().select_subclasses()
        ),
        name='poste_post_detail'
Example #6
0
urlpatterns = patterns('',
	url(r'^(?P<year>\d{4})/(?P<month>[a-z]{3})/(?P<day>\w{1,2})/(?P<slug>[\w-]+)/$', EventDetailView.as_view()),

	url(r'^(?P<year>\d{4})/(?P<month>[a-z]{3})/(?P<day>\w{1,2})/$', DayArchiveView.as_view(
		allow_future = True,
		queryset = Event.current.all().order_by('event_date'),
		date_field = "event_date",
		template_name = "events/event_archive_day.html",
		context_object_name = "event_list",		
	)),
	
	url(r'^(?P<year>\d{4})/(?P<month>[a-z]{3})/$', MonthArchiveView.as_view(
		allow_future = True,
		queryset = Event.current.all().order_by('event_date'),
		date_field = "event_date",
		template_name = "events/event_archive_month.html",
		context_object_name = "event_list",	
	)),
	
	url(r'^(?P<year>\d{4})/$', YearArchiveView.as_view(
		allow_future = True,
		queryset = Event.current.all().order_by('event_date'),
		date_field = "event_date",
		template_name = "events/event_archive_year.html",
		context_object_name = "event_list",
		make_object_list = True,
	)),
	
	url(r'^$', ListView.as_view(
		template_name = "events/event_list.html",
Example #7
0
from .models import Entry
from .views import TaggedEntryListView
from .views import EntryDetailView


urlpatterns = patterns('',
    url(r'^tag/(?P<tag>.*)/$', 
        TaggedEntryListView.as_view(),
        name='blog_entry_filter_tag'
    ),
    url(r'^(?P<year>\d{4})/(?P<month>\d{2})/(?P<day>\d{2})/$',
        DayArchiveView.as_view(queryset=Entry.objects.valids(), date_field='pub_date', month_format='%m'),
        name='blog_entry_archive_day'
    ),
    url(r'^(?P<year>\d{4})/(?P<month>\d{2})/$',
        MonthArchiveView.as_view(
            queryset=Entry.objects.valids(), date_field='pub_date', month_format='%m'),
        name='blog_entry_archive_month'
    ),
    url(r'^(?P<year>\d{4})/$',
        YearArchiveView.as_view(queryset=Entry.objects.valids(), date_field='pub_date'),
        name='blog_entry_archive_year'
    ),
    url(r'^(?P<year>\d+)/(?P<month>[-\w]+)/(?P<day>\d+)/(?P<slug>.*)/$',
        DateDetailView.as_view(queryset=Entry.objects.valids(), month_format='%m', date_field="pub_date"),
        name="blog_archive_date_detail"
    ),
    url(r'^(?P<slug>.*)/$', 
        EntryDetailView.as_view(), 
        name='blog_entry_detail'
    ),
    url(r'^$',
Example #8
0
urlpatterns = patterns('',
    url(r'^$', ListView.as_view(
        queryset=Entry.objects.order_by('-pub_date'),
        context_object_name='entry_list',
        paginate_by=5,
    ), name='entry_index'),
    url(r'^archive/(?P<year>\d{4})/$', YearArchiveView.as_view(
        queryset=Entry.objects.order_by('-pub_date'),
        context_object_name='entry_list',
        model=Entry,
        date_field='pub_date',
    ), name='entry_year_index'),
    url(r'^archive/(?P<year>\d{4})/(?P<month>[a-z]{3})/$', MonthArchiveView.as_view(
        queryset=Entry.objects.order_by('-pub_date'),
        context_object_name='entry_list',
        model=Entry,
        date_field='pub_date',
        paginate_by=5,
    ), name='entry_month_index'),
    url(r'^page/(?P<page>\d+)/$', ListView.as_view(
        queryset=Entry.objects.order_by('-pub_date'),
        context_object_name='entry_list',
        paginate_by=5,
    ), name='entry_index'),
    url(r'^entry/(?P<object_id>\d+)/$', redirect_old_urls),
    url(r'^entry/(?P<slug>[\w\d][-\w\d]*)/$', DetailView.as_view(
        model=Entry,
    ), name="entry"),
    (r'^tags/', include('myhome.tags.urls')),
    (r'^entry/(?P<entry_id>\d+)/subscribe/$', subcribe_by_email),
    (r'^comments/', include('django.contrib.comments.urls')),
Example #9
0
from django.conf.urls.defaults import patterns, include, url
from cms.news.models import Story
from django.views.generic import ListView, YearArchiveView, MonthArchiveView, DayArchiveView, ArchiveIndexView, DateDetailView
from cms.news.views import StoryDetailView

urlpatterns = patterns('',
	(r'^(?P<year>\d{4})/(?P<month>[a-z]{3})/(?P<day>\w{1,2})/(?P<slug>[\w-]+)/$', StoryDetailView.as_view()),
	(r'^(?P<year>\d{4})/(?P<month>[a-z]{3})/(?P<day>\w{1,2})/$', DayArchiveView.as_view(
		queryset = Story.live.all(),
		date_field = "pub_date",
		template_name = "news/story_archive_day.html",
		context_object_name = "story_list",		
	)),
	(r'^(?P<year>\d{4})/(?P<month>[a-z]{3})/$', MonthArchiveView.as_view(
		queryset = Story.live.all(),
		date_field = "pub_date",
		template_name = "news/story_archive_month.html",
		context_object_name = "story_list",	
	)),
	(r'^(?P<year>\d{4})/$', YearArchiveView.as_view(
		queryset = Story.live.all(),
		date_field = "pub_date",
		template_name = "news/story_archive_year.html",
		context_object_name = "story_list",
		make_object_list = True,
	)),
	(r'^$', ListView.as_view(
		queryset = Story.live.all().order_by('-pub_date'),
		template_name = "news/story_list.html",
		context_object_name = "story_list",
		paginate_by = 15,
	)),
Example #10
0
    # post detail
    url(r'^(?P<path>.+)/(?P<year>\d{4})/(?P<month>\w{3})/(?P<day>\d{1,2})/(?P<slug>[-\w]+)/$',
        PostView.as_view(),
        name='category_post_detail'),

    # news archive index
    url(r'^category/(?P<path>.+)/$',
        PostListView.as_view(),
        name='post_archive_index'),
    # news archive year list
    url(r'^category/(?P<path>.+)/(?P<year>\d{4})/$',
        YearArchiveView.as_view(**info_dict),
        name='post_archive_year'),
    # news archive month list
    url(r'^category/(?P<path>.+)/(?P<year>\d{4})/(?P<month>\w{3})/$',
        MonthArchiveView.as_view(**info_dict),
        name='post_archive_month'),
    # news archive week list
    url(r'^category/(?P<path>.+)/(?P<year>\d{4})/(?P<week>\d{1,2})/$',
        WeekArchiveView.as_view(**info_dict),
        name='post_archive_week'),
    # news archive day list
    url(r'^category/(?P<path>.+)/(?P<year>\d{4})/(?P<month>\w{3})/(?P<day>\d{2})/$',
        DayArchiveView.as_view(**info_dict),
        name='post_archive_day'),
    # news archive today list
    url(r'^category/(?P<path>.+)/today/$',
        TodayArchiveView.as_view(**info_dict),
        name='post_archive_day'),
)
Example #11
0
from django.conf.urls.defaults import patterns, include, url
from cms.media.models import Photo
from django.views.generic import ListView, YearArchiveView, MonthArchiveView, DayArchiveView, ArchiveIndexView, DateDetailView
from cms.media.views import PhotoDetailView

urlpatterns = patterns('',
	(r'^(?P<year>\d{4})/(?P<month>[a-z]{3})/(?P<day>\w{1,2})/(?P<slug>[\w-]+)/$', PhotoDetailView.as_view()),
	(r'^(?P<year>\d{4})/(?P<month>[a-z]{3})/(?P<day>\w{1,2})/$', DayArchiveView.as_view(
		queryset = Photo.live.all(),
		date_field = "uploaded",
		template_name = "media/photo_archive_day.html",
		context_object_name = "photo_list",		
	)),
	(r'^(?P<year>\d{4})/(?P<month>[a-z]{3})/$', MonthArchiveView.as_view(
		queryset = Photo.live.all(),
		date_field = "uploaded",
		template_name = "media/photo_archive_month.html",
		context_object_name = "photo_list",	
	)),
	(r'^(?P<year>\d{4})/$', YearArchiveView.as_view(
		queryset = Photo.live.all(),
		date_field = "uploaded",
		template_name = "media/photo_archive_year.html",
		context_object_name = "photo_list",
		make_object_list = True,
	)),
	(r'^$', ListView.as_view(
		queryset = Photo.live.all().order_by('-uploaded'),
		template_name = "media/photo_list.html",
		context_object_name = "photo_list",
		paginate_by = 15,
	)),
Example #12
0
from news.models import Story
from news.views import StoryDetailView, StoryListView

urlpatterns = [
    url(r'^(?P<year>\d{4})/(?P<month>[a-z]{3})/(?P<day>\w{1,2})/(?P<slug>[\w-]+)/$',
        StoryDetailView.as_view()),
    url(r'^(?P<year>\d{4})/(?P<month>[a-z]{3})/(?P<day>\w{1,2})/$',
        cache_page(60 * 15)(
            DayArchiveView.as_view(
                queryset=Story.live.all(),
                date_field="pub_date",
                template_name="news/story_archive_day.html",
                context_object_name="story_list",))),
    url(r'^(?P<year>\d{4})/(?P<month>[a-z]{3})/$',
        cache_page(60 * 15)(
            MonthArchiveView.as_view(
                queryset=Story.live.all(),
                date_field="pub_date",
                template_name="news/story_archive_month.html",
                context_object_name="story_list",))),
    url(r'^(?P<year>\d{4})/$', cache_page(60 * 15)(YearArchiveView.as_view(
        queryset=Story.live.all(),
        date_field="pub_date",
        template_name="news/story_archive_year.html",
        context_object_name="story_list",
        make_object_list=True,
    ))),
    url(r'^$', cache_page(60 * 15)(StoryListView.as_view())),
]
Example #13
0
"""URLs for the links both external and internal."""

from django.conf.urls import patterns, url
from django.views.generic import YearArchiveView, MonthArchiveView, DayArchiveView, ArchiveIndexView, DateDetailView

from charleston.models import Link

urlpatterns = patterns(
    '',
    url(
        r'^$',
        ArchiveIndexView.as_view(queryset=Link.objects.all(),
                                 date_field='pub_date')),
    url(
        r'^(?P<year>\d{4})/$',
        YearArchiveView.as_view(queryset=Link.objects.all(),
                                date_field='pub_date')),
    url(
        r'^(?P<year>\d{4})/(?P<month>\w{3})/$',
        MonthArchiveView.as_view(queryset=Link.objects.all(),
                                 date_field='pub_date')),
    url(
        r'^(?P<year>\d{4})/(?P<month>\w{3})/(?P<day>\d{2})/$',
        DayArchiveView.as_view(queryset=Link.objects.all(),
                               date_field='pub_date')),
    url(r'^(?P<year>\d{4})/(?P<month>\w{3})/(?P<day>\d{2})/(?P<slug>[-\w]+)/$',
        DateDetailView.as_view(queryset=Link.objects.all(),
                               date_field='pub_date'),
        name="charleston.views.charleston_link_detail"))
Example #14
0
    ListView,
)

from blog.models import Post
from blog.views import PostIndexView, PostDetailView

urlpatterns = patterns(
    "",
    url(r"^$", PostIndexView.as_view(), name="blog_post_index"),
    url(
        r"^(?P<year>\d{4})/(?P<month>\w{3})/(?P<day>\d{1,2})/(?P<slug>[-\w]+)/$",
        PostDetailView.as_view(),
        name="blog_post_detail",
    ),
    url(
        r"^(?P<year>\d{4})/(?P<month>\w{3})/(?P<day>\d{1,2})/$",
        DayArchiveView.as_view(queryset=Post.objects.live(), date_field="published"),
        name="blog_archive_day",
    ),
    url(
        r"^(?P<year>\d{4})/(?P<month>\w{3})/$",
        MonthArchiveView.as_view(queryset=Post.objects.live(), date_field="published"),
        name="blog_archive_month",
    ),
    url(
        r"^(?P<year>\d{4})/$",
        YearArchiveView.as_view(queryset=Post.objects.live(), date_field="published"),
        name="blog_archive_year",
    ),
)
Example #15
0
                       url(r'^incidents/archives/$', ArchiveIndexView.as_view(queryset=Event.objects.all(),
                                                                              date_field='created',
                                                                              template_name='incident-archive.html',
                                                                              context_object_name='object_list'),
                           name='operations-view-incident-archive'),

                       url(r'^incidents/archives/(?P<year>\d{4})/$',
                           YearArchiveView.as_view(queryset=Event.objects.all(),
                                                   date_field='created',
                                                   template_name='incident-archive-year.html',
                                                   context_object_name='events'),
                           name='operations-view-incident-archive-year'),

                       url(r'^incidents/archives/(?P<year>\d{4})/(?P<month>\d{2})/$',
                           MonthArchiveView.as_view(queryset=Event.objects.all(),
                                                    date_field='created',
                                                    template_name='incident-archive-month.html',
                                                    month_format='%m'), name='operations-view-incident-archive-month'),

                       url(r'^incidents/archives/(?P<year>\d{4})/(?P<month>\d{2})/(?P<day>\d{2})/$',
                           DayArchiveView.as_view(queryset=Event.objects.all(),
                                                  date_field='created',
                                                  template_name='incident-archive-day.html',
                                                  month_format='%m',
                           ), name='operations-view-incident-archive-day'),

                       url(r'^incidents/delete/(?P<pk>\d+)/$',
                           permission_required('operations.delete_event', reverse_lazy('home'))(
                               DeleteView.as_view(model=Event,
                                                  template_name='generic-delete.html',
                                                  success_url=reverse_lazy('active-incidents'))),
                           name='operations-delete-incident-pk'),
Example #16
0
 # news archive index
 url(
     r'^category/(?P<path>.+)/$',
     PostListView.as_view(),
     name='post_archive_index'
 ),
 # news archive year list
 url(
     r'^category/(?P<path>.+)/(?P<year>\d{4})/$',
     YearArchiveView.as_view(**info_dict),
     name='post_archive_year'
 ),
 # news archive month list
 url(
     r'^category/(?P<path>.+)/(?P<year>\d{4})/(?P<month>\w{3})/$',
     MonthArchiveView.as_view(**info_dict),
     name='post_archive_month'
 ),
 # news archive week list
 url(
     r'^category/(?P<path>.+)/(?P<year>\d{4})/(?P<week>\d{1,2})/$',
     WeekArchiveView.as_view(**info_dict),
     name='post_archive_week'
 ),
 # news archive day list
 url(
     r'^category/(?P<path>.+)/(?P<year>\d{4})/(?P<month>\w{3})/(?P<day>\d{2})/$',
     DayArchiveView.as_view(**info_dict),
     name='post_archive_day'
 ),
 # news archive today list
Example #17
0
from django.views.generic import YearArchiveView
from django.views.generic import DayArchiveView
from django.views.generic import MonthArchiveView

from .models import News

urlpatterns = patterns(
    "",
    url(
        r"^(?P<year>\d+)/(?P<month>[-\w]+)/(?P<day>\d+)/(?P<slug>.*)/$",
        DateDetailView.as_view(model=News, month_format="%m", date_field="date"),
        name="date_detail_news",
    ),
    url(
        r"^(?P<year>\d{4})/(?P<month>\d{2})/$",
        MonthArchiveView.as_view(model=News, month_format="%m", date_field="date"),
        name="month_list_news",
    ),
    url(
        r"^(?P<year>\d{4})/$",
        YearArchiveView.as_view(model=News, date_field="date", make_object_list=True),
        name="year_list_news",
    ),
    url(
        r"^(?P<year>\d+)/(?P<month>[-\w]+)/(?P<day>\d+)/$",
        DayArchiveView.as_view(model=News, month_format="%m", date_field="date"),
        name="date_list_news",
    ),
    url(r"^(?P<slug>.*)/$", DetailView.as_view(model=News), name="detail_news"),
    url(r"^$", ArchiveIndexView.as_view(model=News, date_field="date"), name="list_news"),
)
Example #18
0
# studio/urls.py

from django.conf import settings
from django.conf.urls.defaults import *
from django.views.generic import ListView, DetailView, TemplateView, DateDetailView, MonthArchiveView
from futuregreen.studio.models import NewsItem

urlpatterns = patterns('',
    url(r'^$', 'futuregreen.studio.views.index', name = 'studio'),
    url(r'^news/$', ListView.as_view(model=NewsItem, context_object_name = "news_list"), name = 'newsitem_list'),
    url(r'^news/(?P<year>\d{4})/(?P<month>\w{3})/(?P<day>\d{1,2})/(?P<slug>[-\w]+)/$',
        DateDetailView.as_view(model=NewsItem, context_object_name = "news",
                               date_field="date_published", template_name = "studio/newsitem_detail.html"),
        name = 'newsitem_detail'),
    url(r'^news/(?P<year>\d{4})/(?P<month>\w{3})/$',
        MonthArchiveView.as_view(model=NewsItem,
                                 context_object_name = "news_list",
                                 date_field="date_published"),
        name='news_archive_month'
    ),
    (r'^people/', include('futuregreen.people.urls')),
)
Example #19
0
from .views import TaggedEntryListView
from .views import EntryDetailView

urlpatterns = patterns(
    '',
    url(r'^tag/(?P<tag>.*)/$',
        TaggedEntryListView.as_view(),
        name='blog_entry_filter_tag'),
    url(r'^(?P<year>\d{4})/(?P<month>\d{2})/(?P<day>\d{2})/$',
        DayArchiveView.as_view(queryset=Entry.objects.valids(),
                               date_field='pub_date',
                               month_format='%m'),
        name='blog_entry_archive_day'),
    url(r'^(?P<year>\d{4})/(?P<month>\d{2})/$',
        MonthArchiveView.as_view(queryset=Entry.objects.valids(),
                                 date_field='pub_date',
                                 month_format='%m'),
        name='blog_entry_archive_month'),
    url(r'^(?P<year>\d{4})/$',
        YearArchiveView.as_view(queryset=Entry.objects.valids(),
                                date_field='pub_date'),
        name='blog_entry_archive_year'),
    url(r'^(?P<year>\d+)/(?P<month>[-\w]+)/(?P<day>\d+)/(?P<slug>.*)/$',
        DateDetailView.as_view(queryset=Entry.objects.valids(),
                               month_format='%m',
                               date_field="pub_date"),
        name="blog_archive_date_detail"),
    url(r'^(?P<slug>.*)/$',
        EntryDetailView.as_view(),
        name='blog_entry_detail'),
    url(r'^$',
Example #20
0
File: urls.py Project: boxed/kodare
from django.conf.urls import *
from django.views.generic import DetailView, ListView, DayArchiveView, MonthArchiveView, YearArchiveView
from kodare.blog.models import Entry

info_dict = {
    'model': Entry,
    'date_field': 'creation_time',
}

urlpatterns = patterns('',
    (r'^$', ListView.as_view(queryset=Entry.objects.order_by('-creation_time'), paginate_by=5, template_name='blog.html')),
    (r'^(?P<slug>.*)/$', DetailView.as_view(queryset=Entry.objects.all())),
   (r'^(?P<year>\d{4})/(?P<month>[a-z,A-Z]{3})/(?P<day>\w{1,2})/(?P<slug>[-\w]+)/$', DetailView.as_view(model=Entry)),
   (r'^(?P<year>\d{4})/(?P<month>[a-z,A-Z]{3})/(?P<day>\w{1,2})/$',               DayArchiveView.as_view(**info_dict),   info_dict),
   (r'^(?P<year>\d{4})/(?P<month>[a-z,A-Z]{3})/$',                                MonthArchiveView.as_view(**info_dict), info_dict),
   (r'^(?P<year>\d{4})/$',                                                    YearArchiveView.as_view(**info_dict),  info_dict),
)
Example #21
0
"""URLs for the blog posts."""

from django.conf.urls import patterns, url
from django.views.generic import YearArchiveView, MonthArchiveView, DayArchiveView, ArchiveIndexView, DateDetailView

from charleston.models import Entry

urlpatterns = patterns(
    '',

    url(r'^$',
        ArchiveIndexView.as_view(queryset=Entry.live.all(), date_field='pub_date')),
    url(r'^(?P<year>\d{4})/$',
        YearArchiveView.as_view(queryset=Entry.live.all(), date_field='pub_date')),
    url(r'^(?P<year>\d{4})/(?P<month>\w{3})/$',
        MonthArchiveView.as_view(queryset=Entry.live.all(), date_field='pub_date')),
    url(r'^(?P<year>\d{4})/(?P<month>\w{3})/(?P<day>\d{2})/$',
        DayArchiveView.as_view(queryset=Entry.live.all(), date_field='pub_date')),
    url(r'^(?P<year>\d{4})/(?P<month>\w{3})/(?P<day>\d{2})/(?P<slug>[-\w]+)/$',
        DateDetailView.as_view(queryset=Entry.live.all(), date_field='pub_date'),
        name="charleston.views.charleston_entry_detail"),
)
Example #22
0
     name='operations-manage-incident'),
 url(r'^incidents/archives/$',
     ArchiveIndexView.as_view(queryset=Event.objects.all(),
                              date_field='created',
                              template_name='incident-archive.html',
                              context_object_name='object_list'),
     name='operations-view-incident-archive'),
 url(r'^incidents/archives/(?P<year>\d{4})/$',
     YearArchiveView.as_view(queryset=Event.objects.all(),
                             date_field='created',
                             template_name='incident-archive-year.html',
                             context_object_name='events'),
     name='operations-view-incident-archive-year'),
 url(r'^incidents/archives/(?P<year>\d{4})/(?P<month>\d{2})/$',
     MonthArchiveView.as_view(queryset=Event.objects.all(),
                              date_field='created',
                              template_name='incident-archive-month.html',
                              month_format='%m'),
     name='operations-view-incident-archive-month'),
 url(r'^incidents/archives/(?P<year>\d{4})/(?P<month>\d{2})/(?P<day>\d{2})/$',
     DayArchiveView.as_view(
         queryset=Event.objects.all(),
         date_field='created',
         template_name='incident-archive-day.html',
         month_format='%m',
     ),
     name='operations-view-incident-archive-day'),
 url(r'^incidents/delete/(?P<pk>\d+)/$',
     permission_required('operations.delete_event', reverse_lazy('home'))(
         DeleteView.as_view(model=Event,
                            template_name='generic-delete.html',
                            success_url=reverse_lazy('active-incidents'))),
Example #23
0
    '',
    url(r'^$',
        ArchiveIndexView.as_view(queryset=Entry.objects.live(),
                                 date_field="published",
                                 context_object_name="entry_list"),
        name='text_entry_index'),
    url(r'^(?P<year>\d{4})/(?P<month>\w{3})/(?P<day>\d{1,2})/(?P<slug>[-\w]+)/update/$',
        EntryUpdateView.as_view(),
        name='text_entry_update'),
    url(r'^create/$', EntryCreateView.as_view(), name='text_entry_create'),
    url(r'^(?P<year>\d{4})/(?P<month>\w{3})/(?P<day>\d{1,2})/(?P<slug>[-\w]+)/$',
        EntryDetailView.as_view(),
        name='text_entry_detail'),
    url(r'^(?P<year>\d{4})/(?P<month>\w{3})/(?P<day>\d{1,2})/$',
        DayArchiveView.as_view(queryset=Entry.objects.live(),
                               date_field="published"),
        name='text_archive_day'),
    url(r'^(?P<year>\d{4})/(?P<month>\w{3})/$',
        MonthArchiveView.as_view(queryset=Entry.objects.live(),
                                 date_field="published"),
        name='text_archive_month'),
    url(r'^(?P<year>\d{4})/$',
        YearArchiveView.as_view(queryset=Entry.objects.live(),
                                date_field="published"),
        name='text_archive_year'),
    url(r"^ajax/images/(?P<entry_id>\d+)/$",
        related_images,
        name="text_related_images"),
    url(r"^ajax/images/upload/$", upload_images, name="text_upload_images"),
    url(r"^ajax/images/recent/$", recent_images, name="text_recent_images"))