def by_year(request, year): qs = News.objects.all() return YearArchiveView.as_view(request, year, qs, date_field='pub_date', template_object_name='item', make_object_list=True)
'', 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'^$', ArchiveIndexView.as_view(queryset=Entry.objects.valids(), date_field='pub_date', paginate_by=10), name='blog_entry_list'), )
url(r'^ingredients/(?P<pk>\d+)/delete/$', IngredientDeleteView.as_view(), name="ingredient_delete"), url(r'^ingredients/manage/$', "ingredient_manage", name="ingredient_manage"), url(r'^dishes/$', DishListView.as_view(), name="dish_list"), url(r'^dishes/add/$', "dish_amounts_form", name="dish_add"), url(r'^dishes/(?P<pk>\d+)/$', DishDetailView.as_view(), name="dish_detail"), url(r'^dishes/(?P<dish_id>\d+)/edit/$', "dish_amounts_form", name="dish_edit"), url(r'^dishes/(?P<dish_id>\d+)/multiply/$', "dish_multiply", name="dish_multiply"), url(r'^dishes/(?P<dish_id>\d+)/duplicate/$', "dish_duplicate", name="dish_duplicate"), url(r'^dishes/(?P<pk>\d+)/delete/$', DishDeleteView.as_view(), name="dish_delete"), url(r'^meals/add/$', "meal_portions_form", name="meal_add"), url(r'^meals/(?P<meal_id>\d+)/edit/$', "meal_portions_form", name="meal_edit"), url(r'^meals/(?P<meal_id>\d+)/duplicate/$', "meal_duplicate", name="meal_duplicate"), ) urlpatterns += patterns('', url(r'^$', TemplateView.as_view( template_name='food/food_index.html' ), name="food_index"), url(r'^login/$', 'django.contrib.auth.views.login', { 'template_name': 'food/login.html' }, name="login"), url(r'^logout/$', 'django.contrib.auth.views.logout', { 'next_page': '/food/' }, name="logout"), url(r'^meals/$', ArchiveIndexView.as_view( model=Meal, date_field="date", allow_future=True ), name="meal_archive"), url(r'^meals/(?P<year>\d{4})/$', YearArchiveView.as_view( model=Meal, date_field="date", allow_future=True, make_object_list=True ), name="meal_archive_year"), url(r'^meals/(?P<year>\d{4})/(?P<month>\d{2})/$', MealMonthArchiveView.as_view(), name="meal_archive_month"), url(r'^meals/(?P<year>\d{4})/week(?P<week>\d{1,2})/$', MealWeekArchiveView.as_view(), name="meal_archive_week"), url(r'^meals/(?P<year>\d{4})/(?P<month>\d{2})/(?P<day>\d{2})/$', MealDayArchiveView.as_view(), name="meal_archive_day"), url(r'^meals/all/$', ListView.as_view( model=Meal ), name="meal_list"), url(r'^meals/(?P<pk>\d+)/$', DetailView.as_view( model = Meal ), name="meal_detail"), url(r'^meals/(?P<pk>\d+)/delete/$', DeleteView.as_view( model=Meal, success_url="/food/meals/"), name="meal_delete"), )
template_name='generic_form_page.html')), name='operations-manage-incident-pk'), url(r'^incidents/manage/$', permission_required('operations.add_event', reverse_lazy('home'))( CreateViewWithMessages.as_view( form_class=EventForm, template_name='generic_form_page.html')), 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', ),
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), )
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' ), url(r'^$', ArchiveIndexView.as_view( queryset=Post.objects.all().select_subclasses(),
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
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, )), )
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, )), )
url(r'^$', ArticleIndexView.as_view() , name = 'research'), url(r'^(?P<year>\d{4})/(?P<month>\w{3})/(?P<day>\d{1,2})/(?P<slug>[-\w]+)/$', ArticleDetailView.as_view(), name = 'research_article_detail'), url(r'^(?P<year>\d{4})/(?P<month>\w{3})/(?P<day>\d{1,2})/$', DayArchiveView.as_view( queryset=Article._default_manager.live(), date_field="date_published"), name='article_archive_day' ), url(r'^(?P<year>\d{4})/(?P<month>\w{3})/$', ArticleMonthArchiveView.as_view(), name='article_archive_month' ), url(r'^(?P<year>\d{4})/$', YearArchiveView.as_view( queryset=Article._default_manager.live(), date_field="date_published"), name='article_archive_year' ), url(r'^tag/(?P<slug>[-\w]+)/$','taggit.views.tagged_object_list', {'queryset': Article._default_manager.live(), 'template_name': 'research/articles_by_tag.html', 'template_object_name': 'article'}, name='articles_by_tag' ), )
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())), ]
"""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"))
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'), )
'', 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"))
# }) # post_detail = DetailView.as_view( # model=Post, # queryset=Post.objects.filter(is_public=True)) 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')
"""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"), )
"""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") )
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, )), )
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", ), )
} urlpatterns = patterns( '', # 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/$',
from myhome.blog.models import Entry from myhome.blog.views import * from myhome.blog.feeds import LatestEntriesFeed from django.views.generic import ListView, DetailView, MonthArchiveView, YearArchiveView from datetime import date 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),
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'^$', ArchiveIndexView.as_view( queryset=Entry.objects.valids(), date_field='pub_date', paginate_by=10), name='blog_entry_list' ),
name="food_index"), url(r'^login/$', 'django.contrib.auth.views.login', {'template_name': 'food/login.html'}, name="login"), url(r'^logout/$', 'django.contrib.auth.views.logout', {'next_page': '/food/'}, name="logout"), url(r'^meals/$', ArchiveIndexView.as_view(model=Meal, date_field="date", allow_future=True), name="meal_archive"), url(r'^meals/(?P<year>\d{4})/$', YearArchiveView.as_view(model=Meal, date_field="date", allow_future=True, make_object_list=True), name="meal_archive_year"), url(r'^meals/(?P<year>\d{4})/(?P<month>\d{2})/$', MealMonthArchiveView.as_view(), name="meal_archive_month"), url(r'^meals/(?P<year>\d{4})/week(?P<week>\d{1,2})/$', MealWeekArchiveView.as_view(), name="meal_archive_week"), url(r'^meals/(?P<year>\d{4})/(?P<month>\d{2})/(?P<day>\d{2})/$', MealDayArchiveView.as_view(), name="meal_archive_day"), url(r'^meals/all/$', ListView.as_view(model=Meal), name="meal_list"), url(r'^meals/(?P<pk>\d+)/$', DetailView.as_view(model=Meal), name="meal_detail"),
url(r'^incidents/manage/$', permission_required('operations.add_event', reverse_lazy('home'))( CreateViewWithMessages.as_view(form_class=EventForm, template_name='generic_form_page.html')), 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'),
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", context_object_name = "event_list", paginate_by = 15, queryset = Event.current.all().order_by('event_date'), )), url(r'^(?P<slug>[-\w]+)/public-lectures/$', PublicLecturesListView.as_view()), url(r'^(?P<slug>[-\w]+)/research-seminars/$', ResearchSeminarsListView.as_view()),
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"), )
# def post_detail(request: HttpRequest, pk: int) -> HttpResponse: # post = get_object_or_404(Post, pk=pk) # return render(request, 'instagram/post_detail.html', { # 'post': post, # }) 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=4) post_archive_year = YearArchiveView.as_view( model=Post, date_field='created_at', make_object_list=True)
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), )