コード例 #1
0
from django.conf.urls import url
from django.views.generic import ListView, DateDetailView
from django.urls import path

from blog.models import Post

from blog.views.renderallposts import RenderallpostsView
from blog.views.rendersinglepost import RendersinglepostView

app_name = 'blog'

urlpatterns = [
    path('renderallposts/',
         RenderallpostsView.as_view(),
         name='renderallposts'),
    url(r'^(?P<year>\d{4})/(?P<month>\w{3})/(?P<day>\d{2})/(?P<slug>[-\w]+)/$',
        RendersinglepostView.as_view(),
        name='rendersinglepost'),
    url(r'^(?P<year>\d{4})/(?P<month>\w{3})/(?P<day>\d{2})/(?P<slug>[-\w]+)/$',
        DateDetailView.as_view(date_field="publish", model=Post),
        name='post-detail'),
    url(r'^$', ListView.as_view(model=Post, paginate_by=3), name='post-list'),
]
コード例 #2
0
ファイル: urls.py プロジェクト: jamessqr/james-squires-dotcom
from django.conf.urls.defaults import *
from django.contrib import admin
from django.views.generic.base import TemplateView 
from django.views.generic import DetailView, DateDetailView
from blog.models import Entry
from blog.feeds import LatestEntriesFeed
admin.autodiscover()

handler500 = 'djangotoolbox.errorviews.server_error'

entry_info_dict = {
	'queryset': Entry.objects.all(),
	'date_field': 'pub_date',
}

