本文整理汇总了Python中core.views.HomeView类的典型用法代码示例。如果您正苦于以下问题:Python HomeView类的具体用法?Python HomeView怎么用?Python HomeView使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了HomeView类的10个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: test_home_view
def test_home_view(rf):
from core.views import HomeView
# course = mommy.make('Course')
request = rf.get('/')
view = HomeView(request=request)
response = view.get(request)
assert response.status_code == 200
示例2: url
"""isobar URL Configuration
The `urlpatterns` list routes URLs to views. For more information please see:
https://docs.djangoproject.com/en/1.8/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. Add an import: from blog import urls as blog_urls
2. Add a URL to urlpatterns: url(r'^blog/', include(blog_urls))
"""
from django.conf.urls import include, url
from django.contrib import admin
from core.views import HomeView, Articles, ArticleDetail, cool_view
urlpatterns = [
url(r'^cool-view$', cool_view),
url(r'^$', HomeView.as_view()),
url(r'^articles/$', Articles.as_view()),
url(r'^articles/(?P<pk>[0-9]+)/$', ArticleDetail.as_view()),
url(r'^admin/', include(admin.site.urls)),
]
示例3: url
from django.conf.urls import url
from core.views import CadastroView
from core.views import LoginView
from core.views import HomeView
urlpatterns = [
url(r'^cadastro/$', CadastroView.as_view(), name='cadastro'),
url(r'^login/$', LoginView.as_view(), name='login'),
url(r'^$', HomeView.as_view(), name='home'),
]
示例4: url
from django.core.urlresolvers import reverse_lazy
from django.conf.urls import url
from django.contrib.auth import views
from core.views import HomeView, UserAuthView, UserCreateView
urlpatterns = [
url(r'^$',
HomeView.as_view(),
name='home'),
url(r'^login/$',
UserAuthView.as_view(),
name='login'),
url(r'^logout/$',
views.logout,
{'next_page': reverse_lazy('core:home')},
name='logout'),
url(r'^signup/$',
UserCreateView.as_view(),
name='signup'),
]
示例5: patterns
from django.conf.urls import patterns, include, url
from django.contrib import admin
from django.contrib.auth.decorators import login_required
from auth.views import LandingView
from core.views import AboutView, HomeView, PostView
admin.autodiscover()
urlpatterns = patterns('',
url(r'^admin/', include(admin.site.urls)),
#
#CAS
url(r'^accounts/login/$', 'cas.views.login', name='login'),
url(r'^accounts/logout/$', 'cas.views.logout', name='logout'),
#OTHER LOGIN
# url(r'^alt_login/$','auth.views.alt_login', name='alt_login'),
#APP
url(r'^$', LandingView.as_view(), name='login'),
url(r'^home/?$', login_required(HomeView.as_view()), name='home'),
url(r'^about/?$', AboutView.as_view(), name='about'),
#post urls
url(r'^posts/new/?$', login_required(PostView.as_view()), name='post_view'),
url(r'^posts/(?P<post_id>\d+)/?$', login_required(PostView.as_view()), name='post_view')
)
示例6: import
# django
from django.conf.urls import include, url, patterns
from django.conf.urls.i18n import i18n_patterns
from django.contrib import admin
# rest
from rest_framework.routers import DefaultRouter
# mac
from core.views import HomeView
from core.api import (
AuctionHouseViewSet, ExpertViewSet, NewsletterEmailViewSet
)
admin.autodiscover()
router = DefaultRouter()
router.register(r'auctionhouse', AuctionHouseViewSet)
router.register(r'expert', ExpertViewSet)
router.register(r'newsletter', NewsletterEmailViewSet)
urlpatterns = patterns('',
url(r'^api/', include(router.urls)),
)
urlpatterns += i18n_patterns('',
url(r'^admin', include(admin.site.urls)),
url(r'^', include('cms.urls')),
(r'^', HomeView.as_view()),
)
示例7: url
url(r'^access-forbidden/$', AccessForbiddenView.as_view(), name='access_forbidden'),
# Email handling
url(r'^ggv/(?P<crs_slug>[-\w]+)/email-question/worksheet/(?P<i>\d+)/(?P<j>\d+)/$', SendEmailWorksheetQuestionToInstructorsView.as_view(), name='email_instructor_question'),
url(r'^ggv/(?P<crs_slug>[-\w]+)/email-error/worksheet/(?P<i>\d+)/(?P<j>\d+)/$', SendEmailWorksheetErrorToStaffView.as_view(), name='email_staff_ws_error'),
url(r'^ggv/(?P<crs_slug>[-\w]+)/email-instructor/$', SendEmailToInstructor.as_view(), name='email_instructor'),
url(r'^ggv/(?P<crs_slug>[-\w]+)/email-manager/deactivate$', SendEmailToManagerDeactivationRequest.as_view(), name='email_manager_deactivate'),
url(r'^ggv/(?P<crs_slug>[-\w]+)/email-manager/activate$', SendEmailToManagerActivationRequest.as_view(), name='email_manager_activate'),
url(r'^ggv/(?P<crs_slug>[-\w]+)/email-manager/new-account$', SendEmailToManagerCreateAccountRequest.as_view(), name='email_manager_request_account'),
# Administration pages
url(r'^admin/doc/', include('django.contrib.admindocs.urls')),
url(r'^ggvadmin/filebrowser/', include(site.urls)),
url(r'^grappelli/', include('grappelli.urls')), # grappelli URLS
url(r'^ggvadmin', admin.site.urls, name='staff_admin'), # admin site
url(r'^faq/$', FaqView.as_view(), name='faq'),
url(r'^home/$', HomeView.as_view(), name='ggvhome'),
url(r'^', IndexView.as_view(), name='splash'),
]
# if settings.DEBUG:
# urlpatterns += static(settings.MEDIA_URL, document_root=settings.MEDIA_ROOT)
# urlpatterns += static(settings.STATIC_URL, document_root=settings.STATIC_ROOT)
示例8: patterns
DashboardView,
CampView,
CampListView,
SessionCreateView,
SessionEditView,
SessionView,
)
from django.contrib import admin
admin.autodiscover()
urlpatterns = patterns(
"",
# Examples:
# url(r'^$', 'barcamp.views.home', name='home'),
# url(r'^blog/', include('blog.urls')),
url(r"^admin/", include(admin.site.urls)),
url(r"^dashboard/", DashboardView.as_view(), name="dashboard"),
url(r"^accounts/register/", RegisterView.as_view(), name="register"),
url(r"^accounts/login/", LoginView.as_view(), name="login"),
url(r"^accounts/logout/", LogoutView.as_view(), name="logout"),
url(r"^camps/$", CampListView.as_view(), name="camp_list"),
url(
r"^(?P<camp>[-_a-zA-Z0-9]+)/(?P<session>[-_a-zA-Z0-9]+)/edit/$", SessionEditView.as_view(), name="session_edit"
),
url(r"^(?P<camp>[-_a-zA-Z0-9]+)/(?P<session>[-_a-zA-Z0-9]+)/$", SessionView.as_view(), name="session_view"),
url(r"^(?P<camp>[-_a-zA-Z0-9]+)/session/create/$", SessionCreateView.as_view(), name="session_create"),
url(r"^(?P<camp>[-_a-zA-Z0-9]+)/$", CampView.as_view(), name="camp"),
url(r"^$", HomeView.as_view(), name="home_view"),
)
示例9: getattr
from django.views.decorators.cache import cache_page
admin.autodiscover()
from api import feeds # noqa: E402
from core.views import HomeView, MaintenanceView, ReportView, ReportThanksView # noqa: E402
MAINTENANCE_MODE = getattr(settings, 'MAINTENANCE_MODE', False)
if MAINTENANCE_MODE:
urlpatterns = [
url(r'.*', MaintenanceView.as_view(), name='maintenance_view'),
]
else:
urlpatterns = [
url(r'^$', cache_page(60 * 5)(HomeView.as_view()), name='home'),
url(r'^leaflets/', include('leaflets.urls')),
url(r'^parties/', include('parties.urls')),
url(r'^person/', include('people.urls')),
url(r'^constituencies/', include('constituencies.urls')),
url(r'^analysis/', include('analysis.urls')),
url(r'^tags/', include('tags.urls')),
url(r'^categories/', include('categories.urls')),
url(r'^api/', include('api.urls')),
# Feeds
url(r'^feeds/latest/$', feeds.LatestLeafletsFeed(), name='latest_feed'),
url(r'^feeds/constituency/(?P<cons_slug>[\w_\-\.]+)/$', feeds.ConstituencyFeed(), name='constituency_feed'),
url(r'^feeds/category/(?P<cat_slug>[\w_\-\.]+)/$', feeds.CategoryFeed(), name='category_feed'),
url(r'^feeds/tag/(?P<tag_slug>[\w_\-\.]+)/$', feeds.TagFeed(), name='tag_feed'),
示例10: url
from django.conf.urls.static import static
from django.views.generic import TemplateView, RedirectView
from core.views import HomeView
# Uncomment the next two lines to enable the admin:
from django.contrib import admin
admin.autodiscover()
urlpatterns = [
# Uncomment the next line to enable the admin:
url(r'^admin/', include(admin.site.urls)),
url(r'^accounts/', include('allauth.urls')),
url(r'^logout/$', 'django.contrib.auth.views.logout',
{'next_page': '/'}, name='auth_logout'),
url(r'^$', HomeView.as_view(), name="home"),
url(r'thanks/$', TemplateView.as_view(template_name="thanks.html")),
url(r'thanks/finished$', TemplateView.as_view(template_name="thanks_finished.html")),
url(r'^about/$', TemplateView.as_view(template_name="about.html"), name="about"),
url(r'^data/$', TemplateView.as_view(template_name="data.html"), name="data"),
url(r'^privacy/$', TemplateView.as_view(template_name="privacy.html"), name="privacy"),
url(r'^projects/$', TemplateView.as_view(template_name="projects.html"), name="projects"),
url(r'^projects/polling-stations/$',
TemplateView.as_view(template_name="polling-stations/home.html"),
name="polling_one_pager"
),
url(r'^projects/polling-stations/technical/$',
TemplateView.as_view(template_name="polling-stations/technical.html"),
name="polling_technical_explainer"
),
url(r'^projects/polling-stations/techincal/$',