示例#1
0
    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"),
)
示例#2
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"),
)
示例#3
0
from .views import EntryYearArchiveView
from .views import TaggedEntryListView

# URL examples
# ------------
# /blog/tags/                   -- tag list detail
# /blog/tags/foo/               -- entries tagged with "foo"
# /blog/a-sample-entry/         -- entry detail
# /blog/2013/01/05/             -- entry list (by year, month, day)
# /blog/2013/01/                -- entry list (by year, month)
# /blog/2013/                   -- entry list (by year)
# /blog/2013/05/a-sample-entry/ -- entry detail (with date slug)
# /blog/                        -- entry detail (latest published post)

urlpatterns = [
    url(r"^tags/$", ListView.as_view(model=Tag), name="list_tags"),
    url(r"^tags/(?P<tag_slug>.*)/$", TaggedEntryListView.as_view(), name="tagged_entry_list"),
    # Year, Month, Day Archives
    url(r"^(?P<year>\d{4})/(?P<month>\d{2})/(?P<day>\d{2})/$", EntryDayArchiveView.as_view(), name="entry_archive_day"),
    url(r"^(?P<year>\d{4})/(?P<month>\d{2})/$", EntryMonthArchiveView.as_view(), name="entry_archive_month"),
    url(r"^(?P<year>\d{4})/$", EntryYearArchiveView.as_view(), name="entry_archive_year"),
    # Detail views (with and without the date)
    url(
        r"^(?P<year>\d{4})/(?P<month>\d{2})/(?P<day>\d{2})/(?P<slug>.*)/$",
        EntryDetailView.as_view(),
        name="entry_detail",
    ),
    url(r"^(?P<slug>.*)/$", EntryDetailView.as_view(), name="entry_detail"),
    url(r"^$", ArchiveIndexView.as_view(model=Entry, date_field="published_on", paginate_by=10), name="list_entries"),
]
示例#4
0
文件: urls.py 项目: Fnanshan/mysite2
urlpatterns = [
    path('', views.IndexView.as_view(), name='index'),
    path('<int:question_id>/', views.detail, name='detail'),
    # path('<int:pk>/', views.DetailView.as_view(), name='detail'),
    path('<int:pk>/results/', views.ResultsView.as_view(), name='results'),
    path('<int:question_id>/vote/', views.vote, name='vote'),
    path('upload/', views.upload_file, name='upload_file'),
    path('form/', views.get_name, name='form'),
    path('formview/', views.ContactView.as_view(), name='formview'),
    path('product/', views.ProductListView.as_view(), name='productList'),
    path('create/', views.QuestionCreate.as_view(), name='QuestionCreate'),
    path('update/<int:pk>/', views.QuestionUpdate.as_view(), name='QuestionUpdate'),
    path('delete/<int:pk>/', views.QuestionDelete.as_view(), name='QuestionDelete'),
    # 通用日期视图
    path('archive/',
         ArchiveIndexView.as_view(model=Question, date_field="pub_date"),
         name="question_archive"),
    # 学习formset
    path('manage_article/', views.manage_article, name='manage_article'),
]

# urlpatterns = [
#     # ex: /polls/
#     path('', views.index, name='index'),
#     # ex: /polls/5/
#     path('<int:question_id>/', views.detail, name='detail'),
#     # ex: /polls/5/results/
#     path('<int:question_id>/results/', views.results, name='results'),
#     # ex: /polls/5/vote/
#     path('<int:question_id>/vote/', views.vote, name='vote'),
# ]
示例#5
0
from django.conf.urls import patterns, include, url
# Uncomment the next two lines to enable the admin:
from django.contrib import admin
from CONAB.gasto.models import Combustivel,Servico
from django.views.generic import ArchiveIndexView
from relatorioGeral.views import relatorioGeral

admin.autodiscover()

