def test_template_view(self): view = TemplateView.as_view(template_name="example.html") response = self.get(view) self.assertEqual(response.status_code, 200) self.assertEqual(response.template_name, ["example.html"]) self.assertContext(response, {"view": InstanceOf(View)})
from django.conf.urls import patterns, include, url from django.contrib import admin from vanilla import TemplateView from prereg.views import SignupView admin.autodiscover() urlpatterns = patterns('', url(r'^$', TemplateView.as_view(template_name='home.html'), name='home'), url(r'^admin/', include(admin.site.urls)), url( r'^exams/(?P<location_slug>[-\w]+)/(?P<session_id>\d+)/signup/$', SignupView.as_view(), name='prereg-signup'), url(r'^exams/', include('schedule.urls', namespace='schedule')), url(r'^accounts/', include('prereg.registration_urls')), )
# -*- coding: utf-8 -*- from django.conf.urls import patterns, include, url from modelo_quest.apps.treinamentoOOP.models import * from modelo_quest.apps.treinamentoOOP.views import * from modelo_quest.apps.treinamentoOOP.forms import * from vanilla import CreateView, DeleteView, ListView, UpdateView, TemplateView from django.contrib import admin urlpatterns = patterns( "", url(r"^admin/", include(admin.site.urls)), url(r"^$", TemplateView.as_view(template_name="home.html")), url(r"^template/$", carregarTemplate3.as_view(name="Jaff Cunha")), # # CBV url(r"^cadastrarCBV/$", CadastrarCBV.as_view(tipoForm=DocenteForm), name="cadastrar cbv"), # url(r'^listarCBV/$', ListarCBV.as_view(tipoForm=DocenteForm), # name='listar cbv'), # # CBGV url(r"^cadastrarGV/$", CadastrarGV.as_view(), name="cadastrar gv"), url(r"^listarGV/$", ListarGV.as_view(), name="listar gv"), url(r"^detalharGV/(?P<pk>\d+)/$", DetalharGV.as_view(), name="detalhar gv"), url(r"^editarGV/(?P<pk>\d+)/$", EditarGV.as_view(), name="editar gv"), url(r"^deletarGV/(?P<pk>\d+)/$", DeletarGV.as_view(), name="deletar gv"), )
from TFG.apps.handlererrors.views import Error403, Error404, Error500 from TFG.apps.user.views import Index from vanilla import TemplateView from django.core import exceptions from TFG.apps.user.views import ClientViewErrors # from registration.views import RegistrationView admin.autodiscover() urlpatterns = [ # Examples: # url(r'^$', 'TFG.views.home', name='home'), # url(r'^blog/', include('blog.urls')), url(r'^$', Index.as_view(), name='index'), url(r'^cookies$', TemplateView.as_view(template_name="cookies.html"), name='cookies'), url(r'^$', login, {'template_name': 'user/login.html'}, name='login'), url(r'^logout/$', logout_then_login, name='logout'), # url(r'^', include('TFG.apps.handlererrors.urls')), # url(r'^db', TFG.apps.index.views.db, name='db'), url(r'^admin/', include(admin.site.urls)), url(r'^chaining/', include('smart_selects.urls')), url(r'^user/', include('TFG.apps.user.urls')), url(r'^test/', include('TFG.apps.test.urls')), url(r'^subject/', include('TFG.apps.subject.urls')), url(r'^search/', include('TFG.apps.search.urls')), url(r'^s3direct/', include('s3direct.urls')), # url(r'^test/', include('TFG.apps.test.urls')),
import json from django.http import JsonResponse from django.contrib.auth.decorators import permission_required from vanilla import TemplateView from .commands import query_player_coords from .models import WebOperator webop = TemplateView.as_view(template_name='minecraft/webop.html') webop = permission_required('minecraft.is_op')(webop) spectator = TemplateView.as_view(template_name='minecraft/spectator.html') spectator = permission_required('minecraft.gamemode_spectator')(spectator) @permission_required('minecraft.gamemode_spectator') def gamemode_spectator(request): """ Toggle between spectator and survival mode. """ if request.method != 'POST': return JsonResponse({'status': 'FAIL', 'error': 'Use POST.'}) try: webop = request.user.webop except WebOperator.DoesNotExist: return JsonResponse({'status': 'FAIL', 'error': 'You are not allowed to perform this action.'}) if webop.is_spectator(): webop.log_action('gamemode survival')
def test_misconfigured_template_view(self): # A template view with no `template_name` is improperly configured. view = TemplateView.as_view() self.assertRaises(ImproperlyConfigured, self.get, view)
from app.models import * from app.views import * from app.forms import * from vanilla import CreateView, DeleteView, ListView, UpdateView, TemplateView from django.contrib import admin from django.conf.urls import include, url urlpatterns = [ url(r'^admin/', include(admin.site.urls)), url(r'^$', TemplateView.as_view(template_name="home.html")), # # CBV url(r'^cadastrarCBV/$', CadastrarCBV.as_view(tipoForm=AutorForm), name='cadastrar cbv'), url(r'^templateCBV/$', templateCBV.as_view()), # # GenericViews url(r'^templateGV/$', templateGenerics.as_view()), url(r'^cadastrarGV/$', CadastrarGenerics.as_view(), name='cadastrar generics'), url(r'^listarGV/$', ListarGenerics.as_view(), name='listar generics'), url(r'^detalharGV/(?P<pk>\d+)/$', DetalharGenerics.as_view(), name='detalhar gv'), url(r'^editarGV/(?P<pk>\d+)/$', EditarGenerics.as_view(), name='editar generics'), url(r'^deletarGV/(?P<pk>\d+)/$', DeletarGenerics.as_view(),
bucket_list_patterns = [ path('', views.BucketListsView.as_view(), name='buckets'), path('<int:pk>/', views.BucketListView.as_view(), name='bucket'), path('<int:pk>/<str:username>/', views.BucketListView.as_view(), name='bucket'), path('<int:pk>/<path:usernames>/', views.BucketListComparisonView.as_view(), name='bucket-comparison'), ] app_name = 'travel' urlpatterns = [ path('api/v1/', include(api_urls)), path('search', views.SearchView.as_view(), name='search'), path('search/advanced/', views.AdvancedSearchView.as_view(), name='search-advanced'), path('i/<str:ref>/', include(item_patterns)), path('profiles/', include(profile_patterns)), path('buckets/', include(bucket_list_patterns)), path('languages/', views.LanguagesView.as_view(), name='languages'), path('languages/<int:pk>/', views.LanguageView.as_view(), name='language'), path('flags/', views.FlagGameView.as_view(), name='flag-quiz'), path('plugs/', TemplateView.as_view(template_name='travel/plugs.html'), name='plugs'), ]
from django.conf.urls import patterns, url from vanilla import TemplateView from ...urls import LOGGED_IN_USER from . import views as v urlpatterns = patterns( "", # -- podcasts -------------------------------------- url(r"^$", name="index", view=v.PodcastList.as_view()), url( r"^register/$", name="register", view=TemplateView.as_view(template_name="placeholder.html"), kwargs={"login_required": True}, ), url(r"^(?P<pk>\d+)/$", name="detail", view=v.PodcastDetail.as_view()), url(r"^(?P<pk>\d+)-(?P<slug>[\w-]+)/$", name="detail_slug", view=v.PodcastDetail.as_view()), # -- episodes -------------------------------------- url(r"^(?P<podcast_pk>\d+)/episodes/(?P<pk>\d+)/$", name="episode_detail", view=v.EpisodeDetail.as_view()), url( r"^(?P<podcast_pk>\d+)/episodes/(?P<pk>\d+)-(?P<slug>[\w-]+)/$", name="episode_detail_slug", view=v.EpisodeDetail.as_view(), ), url( r"^(?P<podcast_pk>\d+)/episodes/(?P<pk>\d+)/create_transcript/$", name="episode_create_transcript", view=v.EpisodeCreateTranscript.as_view(), kwargs=LOGGED_IN_USER,
from django.urls import path from vanilla import TemplateView from medusa_website.frontend.views import AboutView, ContactView, PublicationsView, ResourcesView, TCSSView app_name = "frontend" urlpatterns = [ path("", view=TemplateView.as_view(template_name="frontend/index.html"), name="index"), path("index/", view=TemplateView.as_view(template_name="frontend/index.html"), name="index"), path("elements/", view=TemplateView.as_view(template_name="frontend/elements.html"), name="elements"), path("generic/", view=TemplateView.as_view(template_name="frontend/generic.html"), name="generic"), path("events/", view=TemplateView.as_view(template_name="frontend/events.html"), name="events"), path("about/", view=AboutView.as_view(), name="about"), path("contact/", view=ContactView.as_view(), name="contact"), path("publications/", view=PublicationsView.as_view(), name="publications"), path("resources/", view=ResourcesView.as_view(), name="resources"), path("tcss/", view=TCSSView.as_view(), name="tcss"), path("feedback/", view=TemplateView.as_view(template_name="frontend/feedback.html"), name="feedback"),
from Nutzer.models import Nutzerprofil app_name = 'Nutzer' auth_urls = ([ path('registrieren/', CreateUserView.as_view(), name='registrieren'), path('anmelden/', LoginView.as_view(template_name='Nutzer/anmelden.html', success_url='/'), name='anmelden'), path('abmelden/', LogoutView.as_view(template_name='Nutzer/abgemeldet.html', success_url='/'), name='abmelden'), path('/', include('authtools.urls')) ], 'auth') profil_urls = ( [ path('meine_daten/', ProfileView.as_view(), name='meine_daten'), path('mail_wurde_versandt/', TemplateView.as_view( template_name='Nutzer/info_mail_versandt.html'), name='mail_wurde_versandt'), path('meine_email_aendern/', UpdateEmailView.as_view(), name='email_aendern'), #path('<pk>/', DetailView.as_view(model=Nutzerprofil, template_name='Nutzer/profil.html'), name='profilansicht'), ], 'Nutzer')
from django.conf.urls import patterns, url from vanilla import TemplateView from ...urls import LOGGED_IN_USER from . import views as v urlpatterns = patterns( '', # -- podcasts -------------------------------------- url(r'^$', name='index', view=v.PodcastList.as_view()), url(r'^register/$', name='register', view=TemplateView.as_view(template_name='placeholder.html'), kwargs={'login_required': True}), url(r'^(?P<pk>\d+)/$', name='detail', view=v.PodcastDetail.as_view()), url(r'^(?P<pk>\d+)-(?P<slug>[\w-]+)/$', name='detail_slug', view=v.PodcastDetail.as_view()), # -- episodes -------------------------------------- url(r'^(?P<podcast_pk>\d+)/episodes/(?P<pk>\d+)/$', name='episode_detail', view=v.EpisodeDetail.as_view()), url(r'^(?P<podcast_pk>\d+)/episodes/(?P<pk>\d+)-(?P<slug>[\w-]+)/$', name='episode_detail_slug', view=v.EpisodeDetail.as_view()), url(r'^(?P<podcast_pk>\d+)/episodes/(?P<pk>\d+)/create_transcript/$', name='episode_create_transcript', view=v.EpisodeCreateTranscript.as_view(), kwargs=LOGGED_IN_USER),