• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

Python views.IndexView类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了Python中views.IndexView的典型用法代码示例。如果您正苦于以下问题:Python IndexView类的具体用法?Python IndexView怎么用?Python IndexView使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。



在下文中一共展示了IndexView类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Python代码示例。

示例1: test_view_IndexView

    def test_view_IndexView(self):
        """
        Funcion que realiza el test sobre la vista UserIndexView que genera
        lista de usuarios
        """
        # se loguea el usuario testuser
        user = self.client.login(username='testuser', password='test')
        self.assertTrue(user)
        user2 = User.objects.create_user(username='user_prueba', email='[email protected]', password='prueba')
        # se crean 10 proyectos para controlar que se retorne la lista completa de usuarios, que seran 11 en total
        for i in range(10):
            proyecto = Proyecto.objects.create(codigo='co%s' % i, nombre_corto='test%s' % i,
                                               nombre_largo='test%s' % i, cancelado=False, scrum_master=user2)


        # verificamos que la vista devuelva el template adecuado
        request = self.factory.get('/proyectos/')
        view = IndexView.as_view()
        response = view(request)
        self.assertEqual(response.status_code, 200)
        self.assertEqual(response.template_name[0], 'proyectos/index.html')
        # verificamos los usuarios retornados
        self.assertEqual(len(response.context_data['object_list']), 10)

        print 'Test de IndexView de Proyecto realizado exitosamente'
开发者ID:frvc123,项目名称:sigp,代码行数:25,代码来源:tests.py


示例2: test_should_redirects_if_user_is_not_logged_in

 def test_should_redirects_if_user_is_not_logged_in(self):
     request = RequestFactory().get("/")
     user = User()
     user.is_authenticated = lambda: False
     request.user = user
     result = IndexView.as_view()(request)
     self.assertEqual(302, result.status_code)
开发者ID:pugpe,项目名称:pythonbrasil8,代码行数:7,代码来源:tests.py


示例3: test_view_IndexView

    def test_view_IndexView(self):
        """
        Funcion que realiza el test sobre la vista IndexView que genera
        lista de sprints
        """
        # se loguea el usuario testuser
        user = self.client.login(username='testuser', password='test')
        self.assertTrue(user)
        user2 = User.objects.create_user(username='user_prueba', email='[email protected]', password='prueba')

        proyecto = Proyecto.objects.create(codigo='codi', nombre_corto='test',
                                           nombre_largo='test', cancelado=False, scrum_master=user2)
        proyecto.save()

        # se crean 10 sprints para controlar que se retorne la lista completa de sprints, que seran 10 en total
        for i in range(10):
            sprint = Sprint.objects.create(nombre='sprint%s' % i, duracion='%d' % i, proyecto=proyecto)
            sprint.save()

        # verificamos que la vista devuelva el template adecuado
        request = self.factory.get(reverse('sprints:index', args=[proyecto.pk]))
        request.user = self.user

        response = IndexView.as_view()(request, pk_proyecto=proyecto.pk)
        self.assertEqual(response.status_code, 200)
        self.assertEqual(response.template_name[0], 'sprints/index.html')
        # verificamos los user stories retornados
        self.assertEqual(len(response.context_data['object_list']), 10)

        print 'Test de IndexView de Sprints realizado exitosamente'
开发者ID:rodiaz,项目名称:sigp,代码行数:30,代码来源:tests.py


示例4: init_app

    def init_app(self, app):
        """Initializes the App.

        Args:
            app (TYPE): Description

        Returns:
            TYPE: Description
        """

        config = app.config.copy()

        self.debug = config.get('PONYWHOOSH_DEBUG', self.debug)
        self.indexes_path = config.get('PONYWHOOSH_INDEXES_PATH',  self.indexes_path)
        self.search_string_min_len = config.get('PONYWHOOSH_MIN_STRING_LEN', self.search_string_min_len)
        self.writer_timeout = config.get('PONYWHOOSH_WRITER_TIMEOUT', self.writer_timeout)
        self.url_route = config.get('PONYWHOOSH_URL_ROUTE', self.url_route)
        self.template_path = config.get('PONYWHOOSH_TEMPLATE_PATH', self.template_path)

        if self.debug:
            print 'PONYWHOOSH_DEBUG -> ', self.debug
            print 'PONYWHOOSH_INDEXES_PATH  -> ', self.indexes_path
            print 'PONYWHOOSH_MIN_STRING_LEN  -> ', self.search_string_min_len
            print 'PONYWHOOSH_WRITER_TIMEOUT -> ', self.writer_timeout
            print 'PONYWHOOSH_TEMPLATE_PATH -> ', self.template_path
            print 'PONYWHOOSH_URL_ROUTE -> ',  self.url_route

        loader = jinja2.ChoiceLoader([
            app.jinja_loader,
            jinja2.FileSystemLoader(self.template_path)
        ])

        app.jinja_loader = loader
        app.add_url_rule(
            self.url_route,
            view_func=IndexView.as_view('ponywhoosh/', pw=self)
        )
