Exemple #1
0
from django.conf.urls import patterns, include, url
from django.contrib import admin
from events.views import EventsListView, EventDetailView

urlpatterns = patterns('',
    # Examples:
    url(r'^$', EventsListView.as_view(), name='home'),
    url(r'^events/(?P<slug>[\w-]+)/$', EventDetailView.as_view(),
    name='events'),

    url(r'^admin/', include(admin.site.urls)),
)
from django.conf.urls import url, patterns

from events.views import EventsListView, ics


urlpatterns = patterns('',
    url(r'^$', EventsListView.as_view(), name='events-list'),
    url(r'^ics/(?P<event_id>\d+)/$', ics,  name='ics_download')
)
Exemple #3
0
    EventsListView,
    LocationDetailView,
    LocationsListView,
    EventInviteDownloadView,
)
from events.feeds import Calendar

slug = '(?P<slug>[-\\w\\d]+)'
pk = '(?P<pk>[0-9]+)'
date = '(?P<date>[0-9]{4}-?[0-9]{2}-?[0-9]{2})'
event_path = f'{date}/{slug}/{pk}/$'

urlpatterns = [
    # location
    path('location/<slug:slug>/<int:pk>/',
         LocationDetailView.as_view(),
         name='location'),
    path('locations/', LocationsListView.as_view(), name='locations'),

    # event
    re_path(r'^{}'.format(event_path), EventDetailView.as_view(),
            name='event'),
    path('invite/<int:pk>/',
         EventInviteDownloadView.as_view(),
         name='event-invite'),
    path('', EventsListView.as_view(), name='events'),

    # calendar
    path('feed/ical/', Calendar(), name='calendar'),
]
Exemple #4
0
 def test_events_uses_view_as_class_based_view(self):
     """тест: использование представления Events как Class-Based view"""
     self.assertEqual(
         self.response.resolver_match.func.__name__,
         EventsListView.as_view().__name__)
Exemple #5
0
"""gtbitweb URL Configuration

The `urlpatterns` list routes URLs to views. For more information please see:
    https://docs.djangoproject.com/en/1.10/topics/http/urls/
Examples:
Function views
    1. Add an import:  from my_app import views
    2. Add a URL to urlpatterns:  url(r'^$', views.home, name='home')
Class-based views
    1. Add an import:  from other_app.views import Home
    2. Add a URL to urlpatterns:  url(r'^$', Home.as_view(), name='home')
Including another URLconf
    1. Import the include() function: from django.conf.urls import url, include
    2. Add a URL to urlpatterns:  url(r'^blog/', include('blog.urls'))
"""
from django.conf.urls import url
from django.contrib import admin
from notice.views import NoticeListView
from events.views import EventsListView

urlpatterns = [
    url(r'^admin/', admin.site.urls),
    url(r'^notice/$',
        NoticeListView.as_view(template_name="index.html"),
        name='notice_list'),
    url(r'^events/$',
        EventsListView.as_view(template_name="events.html"),
        name='events_list'),
]