urlpatterns = patterns('',
    # Examples:
     url(r'^', include('CONAB.gasto.urls')),
    # url(r'^CONAB/', include('CONAB.foo.urls')),

    # Uncomment the admin/doc line below to enable admin documentation:
    # url(r'^admin/doc/', include('django.contrib.admindocs.urls')),
    url(r'^cadastrar/$', 'usuario.views.index'),


    url(r'^relatorio_geral/$' , relatorioGeral.as_view(), name='relatorio_geral'),
    # Uncomment the next line to enable the admin:
    url(r'^admin/', include(admin.site.urls), name='admin'),
    url(r'^gasto', ArchiveIndexView.as_view(model=Combustivel, date_field='data_abastecido'))
)
示例#6
0
文件: urls.py 项目: hersonls/poste
    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(),
            date_field='pub_date'),
        name='poste_post_list'
    )
)
示例#7
0
from django.conf.urls import include, url
from django.views.generic import ArchiveIndexView
from django.contrib import admin
from blog.models import Artigo
from blog.feeds import UltimosArtigos
from .views import contato

urlpatterns = [
    url(r'^admin/', include(admin.site.urls)),
    url(r'^artigo/(?P<artigo_id>\d+)/$', 'blog.views.artigo', name='artigo'),
    url(r'^contato/$', contato, name='contato'),
    url(r'^rss/ultimos/$', UltimosArtigos()),
    url(
        r'^$',
        ArchiveIndexView.as_view(
            queryset=Artigo.objects.all(),
            date_field='publicacao'
            )
        ),
]
示例#8
0
    # update dos dados
    path('updateview/<int:pk>/', UpdateViewCBV.as_view(),
         name='my-updateview'),

    # Generic date views
    # detalhes
    path('archiveindexbiew/<int:pk>',
         DetailViewCBVarticle.as_view(),
         name='detail-article'),

    # Objetos com uma data futura não são exibidos, a menos que você defina allow_futurecomo True.

    # exibe os dados mais generic_date_view
    path('archiveindexbiew/',
         ArchiveIndexView.as_view(
             model=Article,
             date_field="pub_date",
             template_name='generic_date_view/generic_date_view.html'),
         name="article_archive"),

    # Exibe todos os dados do ano ano/
    path('archiveyear/<int:year>/',
         ArticleYearView.as_view(),
         name='article_year'),

    # 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>/',
示例#9
0
}

print_info_dict = dict(info_dict.items() +
                       [('template_name', 'stories/story_print.html')])
print_info_dict.pop('allow_empty')

comment_info_dict = dict(info_dict.items() +
                         [('template_name', 'stories/story_comments.html')])
comment_info_dict.pop('allow_empty')

urlpatterns = patterns(
    '',

    # news archive index
    url(r'^$',
        ArchiveIndexView.as_view(**info_dict),
        name='news_archive_index'),
    # news archive year list
    url(r'^(?P<year>\d{4})/$',
        YearArchiveView.as_view(**info_dict),
        name='news_archive_year'),
    # news archive month list
    url(r'^(?P<year>\d{4})/(?P<month>\w{3})/$',
        MonthArchiveView.as_view(**info_dict),
        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})/$',
示例#10
0
from django.urls import path
from django.conf.urls import url, include
from django.views.generic import TemplateView, ArchiveIndexView
from dining.models import Menu

from . import views

urlpatterns = [
    path('', views.DashboardView.as_view(), name='dashboard'),
    path('menu/', views.MenuItemsView.as_view(), name='menus'),
    path('<int:year>/week/<int:week>/', views.MenuWeekView.as_view(), name='menus-week'),
    path('menu-latest/', ArchiveIndexView.as_view(model=Menu, date_field='date'), name='menus-latest'),
    path('menu/today/', views.TodayMenuView.as_view(), name='menu_today'),
    path('menu/<int:pk>/', views.MenuDetailView.as_view(), name='menu_detail'),
    path('meal/<int:pk>/', views.MealDetailView.as_view(), name='meal_detail'),
    url(r'^ratings/', include('star_ratings.urls', namespace='ratings')),
]
示例#11
0
from blog.models import Post
from blog.views import ListCreateView, TagArchiveListView