开发者ID:compiteing,项目名称:flask-ponywhoosh,代码行数:37,代码来源:__init__.py


示例5: patterns

from django.conf.urls.defaults import patterns, url
from django.views.generic import ListView

from models import Video, TwitterFeed
from views import IndexView

urlpatterns = patterns('',
    url(r'^$', IndexView.as_view(), name='connect_index'),

    url(r'^video/$', ListView.as_view( 
            queryset=Video.objects.all().order_by('title'),
        ),
        name='connect_video_list'
    ),

    url(r'^twitter/$', ListView.as_view(
            queryset=TwitterFeed.objects.all().order_by('handle'),
        ),
        name='connect_twitterfeed_list'
    ),
)
开发者ID:ebrelsford,项目名称:cas_food,代码行数:21,代码来源:urls.py


示例6: patterns

# -*- encoding: utf-8 -*-
"""Defines all urls conf."""
from django.conf.urls import patterns, url
from django.contrib.auth.decorators import login_required
from views import IndexView, ProfileView, TestView, SaveTestView, CourseView

urlpatterns = patterns('',
	url(r'^$', login_required(IndexView.as_view()), name='dashboard'),
	url(r'^profile/$', login_required(ProfileView.as_view()), name='dashboard-profile'),
	url(r'^test/$', login_required(TestView.as_view()), name='dashboard-test'),
	url(r'^test/save/$', login_required(SaveTestView.as_view()), name='dashboard-save-test'),
	url(r'^(?P<course>\w{5,45})/$', login_required(CourseView.as_view()), name='dashboard-course'),
)
开发者ID:dairdr,项目名称:funpro,代码行数:13,代码来源:urls.py


示例7: patterns

    OpenTopicView,
    ModeratePost,
)


urlpatterns = patterns(
    "",
    # Syndication feeds
    url("^feeds/posts/$", LastPosts(), name="feed_posts"),
    url("^feeds/topics/$", LastTopics(), name="feed_topics"),
)