urlpatterns = patterns('',
    (r'^_ah/warmup$', 'djangoappengine.views.warmup'),
	(r'^admin/', include(admin.site.urls)),
	(r'^$', 'blog.views.entries_index'),
	(r'^archive/2014', 'blog.views.archive_2014'),
	(r'^archive/2013', 'blog.views.archive_2013'),
	(r'^archive/2012', 'blog.views.archive_2012'),
	(r'^archive/', 'blog.views.archive'),
	(r'^about/', 'blog.views.about'),	
	(r'^feed/$', LatestEntriesFeed()),
	(r'^(?P<slug>[a-zA-Z0-9_.-]+)/$', DetailView.as_view(model=Entry)),
	(r'^(?P<year>\d{4})/(?P<month>\d{1,2})/(?P<day>\d{1,2})/(?P<slug>[0-9A-Za-z-]+)/$',
			DateDetailView.as_view(slug_field='slug', month_format='%m', **entry_info_dict)),
)
コード例 #3
0
ファイル: urls.py プロジェクト: futuregreen/futuregreen
# 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')),
)
コード例 #4
0
ファイル: links.py プロジェクト: dorianpula/learn-django
"""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")
)
コード例 #5
0
    # exibir registros por ano e mes ano/mes
    path('archive/<int:year>/<int:month>/',
         ArticleMonthView.as_view(month_format='%m'),
         name='article_Month_numeric'),

    # exibir por semana ano/mes/semana
    path('archive_week/<int:year>/<int:month>/<int:week>/',
         ArticleWeekView.as_view(),
         name='article_week_numeric'),

    # exibir por dia ano/mes/dia
    path('archive_day/<int:year>/<int:month>/<int:day>/',
         ArticleDayView.as_view(month_format='%m'),
         name='article_day_numeric'),

    # do dia atual
    path('archive_day/',
         ArticleToDay.as_view(month_format='%m'),
         name='article_today'),

    # detail do dia atual, procurando por pk
    path('archive_pk/<int:year>/<int:month>/<int:day>/<int:pk>/',
         DateDetailView.as_view(
             month_format='%m',
             model=Article,
             date_field="pub_date",
             template_name='generic_date_view/generic_day_pk.html'),
         name="archive_date_detail"),
]
コード例 #6
0
ファイル: urls.py プロジェクト: luchux/django-comments-xtd
from django.conf.urls.defaults import patterns, url
from django.views.generic import ListView, DateDetailView

from simple.articles.models import Article

urlpatterns = patterns('',
    url(r'^$', 
        ListView.as_view(queryset=Article.objects.published()),
        name='articles-index'),

    url(r'^(?P<year>\d{4})/(?P<month>\d{1,2})/(?P<day>\d{1,2})/(?P<slug>[-\w]+)/$',
        DateDetailView.as_view(model=Article, date_field="publish", 
                               month_format="%m"), 
        name='articles-article-detail'),
)
コード例 #7
0
ファイル: views.py プロジェクト: malept/django-bookmarks
    form_class = BookmarkInstanceEditForm
    model = BookmarkInstance
    template_name = _template('edit')
    success_view = 'bookmarks.views.your_bookmarks'

    form_valid = lambda self, form: self._form_valid(form)
    get_form_kwargs = lambda self: self._get_form_kwargs()
    get_success_url = lambda self: self._get_success_url()

    def get_initial(self):
        initial = {}
        if self.request.user == self.object.user:
            fields = ['description', 'note', 'tags']
            initial = dict([(f, getattr(self.object, f)) for f in fields])
        return initial

    def user_success_msg(self):
        return _('You have finished editing bookmark "%(description)s"')


add = login_required(BookmarkAddView.as_view())
bookmarks = BookmarksView.as_view()
bookmark_detail = \
    DateDetailView.as_view(context_object_name='bookmark', date_field='added',
                           model=Bookmark,
                           template_name=_template('bookmark_detail'))
delete = login_required(BookmarkDeleteView.as_view())
edit = login_required(BookmarkEditView.as_view())
your_bookmarks = login_required(YourBookmarksView.as_view())
コード例 #8
0
ファイル: urls.py プロジェクト: heltonalves99/projectbase
from django.conf.urls import patterns, url
from django.views.generic import DetailView
from django.views.generic import DateDetailView
from django.views.generic import ArchiveIndexView
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",
コード例 #9
0
ファイル: urls.py プロジェクト: redsolution/django-box-1
# -*- coding: utf-8 -*-
from django.conf.urls import url
from django.views.generic import DateDetailView
from easy_news.models import News
from .views import news_root

urlpatterns = [
    url(r'^$', news_root, name='news_root'),
    url(r'^(?P<year>\d{4})-(?P<month>\d{2})-(?P<day>\d{2})-(?P<slug>[-\w]+)/$',
        DateDetailView.as_view(queryset=News.objects.filter(show=True),
                               date_field='date',
                               month_format='%m',
                               slug_field='slug'),
        name='news_detail')
]
コード例 #10
0
ファイル: urls.py プロジェクト: danirus/blognajd
    url((r'^(?P<year>\d{4})/(?P<month>\w{3})/(?P<day>\d{1,2})/'
         r'(?P<slug>[-\w]+)/$'),
        views.StoryDetailView.as_view(
            model=Story, date_field="pub_date", month_format="%b",
            template_name="blognajd/story_detail.html"),
        name='blog-story-detail'),

    # allowing access to a story in draft mode
    url((r'^draft/(?P<year>\d{4})/(?P<month>\w{3})/(?P<day>\d{1,2})/'
         r'(?P<slug>[-\w]+)/$'),
        login_required(
            permission_required('blognajd.can_see_unpublished_stories')(
                DateDetailView.as_view(
                    queryset=Story.objects.drafts(),
                    date_field="pub_date", month_format="%b",
                    template_name="blognajd/story_detail.html",
                    allow_future=True)
                ),
            redirect_field_name=""),
        name='blog-story-detail-draft'),

    # allowing access to an upcoming storie
    url((r'^upcoming/(?P<year>\d{4})/(?P<month>\w{3})/(?P<day>\d{1,2})/'
         r'(?P<slug>[-\w]+)/$'),
        login_required(
            permission_required('blognajd.can_see_unpublished_stories')(
                DateDetailView.as_view(
                    queryset=Story.objects.upcoming(),
                    date_field="pub_date", month_format="%b",
                    template_name="blognajd/story_detail.html",
コード例 #11
0
ファイル: urls.py プロジェクト: pug-ma/pugma-website
    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'
    ),
)
コード例 #12
0
ファイル: urls.py プロジェクト: huxley/django-stories
        r'^(?P<year>\d{4})/(?P<month>\w{3})/(?P<day>\d{2})/$',
        DayArchiveView.as_view(**info_dict),
        name='news_archive_day'
    ),
    # news archive today list
    url(
        r'^today/$',
        TodayArchiveView.as_view(**info_dict),
        name='news_archive_day'
    ),
    # story detail
    url(
        r'^(?P<year>\d{4})/(?P<month>\w{3})/(?P<day>\d{1,2})/(?P<slug>[-\w]+)/$',
        'stories.views.pag_story_detail',
        name='news_detail'
    ),
    #story print detail
    url(
        r'^(?P<year>\d{4})/(?P<month>\w{3})/(?P<day>\d{1,2})/(?P<slug>[-\w]+)/print/$',
        DateDetailView.as_view(**print_info_dict),
        name='news_detail_print',
    ),
    #story comments
    url(
        r'^(?P<year>\d{4})/(?P<month>\w{3})/(?P<day>\d{1,2})/(?P<slug>[-\w]+)/comments/$',
        DateDetailView.as_view(**comment_info_dict),
        name='news_detail_comments',
    ),

)
コード例 #13
0
        name='news_archive_month'),
    # news archive week list
    url(r'^(?P<year>\d{4})/(?P<week>\d{1,2})/$',
        WeekArchiveView.as_view(**info_dict),
        name='news_archive_week'),
    # news archive day list
    url(r'^(?P<year>\d{4})/(?P<month>\w{3})/(?P<day>\d{2})/$',
        DayArchiveView.as_view(**info_dict),
        name='news_archive_day'),
    # news archive today list
    url(r'^today/$',
        TodayArchiveView.as_view(**info_dict),
        name='news_archive_day'),
    # story detail
    url(r'^(?P<year>\d{4})/(?P<month>\w{3})/(?P<day>\d{1,2})/(?P<slug>[-\w]+)/$',
        'stories.views.pag_story_detail',
        name='news_detail'),
    #story print detail
    url(
        r'^(?P<year>\d{4})/(?P<month>\w{3})/(?P<day>\d{1,2})/(?P<slug>[-\w]+)/print/$',
        DateDetailView.as_view(**print_info_dict),
        name='news_detail_print',
    ),
    #story comments
    url(
        r'^(?P<year>\d{4})/(?P<month>\w{3})/(?P<day>\d{1,2})/(?P<slug>[-\w]+)/comments/$',
        DateDetailView.as_view(**comment_info_dict),
        name='news_detail_comments',
    ),
)
コード例 #14
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"))
コード例 #15
0
ファイル: views.py プロジェクト: EricSchles/django-bookmarks
class BookmarkEditView(UpdateView, BookmarkManipulationMixin):

    form_class = BookmarkInstanceEditForm
    model = BookmarkInstance
    template_name = _template('edit')
    success_view = 'bookmarks.views.your_bookmarks'

    form_valid = lambda self, form: self._form_valid(form)
    get_form_kwargs = lambda self: self._get_form_kwargs()
    get_success_url = lambda self: self._get_success_url()

    def get_initial(self):
        initial = {}
        if self.request.user == self.object.user:
            fields = ['description', 'note', 'tags']
            initial = dict([(f, getattr(self.object, f)) for f in fields])
        return initial

    def user_success_msg(self):
        return _('You have finished editing bookmark "%(description)s"')

add = login_required(BookmarkAddView.as_view())
bookmarks = BookmarksView.as_view()
bookmark_detail = \
    DateDetailView.as_view(context_object_name='bookmark', date_field='added',
                           model=Bookmark,
                           template_name=_template('bookmark_detail'))
delete = login_required(BookmarkDeleteView.as_view())
edit = login_required(BookmarkEditView.as_view())
your_bookmarks = login_required(YourBookmarksView.as_view())
コード例 #16
0
    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'),
)
コード例 #17
0
         r'(?P<slug>[-\w]+)/$'),
        views.StoryDetailView.as_view(
            model=Story,
            date_field="pub_date",
            month_format="%b",
            template_name="blognajd/story_detail.html"),
        name='blog-story-detail'),

    # allowing access to a story in draft mode
    url((r'^draft/(?P<year>\d{4})/(?P<month>\w{3})/(?P<day>\d{1,2})/'
         r'(?P<slug>[-\w]+)/$'),
        login_required(
            permission_required('blognajd.can_see_unpublished_stories')(
                DateDetailView.as_view(
                    queryset=Story.objects.drafts(),
                    date_field="pub_date",
                    month_format="%b",
                    template_name="blognajd/story_detail.html",
                    allow_future=True)),
            redirect_field_name=""),
        name='blog-story-detail-draft'),

    # allowing access to an upcoming storie
    url((r'^upcoming/(?P<year>\d{4})/(?P<month>\w{3})/(?P<day>\d{1,2})/'
         r'(?P<slug>[-\w]+)/$'),
        login_required(
            permission_required('blognajd.can_see_unpublished_stories')(
                DateDetailView.as_view(
                    queryset=Story.objects.upcoming(),
                    date_field="pub_date",
                    month_format="%b",
                    template_name="blognajd/story_detail.html",
コード例 #18
0
ファイル: entries.py プロジェクト: dorianpula/learn-django
"""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"),
)
コード例 #19
0
ファイル: urls.py プロジェクト: rosscdh/django-comments-xtd
from django.conf.urls.defaults import patterns, url
from django.views.generic import ListView, DateDetailView