urlpatterns = patterns('',  
    #url(r'^$', 'blog.views.index'),
    # List view for posts
    url(r'^$', ListView.as_view(
        queryset=Post.objects.order_by('-date'),
        context_object_name="posts",
        template_name='blog.html',
        paginate_by=5,
    ), name="blog-index"),
    # Index view for post archive
    url(r'^archive/$', ArchiveIndexView.as_view(
        model=Post,
        date_field='date',
        template_name='archive.html',
        paginate_by=20,
    ), name="blog-archive"),
    # Detail view for post
    url(r'^post/(?P<slug>[-\w]+)/$', DetailView.as_view( 
        model=Post,
        template_name='detail.html',
    ), name="blog-detail"),
    # List view for tag archive
    url(r'^archive/([-\w]+)/$', TagArchiveListView.as_view(
        context_object_name="latest",
        template_name="archive.html",
        paginate_by=5,
    ), name="blog-tagarchive"),
    # Search urls
    url(r'^search/', include('haystack.urls'),
示例#12
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"))
示例#13
0
# blog/urls.py

from django.conf.urls.defaults import include, patterns, url
from django.views.generic import YearArchiveView, MonthArchiveView,\
    WeekArchiveView, DayArchiveView, TodayArchiveView,\
    DetailView, ListView, ArchiveIndexView

from possiblecity.text.models import Entry
from possiblecity.text.views import *

urlpatterns = patterns(
    '',
    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"),
示例#14
0
# blog/urls.py

from django.conf.urls import include, patterns, url
from django.views.generic import YearArchiveView, MonthArchiveView,\
    WeekArchiveView, DayArchiveView, TodayArchiveView,\
    DetailView, ListView, ArchiveIndexView

from .models import Entry
from .views import *

urlpatterns = patterns('',
    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'),
示例#15
0
    'date_field': 'publish_date',
    'allow_empty': True
}

print_info_dict = dict(info_dict.items() + [('template_name', 'stories/story_print.html')])
print_info_dict.pop('allow_empty')

comment_info_dict = dict(info_dict.items() + [('template_name', 'stories/story_comments.html')])
comment_info_dict.pop('allow_empty')

urlpatterns = patterns('',

    # news archive index
    url(
        r'^$',
        ArchiveIndexView.as_view(**info_dict),
        name='news_archive_index'
    ),
    # news archive year list
    url(
        r'^(?P<year>\d{4})/$',
        YearArchiveView.as_view(**info_dict),
        name='news_archive_year'
    ),
    # news archive month list
    url(
        r'^(?P<year>\d{4})/(?P<month>\w{3})/$',
        MonthArchiveView.as_view(**info_dict),
        name='news_archive_month'
    ),
    # news archive week list
示例#16
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")
)
示例#17
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'
    ),
)
示例#18
0
 '',
 #url(r'^$', 'blog.views.index'),
 # List view for posts
 url(r'^$',
     ListView.as_view(
         queryset=Post.objects.order_by('-date'),
         context_object_name="posts",
         template_name='blog.html',
         paginate_by=5,
     ),
     name="blog-index"),
 # Index view for post archive
 url(r'^archive/$',
     ArchiveIndexView.as_view(
         model=Post,
         date_field='date',
         template_name='archive.html',
         paginate_by=20,
     ),
     name="blog-archive"),
 # Detail view for post
 url(r'^post/(?P<slug>[-\w]+)/$',
     DetailView.as_view(
         model=Post,
         template_name='detail.html',
     ),
     name="blog-detail"),
 # List view for tag archive
 url(r'^archive/([-\w]+)/$',
     TagArchiveListView.as_view(
         context_object_name="latest",
         template_name="archive.html",
示例#19
0
                       url(r'^incidents/manage/(?P<pk>\d+)/$',
                           permission_required('operations.change_event', reverse_lazy('home'))(
                               UpdateViewWithMessages.as_view(form_class=EventForm,
                                                              pk_url_kwarg='pk',
                                                              queryset=Event.objects.all(),
                                                              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'),
示例#20
0
# router.register(r'my-model/', ExampleView)

urlpatterns = [
    path('posts/<slug:slug>/', SinglePost.as_view(), name='single_post'),
    path('categories/<slug:slug>/',
         CategoryPosts.as_view(),
         name="category_posts"),
    path('categories/', Categories.as_view(), name='show_categories'),
    path('', main_page, name="main_page"),
    path('like_comment/', comment_like, name='like_comment'),
    path('posts/', PostsView.as_view(), name='posts_archive'),
    path('comment/', create_comment, name='comment_create'),
    path('authors/<slug:slug>/', AuthorsPosts.as_view(), name="authors_posts"),
    path('latest/',
         ArchiveIndexView.as_view(model=Post,
                                  date_field='create_at',
                                  template_name='blog/posts.html',
                                  context_object_name='post_list'),
         name="latest_posts"),
    path('monthly/<int:year>/<int:month>/',
         ArticleMonthArchiveView.as_view(month_format='%m'),
         name="archive_month_numeric"),
    path('<int:year>/week/<int:week>/',
         ArticleWeekArchiveView.as_view(),
         name="archive_week"),
    path('show_month/', ShowMonthly.as_view(), name='show_month'),
    path('show_week/', ShowWeekly.as_view(), name='show_week'),
    path('search/', SearchField.as_view(), name='search'),
    path('api/comments/', comment_list, name='comment_list'),
    path('api/comments/<int:pk>/', comment_detail, name='comment_detail'),
    path('api/respina', respina_view, name='example_view')
]
示例#21
0
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"),
)
示例#22
0
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})/$',
示例#23
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'),
)
示例#24
0
 url(r'^incidents/manage/(?P<pk>\d+)/$',
     permission_required('operations.change_event', reverse_lazy('home'))(
         UpdateViewWithMessages.as_view(
             form_class=EventForm,
             pk_url_kwarg='pk',
             queryset=Event.objects.all(),
             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})/$',
示例#25
0
    # 로그인 안했으면 비공개 포스팅은 볼 수 없다.
    def get_queryset(self):
        qs = super().get_queryset()
        if not self.request.user.is_authenticated:
            qs = qs.filter(is_public=True)
        return qs


# 정의된 Class로 실행.
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=5, date_list_period="month",
)

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

# def archives_slug(request, slug):
#     return HttpResponse(f"{slug} 입니다.")


def melon_list(request):
    return render(request, "instagram/melon_list.html", {})
示例#26
0

# 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)
示例#27
0
from django.conf.urls import patterns, include, url
# Uncomment the next two lines to enable the admin:
from django.contrib import admin
from django.conf import settings
from django.views.generic import ArchiveIndexView
from blog.models import Blog
admin.autodiscover()
urlpatterns = patterns(
    '',
    # Examples:
    # url(r'^$', 'siliqua.views.home', name='home'),
    # url(r'^siliqua/', include('siliqua.foo.urls')),

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

    # Uncomment the next line to enable the admin:
    url(r'^admin/', include(admin.site.urls)),
    (r'^$', 'blog.views.index'),
    url(r'^blog/view/(?P<slug>[^\.]+).html',
        'blog.views.view_post',
        name='view_blog_post'),
    url(r'^blog/category/(?P<slug>[^\.]+).html',
        'blog.views.view_categoria',
        name='view_blog_categoria'),
    (r'^media/(.*)$', 'django.views.static.serve', {
        'document_root': settings.MEDIA_ROOT
    }),
    url(r'^$', ArchiveIndexView.as_view(model=Blog, date_field='posted')),
)