本文整理汇总了Python中django.views.generic.FormView.as_view方法的典型用法代码示例。如果您正苦于以下问题:Python FormView.as_view方法的具体用法?Python FormView.as_view怎么用?Python FormView.as_view使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类django.views.generic.FormView
的用法示例。
在下文中一共展示了FormView.as_view方法的10个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: url
# 需要导入模块: from django.views.generic import FormView [as 别名]
# 或者: from django.views.generic.FormView import as_view [as 别名]
from django.conf.urls import url, include
from django.views.generic import FormView, TemplateView
from polls import forms
from polls import views
from polls.rest import router
urlpatterns = [
url(r'^$', views.PollListView.as_view(), name='poll_home'),
url(r'^rest/', include(router.urls), name='rest'),
url(r'^about/', views.AboutView.as_view(vistor="Changbin"), name='about'),
url(r'^bootstrap3/', FormView.as_view(template_name='polls/bootstrap3.html', form_class=forms.MyRegistrationForm),
name='bootstrap3'),
url(r'^(?P<pk>\d+)/$', views.DetailView.as_view(), name='detail'),
url(r'^(?P<pk>\d+)/results/$', views.ResultsView.as_view(), name='results'),
url(r'^(?P<poll_id>\d+)/vote/$', views.vote, name='vote'),
url(r'^jinja2/$', TemplateView.as_view(template_name="polls/jinja.jinja2"), {'words': 'Hello, Jinja2.'},
name='jinja2', ),
]
示例2: patterns
# 需要导入模块: from django.views.generic import FormView [as 别名]
# 或者: from django.views.generic.FormView import as_view [as 别名]
from django.conf.urls import patterns, url
from django.views.generic import FormView
from test_project.example_app.forms import Form1
urlpatterns = patterns('',
url(r'^',
FormView.as_view(
template_name="example_app/form1.html",
form_class=Form1,
),
name="form1"),
)
示例3: as_view
# 需要导入模块: from django.views.generic import FormView [as 别名]
# 或者: from django.views.generic.FormView import as_view [as 别名]
def as_view(cls, **kwargs):
return csrf_exempt(FormView.as_view(**kwargs))
示例4: patterns
# 需要导入模块: from django.views.generic import FormView [as 别名]
# 或者: from django.views.generic.FormView import as_view [as 别名]
# -*- coding: utf-8 -*-
from datetime import datetime
from django.conf.urls import patterns, url
from django.views.generic import FormView
from calendario.forms import SetupForm
urlpatterns = patterns('calendario',
url(r'^$', FormView.as_view(template_name='setup.html', form_class=SetupForm, initial={'semanas': 16, 'fecha_de_inicio': datetime.today()}), name='setup'),
url(r'^create/$', 'views.create', name='create'),
)
示例5: patterns
# 需要导入模块: from django.views.generic import FormView [as 别名]
# 或者: from django.views.generic.FormView import as_view [as 别名]
from django.conf.urls import patterns, url
from django.views.generic import TemplateView, FormView
from forms import ExampleForm
urlpatterns = patterns('',
url(r'^$', FormView.as_view(template_name='example.html', form_class=ExampleForm))
)
示例6: patterns
# 需要导入模块: from django.views.generic import FormView [as 别名]
# 或者: from django.views.generic.FormView import as_view [as 别名]
# -*- coding: utf-8 -*-
from django.conf.urls import patterns, url, include
from django.views.generic import FormView
from forms import UploadForm, UploadModelForm
urlpatterns = patterns('',
(r'^form/', FormView.as_view(form_class=UploadForm,
template_name="testmain/form.html",
success_url="/testapp/form")),
(r'^modelform/', FormView.as_view(form_class=UploadModelForm,
template_name="testmain/form.html",
success_url="/testapp/modelform"))
)
示例7: TestForm
# 需要导入模块: from django.views.generic import FormView [as 别名]
# 或者: from django.views.generic.FormView import as_view [as 别名]
from django.conf.urls import patterns, url
from django import forms
from django.views.generic import FormView
class TestForm(forms.Form):
"""An arbitrary form using most of available fields"""
date = forms.DateField()
date_time = forms.DateTimeField()
time = forms.TimeField()
number = forms.IntegerField()
email = forms.EmailField()
url = forms.URLField()
urlpatterns = patterns(
"",
# Examples:
url(r"^$", FormView.as_view(template_name="home.html", form_class=TestForm)),
# url(r'^demo_project/', include('demo_project.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)),
)
示例8: url
# 需要导入模块: from django.views.generic import FormView [as 别名]
# 或者: from django.views.generic.FormView import as_view [as 别名]
'django.contrib.auth.views.login',
{'template_name' : 'common/login.html'}
),
url(r'^logout/$',
'django.contrib.auth.views.logout',
{'template_name' : 'common/logout.html'}
),
url(r'^dev/delete/$',
'message.views.dev_delete'
),
url(r'^user/form/$',
FormView.as_view(
form_class = UserForm,
template_name = 'user/form.html'
)
),
url(r'^user/create/$',
CreateView.as_view(
form_class = UserForm,
template_name = 'user/form.html',
success_url = '/user/form'
)
),
url(r'^message/(\d+)/(\w*)$',
MessageFormView.as_view()
),
示例9: patterns
# 需要导入模块: from django.views.generic import FormView [as 别名]
# 或者: from django.views.generic.FormView import as_view [as 别名]
urlpatterns = patterns('',
# Examples:
# url(r'^$', 'phone_application.views.home', name='home'),
# url(r'^phone_application/', include('phone_application.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)),
url(r'^$', FormView.as_view(template_name="home.html",form_class = ProductForm ),name="home"),
url(r'^integrate_database/(?P<last_date>'+datetime_pattern+')$', IntegrateDatabase.as_view(), name="integrate_database"),
url(r'^detail_offline/$', TemplateView.as_view(template_name="detail_offline.html"),name="detail_offline"),
url(r'^manifest\.appcache$', ManifestView.as_view(), name="cache_manifest"),
)
示例10: patterns
# 需要导入模块: from django.views.generic import FormView [as 别名]
# 或者: from django.views.generic.FormView import as_view [as 别名]
# -*- coding:utf-8 -*-
from __future__ import absolute_import, unicode_literals
from django.conf.urls import include, patterns, url
from django.views.generic import FormView
from . import forms, views
urlpatterns = patterns(
'',
url(r'^s3file/', include('s3file.urls')),
url(r'^s3/$',
views.S3MockView.as_view(), name='s3mock'),
url(r'^upload/$',
FormView.as_view(form_class=forms.UploadForm, template_name='form.html'), name='upload'),
)