from simple.articles.models import Article

urlpatterns = patterns(
    '',
    url(r'^$',
        ListView.as_view(queryset=Article.objects.published()),
        name='articles-index'),
    url(r'^(?P<year>\d{4})/(?P<month>\d{1,2})/(?P<day>\d{1,2})/(?P<slug>[-\w]+)/$',
        DateDetailView.as_view(model=Article,
                               date_field="publish",
                               month_format="%m"),
        name='articles-article-detail'),
)
コード例 #20
0
ファイル: urls.py プロジェクト: maxya/hellodjango
	'queryset': Entry.objects.all(),
	'date_field': 'pub_date',
}

urlpatterns = patterns('',
	#(r'^$', 'myblog.views.entries_index' ),
	(r'^$',
		EntryList.as_view(),
		#TemplateView.as_view(
		#ListView.as_view(
		#	queryset=Entry.objects.order_by('-pub_date')[:10],
		#	template_name='myblog/index.html',
		#),
	),
	(r'^(?P<year>\d{4})/(?P<month>\w{3})/(?P<day>\d{2})/(?P<slug>[-\w]+)/$', 
		DateDetailView.as_view(
			model = Entry,
			date_field = 'pub_date',
			slug_field = 'slug',
			template_name = 'myblog/detail.html',
		),
	),
	#(r'', include('django.contrib.flatpages.urls')),
#	(r'^(?P<year>\d{4})/(?P<month>\w{3})/(?P<day>\d{2})/(?P<slug>[-\w]+)/$', 
#		'django.views.generic.date_based.object_detail', 
#		entry_info_dict, 
#		'myblog_entry_detail'),

	#(r'^weblog/(?P<year>\d{4})/(?P<month>\w{3})/(?P<day>\d{2})/(?P<slug>[-\w]+)/$', 'django.views.generic.date_based.object_detail', entry_info_dict),
)