urlpatterns += patterns(
    "pybb.views",
    # Index, Category, Forum
    url("^$", IndexView.as_view(), name="index"),
    url("^category/(?P<pk>\d+)/$", CategoryView.as_view(), name="category"),
    url("^forum/(?P<pk>\d+)/$", ForumView.as_view(), name="forum"),
    # User
    url("^users/(?P<username>[^/]+)/$", UserView.as_view(), name="user"),
    url("^block_user/([^/]+)/$", "block_user", name="block_user"),
    # Profile
    url("^profile/edit/$", ProfileEditView.as_view(), name="edit_profile"),
    # Topic
    url("^topic/(?P<pk>\d+)/$", TopicView.as_view(), name="topic"),
    url("^topic/(?P<pk>\d+)/stick/$", StickTopicView.as_view(), name="stick_topic"),
    url("^topic/(?P<pk>\d+)/unstick/$", UnstickTopicView.as_view(), name="unstick_topic"),
    url("^topic/(?P<pk>\d+)/close/$", CloseTopicView.as_view(), name="close_topic"),
    url("^topic/(?P<pk>\d+)/open/$", OpenTopicView.as_view(), name="open_topic"),
    # Add topic/post
    url("^forum/(?P<forum_id>\d+)/topic/add/$", AddPostView.as_view(), name="add_topic"),
开发者ID:nigma,项目名称:pybbm,代码行数:31,代码来源:urls.py


示例8: patterns

# -*- encoding: utf-8 -*-
"""Defines all urls conf."""
from django.conf.urls import patterns, url
from views import IndexView, ProjectView, ContactView, ThanksView, ResultView, ResultByIndexView, WordView

urlpatterns = patterns('',
	url(r'^$', IndexView.as_view(), name='dictionary-index'), # index web
	url(r'^contact/$', ContactView.as_view(), name='dictionary-contact'), # contact page
	url(r'^project/$', ProjectView.as_view(), name='dictionary-project'), # project page
	url(r'^search/$', ResultView.as_view(), name='dictionary-search'), # search a word
	url(r'^index/(?P<letter>\w{1})/$', ResultByIndexView.as_view(), name='dictionary-search-by-index'), # search by index
	url(r'^word/(?P<word>\d+)/$', WordView.as_view(), name='dictionary-word'), # view a info word
	url(r'^thanks/$', ThanksView.as_view(), name='dictionary-thanks'), # response to sent message
)
开发者ID:dairdr,项目名称:lexicon,代码行数:14,代码来源:urls.py


示例9: test_should_have_200_status_code_when_user_is_logged_in

 def test_should_have_200_status_code_when_user_is_logged_in(self):
     request = RequestFactory().get("/")
     request.user = User()
     result = IndexView.as_view()(request)
     self.assertEqual(200, result.status_code)
开发者ID:pugpe,项目名称:pythonbrasil8,代码行数:5,代码来源:tests.py


示例10: patterns

#! /usr/bin/env python
# -*- coding: utf-8 -*-
#
# Copyright © 2014 george 
#
# Distributed under terms of the MIT license.

from django.conf.urls import patterns
from views import IndexView

urlpatterns = patterns('',
    (r'^$', IndexView.as_view()),
)

开发者ID:littleq0903,项目名称:fumoufeed,代码行数:13,代码来源:urls.py


示例11: patterns

# coding: utf-8

from django.conf.urls import patterns, include, url
from views import IndexView, ArticleDetailView
# admin
from django.contrib import admin
admin.autodiscover()

# xadmin
import xadmin
xadmin.autodiscover()


urlpatterns = patterns('',
    # Examples:
    url(r'^$', 'doit.views.home', name='home'),
    url(r'^index/', IndexView.as_view(), name='index_view'),
    url(r'^article/(?P<pk>[0-9]+)/$', ArticleDetailView.as_view(), name='article_detail'),
    # url(r'^blog/', include('blog.urls')),

    url(r'^admin/', include(admin.site.urls)),
    url(r'^xadmin/', include(xadmin.site.urls)),
)
开发者ID:guolee89,项目名称:doit,代码行数:23,代码来源:urls.py


示例12: patterns

# -*- encoding: utf-8 -*-
"""Defines all urls conf."""
from django.conf.urls import patterns, url
from django.contrib.auth.decorators import login_required
from views import IndexView, SavePanelView, ReviewPanelView, GroupsPanelView, StudentsPanelView
from api import Student, SavePanelStudent

urlpatterns = patterns('',
	url(r'^$', login_required(IndexView.as_view()), name='student-index'),

	# Panel
	url(r'^panel/manage/$', SavePanelView.as_view(), name='student-manage-panel'),
	url(r'^panel/review/$', ReviewPanelView.as_view(), name='student-review-panel'),
	url(r'^panel/groups/(?P<grade>\w{1,10})$', GroupsPanelView.as_view(), name='student-groups-panel'),
	url(r'^panel/students/(?P<grade>\w{1,10})/(?P<group>\w{1,10})$', StudentsPanelView.as_view(), name='student-students-panel'),

	# API
	url(r'^api/v1/students/$', Student.as_view(), name='student-api-students'),
	url(r'^api/v1/panel/manage/save/$', SavePanelStudent.as_view(), name='student-api-manage-panel-save'),
)
开发者ID:dairdr,项目名称:notes,代码行数:20,代码来源:urls.py


示例13: patterns

# pylint: disable=E1120

from django.conf.urls import patterns, url, include
from django.contrib import admin
from django.conf import settings
from views import TermsRequiredView, SecureView, IndexView
from django.views.decorators.cache import never_cache
from termsandconditions.decorators import terms_required
from django.contrib.auth.decorators import login_required

admin.autodiscover()

urlpatterns = patterns('',

    # Home Page
    url(r'^$', never_cache(IndexView.as_view()), name="tc_demo_home_page"),

    # Home Page
    url(r'^anon/$', never_cache(IndexView.as_view(template_name="index_anon.html")), name="tc_demo_home_anon_page"), #used for pipeline user test

    # Secure Page
    url(r'^secure/$', never_cache((login_required(SecureView.as_view()))), name="tc_demo_secure_page"),

    # Secure Page Too
    url(r'^securetoo/$', never_cache(login_required(SecureView.as_view(template_name="securetoo.html"))), name="tc_demo_secure_page_too"),

    # Terms Required
    url(r'^termsrequired/$', never_cache(terms_required(login_required(TermsRequiredView.as_view()))), name="tc_demo_required_page"),

    # Terms and Conditions
    url(r'^terms/', include('termsandconditions.urls')),
开发者ID:wamdam,项目名称:django-termsandconditions,代码行数:31,代码来源:urls.py


示例14: patterns

from django.conf.urls import patterns, include, url
from django.conf import settings
from office.views import OfficeSearchView
from django.contrib import admin
from django.contrib.staticfiles import views
from views import IndexView



urlpatterns = patterns('',
    # Examples:
    # url(r'^$', 'customrcare.views.home', name='home'),
    # url(r'^blog/', include('blog.urls')),
    url(r'^office/search', OfficeSearchView.as_view()),
    url(r'^admin/', include(admin.site.urls)),
    url(r'^$', IndexView.as_view(template_name = 'customrcare/index.html')),
    url(r'^static/css/bootstrap.min.css', 'django.views.static.serve',
    {'document_root', settings.STATIC_ROOT}),
)
开发者ID:Deepakdubey90,项目名称:customer-care,代码行数:19,代码来源:urls.py


示例15: url

from django.conf.urls import include, url
from views import IndexView, FetchView, ResultView, DetailView

urlpatterns = [
    url(r'^$', IndexView.as_view(), name='index'),
    url(r'^search/$', IndexView.as_view(), name='search_item'),
    url(r'^fetch/(?P<query>.+)/$', FetchView.as_view(), name='fetch_item'),
    url(r'^detail/(?P<pk>.+)/$', DetailView.as_view(), name='app_detail'),
    #url(r'^results/$', ResultView.as_view(), name='results'),
]
开发者ID:shriyanka,项目名称:googleplay,代码行数:10,代码来源:urls.py


示例16: patterns

# API endpoint for AccountViewSet
from rest_framework_nested import routers

from authentication.views import AccountViewSet

from views import IndexView

from django.conf.urls import include, patterns, url

router = routers.SimpleRouter()
router.register(r'accounts', AccountViewSet)

urlpatterns = patterns(
    '',

    url(r'^api/v1/', include(router.urls)),

    # Passthrough or catch-all route if not matched by a previous rule
    # passes the request through to a js router for processing
    url('^.*$', IndexView.as_view(), name='index'),
)
开发者ID:Blackfry,项目名称:ReactRefluxDjango,代码行数:21,代码来源:urls.py


示例17: patterns

    VenueCreate,
    EventCreate,
    EventList,
)
from api import LocationAPI, BookingsAPI, CustomersAPI, EventAPI

from django.contrib import admin

admin.autodiscover()

urlpatterns = patterns(
    "",
    # Examples:
    # url(r'^$', 'reserved.views.home', name='home'),
    # url(r'^blog/', include('blog.urls')),
    url(r"^$", IndexView.as_view()),
    url(r"^companies/$", CompanyList.as_view(), name="reserved_companies"),
    url(r"^events/$", EventList.as_view(), name="event_list"),
    url(r"^events/new/$", EventCreate.as_view(), name="event_create"),
    url(r"^venues/$", VenueList.as_view(), name="reserved_venues"),
    url(r"^venues/new/$", VenueCreate.as_view(), name="venues_create"),
    url(r"^venues/calendar/$", VenueCalendarView.as_view(), name="venues_calendar"),
    url(
        r"^venues/calendar/(?P<date_str>[0-9]{4}-[0-9]{2}-[0-9]{2})[/](?P<name_range>[\w]{0,}[^/])/$",
        VenueCalendarView.as_view(),
        name="reserved_venues__date_calendar",
    ),
    url(r"^bookings/$", BookingList.as_view(), name="reserved_bookings"),
    url(r"^bookings/new/$", BookingCreate.as_view(), name="bookings_create"),
    url(r"^bookings/detail/(?P<slug>[-_\w]+)/$", BookingDetail.as_view(), name="bookings_detail"),
    (r"^accounts/", include("userena.urls")),
开发者ID:hellsgate1001,项目名称:bookit,代码行数:31,代码来源:urls.py


示例18: DefaultRouter

__author__ = 'dheerendra'

from django.conf.urls import url, include
from views import LoginView, IndexView, LogoutView, AddNoticeView, UserNoticeViewset, UserEventsViewset, AddEventView, \
    AddNewsView, UserNewsViewset
from rest_framework.routers import DefaultRouter

router = DefaultRouter()
router.register('notice', UserNoticeViewset, base_name='content_notice')
router.register('event', UserEventsViewset, base_name='content_event')
router.register('news', UserNewsViewset, base_name='content_news')

urlpatterns = [
    url(r'^$', IndexView.as_view(), name='content_home'),
    url(r'^login/', LoginView.as_view(), name='login_page'),
    url(r'^logout/', LogoutView.as_view(), name='logout_page'),
    url(r'^add_notice/', AddNoticeView.as_view(), name='add_content_notice'),
    url(r'^add_event/', AddEventView.as_view(), name='add_content_event'),
    url(r'^add_news/', AddNewsView.as_view(), name='add_content_news'),
    url(r'^api/', include(router.urls)),
]
开发者ID:the-coders-hub,项目名称:IITBApp-Server,代码行数:21,代码来源:urls.py


示例19: patterns

from django.conf.urls import patterns, url
from views import IndexView, DeviceView, InterfaceView, ImportView, SetReferenceView

urlpatterns = patterns('',
    url(r"^$", IndexView.as_view(), name="optical_index"),
    url(r'^import/$', ImportView.as_view()),
    url(r"^set_reference/$", SetReferenceView.as_view(), name="optical_reference"),
    url(r"^(?P<ip>.*)/(?P<name>.*)/$", InterfaceView.as_view(), name="optical_iface"),
    url(r"^(?P<ip>.*)/$", DeviceView.as_view(), name="optical_device"),

)
开发者ID:Zagrebelin,项目名称:intranet_mrtg,代码行数:11,代码来源:urls.py


示例20: patterns

from django.conf.urls import patterns, include, url
from django.contrib import admin
from django.contrib.auth import views as auth_views
from views import IndexView, RedirectToIndexView, ProfileView, DomainEditView, DomainAddView, EmailListView, \
EmailEditView, EmailAddView, EmailEnableView, EmailDisableView, DNSRecordListView

admin.autodiscover()

urlpatterns = patterns('',
    url(r'^$', IndexView.as_view(), name="index"),
    url(r'^login/$', auth_views.login, {'template_name': 'auth/login.html'}, name="auth_login"),
    url(r'^logout/$', RedirectToIndexView.as_view(), name="auth_logout"),
    url(r'^hosting/', include('hosting.urls')),
    url(r'^domain/(?P<pk>\d+)/edit/$', DomainEditView.as_view(), name="edit-domain"),
    url(r'^domain/add/$', DomainAddView.as_view(), name="add-domain"),
    url(r'^domain/(?P<domain_id>\d+)/emails/$', EmailListView.as_view(), name="email-index"),
    url(r'^domain/(?P<domain_id>\d+)/email/add/$', EmailAddView.as_view(), name="email-add"),
    url(r'^domain/(?P<domain_id>\d+)/email/(?P<pk>\d+)/edit/$', EmailEditView.as_view(), name="email-edit"),
    url(r'^domain/(?P<domain_id>\d+)/email/(?P<email_id>\d+)/enable/$', EmailEnableView.as_view(), name="email-enable"),
    url(r'^domain/(?P<domain_id>\d+)/email/(?P<email_id>\d+)/disable/$', EmailDisableView.as_view(), name="email-disable"),
    url(r'^domain/(?P<domain_id>\d+)/dns/records/$', DNSRecordListView.as_view(), name="dns-index"),
    url(r'^profile/(?P<pk>\d+)/$', ProfileView.as_view(), name="profile"),
    url(r'^admin/', include(admin.site.urls)),
)
开发者ID:creativeprogramming,项目名称:amaterasu,代码行数:24,代码来源:urls.py



注:本文中的views.IndexView类示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
Python app.run函数代码示例发布时间:2022-05-26
下一篇:
Python views.HomeView类代码示例发布时间:2022-05-26
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap