本文整理汇总了Python中django.views.generic.edit.CreateView.as_view方法的典型用法代码示例。如果您正苦于以下问题:Python CreateView.as_view方法的具体用法?Python CreateView.as_view怎么用?Python CreateView.as_view使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类django.views.generic.edit.CreateView
的用法示例。
在下文中一共展示了CreateView.as_view方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: dajaxice_autodiscover
# 需要导入模块: from django.views.generic.edit import CreateView [as 别名]
# 或者: from django.views.generic.edit.CreateView import as_view [as 别名]
from django.conf import settings
from dajaxice.core import dajaxice_autodiscover
from django.contrib import admin, auth
from django.contrib.auth.forms import UserCreationForm
from django.views.generic.edit import CreateView
from family.forms import UserCreateForm
from views import UserProfile, Index,Contact,Gallery,ShowArticle
from django.core.urlresolvers import reverse_lazy
dajaxice_autodiscover()
admin.autodiscover()
urlpatterns = patterns('',
url(r'^$',Index, name='index'),
url(r'^gallery/$',Gallery, name='gallery'),
url(r'^family/', include('family.urls')),
url(r'^accounts/register/$', CreateView.as_view(template_name='registration/register.html',form_class=UserCreateForm,success_url=reverse_lazy('index')),name='register'),
url(r'^accounts/profile/$', UserProfile,name='profile'),
url(r'^accounts/logout/$','django.contrib.auth.views.logout',{'next_page':'/'}),
url(r'^accounts/', include('django.contrib.auth.urls')),
url(r'^contact/$', Contact, name='contact'),
url(r'^article/$', ShowArticle, name='article'),
(r'^%s/' % settings.DAJAXICE_MEDIA_PREFIX, include('dajaxice.urls')),
url(r'^admin/', include(admin.site.urls)),
)+static(settings.MEDIA_URL, document_root=settings.MEDIA_ROOT)
示例2: patterns
# 需要导入模块: from django.views.generic.edit import CreateView [as 别名]
# 或者: from django.views.generic.edit.CreateView import as_view [as 别名]
from wbinventory.forms import ItemForm
from wbinventory.models import Item, ItemTransaction
from wbinventory.views import SiteSearchListView, ItemDetailView, ItemTransactionCreateView
urlpatterns = patterns('wbinventory.views',
url(
r'^$',
'index',
name='wbinventory_index',
),
url(
r'^items/create/$',
CreateView.as_view(
context_object_name='item',
template_name='wbinventory/item/create.html',
model=Item,
form_class=ItemForm,
),
name='wbinventory_item_create',
),
url(
r'^items/(?P<pk>\d+)/$',
ItemDetailView.as_view(
context_object_name='item',
template_name='wbinventory/item/detail.html',
model=Item,
),
name='wbinventory_item_detail',
),
url(
r'^items/(?P<pk>\d+)/edit/$',
示例3: url
# 需要导入模块: from django.views.generic.edit import CreateView [as 别名]
# 或者: from django.views.generic.edit.CreateView import as_view [as 别名]
# auth
url(r'', include('social_auth.urls')),
url(r'^accounts/logout/$',
'django.contrib.auth.views.logout',
{'next_page': '/'},
name='auth_logout'),
url(r'^accounts/login/$',
'django.contrib.auth.views.login',
{'template_name': 'accounts/login.html'},
name='auth_login'),
url(r'^accounts/register/$',
CreateView.as_view(
template_name='accounts/register.html',
form_class=UserCreationForm,
success_url='/',),
name='auth_register'),
# students
url(r'^$',
'studentapp.views.students.students_list', name='home'),
url(r'^students/add/$',
'studentapp.views.students.add_student', name='add_student'),
url(r'^students/edit/(?P<pk>\d+)/$',
'studentapp.views.students.edit_student', name='edit_student'),
url(r'^students/delete/(?P<pk>\d+)/$',
StudentDeleteView.as_view(), name='delete_student'),
示例4: url
# 需要导入模块: from django.views.generic.edit import CreateView [as 别名]
# 或者: from django.views.generic.edit.CreateView import as_view [as 别名]
url(r'^keywordsearch/results/$', views.KeywordSearchPage.as_view(), name='kresults'),
url(r'^rings/$', views.RingList.as_view(), name='ring-list'),
url(r'^commrings/$', views.CommRingList.as_view(), name='commring-list'),
url(r'^rings/ring/(?P<ring_id>\d+)/$', views.viewring, name='ring-detail'),
url(r'^commrings/ring/(?P<ring_id>\d+)/$', views.viewcommring, name='commring-detail'),
url(r'^properties/$', views.PropertyList.as_view(), name='property-list'),
url(r'^properties/property/(?P<pk>\d+)/$', views.PropertyView.as_view(), name='property-detail'),
url(r'^commproperties/$', views.CommPropertyList.as_view(), name='commproperty-list'),
url(r'^commproperties/property/(?P<pk>\d+)/$', views.CommPropertyView.as_view(), name='commproperty-detail'),
url(r'^logics/$', ListView.as_view(model=models.Logic), name='logic-list'),
url(r'^logics/logic/(?P<pk>\d+)/$', DetailView.as_view(model=models.Logic), name='logic-detail'),
url(r'^commlogics/$', views.CommLogicList, name='commlogic-list'),
url(r'^commlogics/commlogic/(?P<pk>\d+)/$', DetailView.as_view(model=models.CommLogic), name='commlogic-detail'),
url(r'^theorems/$', ListView.as_view(model=models.Theorem), name='theorem-list'),
url(r'^theorems/theorem/(?P<pk>\d+)/$', views.TheoremDetail.as_view(), name='theorem-detail'),
url(r'^about/$', TemplateView.as_view(template_name='ringapp/about.html'), name='about'),
url(r'^people/$', TemplateView.as_view(template_name='ringapp/people.html'), name='people'),
url(r'^resources/$', TemplateView.as_view(template_name='ringapp/resources.html'), name='resources'),
url(r'^contribute/$', views.SuggestionView.as_view(), name='contribute'),
# url(r'^suggestions/$', views.suggestions, name='suggestions'),
url(r'^bibliography/$', views.bibliography, name='bibliography'),
url(r'^register/$', CreateView.as_view(template_name='ringapp/register.html',
form_class=UserCreationForm,
success_url='profile/'), name='register'),
url(r'^profile/$', views.ProfileView.as_view(), name='profile'),
url(r'^sitemap\.xml$', sitemap, {'sitemaps': sitemapdict},
name='django.contrib.sitemaps.views.sitemap'),
]
示例5: url
# 需要导入模块: from django.views.generic.edit import CreateView [as 别名]
# 或者: from django.views.generic.edit.CreateView import as_view [as 别名]
# The views used below are normally mapped in django.contrib.admin.urls.py
# This URLs file is used to provide a reliable view deployment for test purposes.
# It is also provided as a convenience to those who want to deploy these URLs
# elsewhere.
from django.views.generic.edit import CreateView
from django.contrib.auth.forms import UserCreationForm
from django.conf.urls import url
from core import views
urlpatterns = [
url('^register_bad/', CreateView.as_view(
template_name='core/register.html',
form_class=UserCreationForm,
success_url='/'),name='registration'),
url(r'^$', views.Index.as_view(), name='base'),
url(r'^registration/$', views.registration, name='registration'),
url(r'^about/$', views.About.as_view(), name='about'),
url(r'^registration_done/$', views.registration_done, name='registration_done'),
url(r'^login/$', views.ajaxlogin, name='login'),
url(r'^logout/$', views.logout,{'next_page':'/'}, name='logout'),
url(r'^password_change/$', views.password_change, name='password_change'),
url(r'^password_change/done/$', views.password_change_done, name='password_change_done'),
url(r'^password_reset/$', views.password_reset, name='password_reset'),
url(r'^password_reset/done/$', views.password_reset_done, name='password_reset_done'),
url(r'^reset/(?P<uidb64>[0-9A-Za-z_\-]+)/(?P<token>[0-9A-Za-z]{1,13}-[0-9A-Za-z]{1,20})/$',
views.password_reset_confirm, name='password_reset_confirm'),
url(r'^reset/done/$', views.password_reset_complete, name='password_reset_complete'),
]
示例6: url
# 需要导入模块: from django.views.generic.edit import CreateView [as 别名]
# 或者: from django.views.generic.edit.CreateView import as_view [as 别名]
urlpatterns = [
url(
r'^$',
ListView.as_view(
queryset=CD.objects.all(),
template_name='model_filefields_example/cd_list.html'
),
name='cd.list'
),
url(
r'^cds/add/$',
CreateView.as_view(
model=CD,
form_class=CDForm,
template_name='model_filefields_example/cd_form.html',
success_url=reverse_lazy('model_files:cd.list')
),
name='cd.add'
),
url(
r'^cds/edit/(?P<pk>\d+)/$',
UpdateView.as_view(
model=CD,
form_class=CDForm,
template_name='model_filefields_example/cd_form.html',
success_url=reverse_lazy('model_files:cd.list')
),
name='cd.edit'
),
url(
示例7: patterns
# 需要导入模块: from django.views.generic.edit import CreateView [as 别名]
# 或者: from django.views.generic.edit.CreateView import as_view [as 别名]
from django.contrib.auth.decorators import login_required
from django.contrib import admin
from django_common.decorators import anonymous_required
import django.contrib.auth.views
from django.views.generic.edit import CreateView
from apps.users.forms import UserRegistrationForm
import apps.pastes.views
import apps.users.views
import notifications
admin.autodiscover()
urlpatterns = patterns('',
url(r'^admin/', include(admin.site.urls)),
url(r'^notifications/', include(notifications.urls)),
url(r'^settings/$', login_required(apps.users.views.SettingsView.as_view()), name='settings'),
url(r'^profile/$', apps.users.views.ProfileView.as_view(), name='profile'),
url(r'^i18n/', include('django.conf.urls.i18n')),
url(r'^login/$', anonymous_required(django.contrib.auth.views.login), {'template_name': 'users/login.html'}, name='login'),
url(r'^logout/$', 'django.contrib.auth.views.logout', {'next_page': '/'}, name='logout'),
url(r'^registration/$', anonymous_required(CreateView.as_view(
template_name='users/registration.html',
form_class=UserRegistrationForm,
success_url='/login/'
)), name='registration'),
url(r'^password/', include('password_reset.urls')),
url(r'^trends/$', apps.pastes.views.TrendingPastesView.as_view(), name='trends', kwargs={'days' : '1'}),
url(r'^trends/(?P<days>1|7|30|365|all)/$', apps.pastes.views.TrendingPastesView.as_view(), name='trends_by_day'),
url(r'^u/', include('apps.users.urls')),
url(r'^', include('apps.pastes.urls')),
url(r'', include('social_auth.urls')),
)
示例8: patterns
# 需要导入模块: from django.views.generic.edit import CreateView [as 别名]
# 或者: from django.views.generic.edit.CreateView import as_view [as 别名]
from django.conf.urls.defaults import patterns, url
from django.contrib import admin
from django.views.generic.detail import DetailView
from django.views.generic.edit import CreateView, UpdateView
from expenses.models import Person, Household, Transaction
from expenses.utils import user_in_household, user_is_person
from expenses.views import HouseholdTransactionsView, HouseholdTransactionCreateView, HouseholdTransactionUpdateView
admin.autodiscover()
urlpatterns = patterns('',
url(r'^person/(?P<pk>\d+)$',user_is_person(DetailView.as_view(model=Person, context_object_name='person')), name='person'),
url(r'^household/(?P<pk>\d+)$',user_in_household(DetailView.as_view(model=Household, context_object_name='household')), name='household'),
url(r'^household/create/$',CreateView.as_view(model=Household,success_url="/" ), name='household_create'),
url(r'^transaction/create/$',CreateView.as_view(model=Transaction, success_url="/"),name='transaction_create'),
url(r'^transaction/(?P<pk>\d+)/create/$',HouseholdTransactionCreateView.as_view(),name='household_transaction_create'),
url(r'^transaction/(?P<pk>\d+)/edit/$',HouseholdTransactionUpdateView.as_view(),name='transaction_edit'),
url(r'^household/(?P<pk>\d+)/transactions/$', HouseholdTransactionsView.as_view(), name='household_transactions'),
)
示例9: url
# 需要导入模块: from django.views.generic.edit import CreateView [as 别名]
# 或者: from django.views.generic.edit.CreateView import as_view [as 别名]
from django.conf.urls import url, include
from django.views.generic.edit import CreateView
from django.contrib.auth.forms import UserCreationForm
from . import views
urlpatterns = [
url(r'^$', views.index, name='index'),
url('dashboard/$', views.dashboard, name='dashboard'),
url(r'^order/new/$', views.order_new, name='order_new'),
url(r'^order/(?P<order_id>[0-9]+)/edit/$', views.order_edit, name='order_edit'),
url(r'^(?P<order_id>[0-9]+)/$', views.detail, name='detail'),
url(r'^(?P<order_id>[0-9]+)/drinks/$', views.drinks, name='drinks'),
url(r'^(?P<order_id>[0-9]+)/placed/$', views.place_order, name='place_order'),
url(r'^(?P<order_id>[0-9]+)/status/$', views.status, name='status'),
url('^', include('django.contrib.auth.urls')),
url('^register/$', CreateView.as_view(
template_name='registration/register.html',
form_class=UserCreationForm,
success_url='/coffee'
)),
]
示例10: patterns
# 需要导入模块: from django.views.generic.edit import CreateView [as 别名]
# 或者: from django.views.generic.edit.CreateView import as_view [as 别名]
# Uncomment the next two lines to enable the admin:
from django.contrib import admin
admin.autodiscover()
urlpatterns = patterns('',
url(r'^$', RedirectView.as_view(url="main/"), name="root_url"),
(r'^main/$', 'starter.views.main_page'),
url(r'^admin/', include(admin.site.urls)),
)
# model form tests
urlpatterns += patterns('',
url(r'^starter/$', ListView.as_view(model=Starter), name="list_page"),
url(r'^starter/create/$', CreateView.as_view(
model=Starter,
success_url=reverse_lazy('list_page')),
name="create_page"),
url(r'^starter/(?P<pk>\d+)/update/$', UpdateView.as_view(
model=Starter,
success_url=reverse_lazy('list_page')),
name="update_page"),
url(r'^starter/(?P<pk>\d+)/delete/$', DeleteView.as_view(
model=Starter,
success_url = reverse_lazy('list_page'),
template_name_suffix="_confirm_delete"),
name="delete_page"),
url(r'^starter/(?P<pk>\d+)/$', DetailView.as_view(model=Starter), name="detail_page"),
)
###################################
示例11: url
# 需要导入模块: from django.views.generic.edit import CreateView [as 别名]
# 或者: from django.views.generic.edit.CreateView import as_view [as 别名]
from django.conf.urls import patterns, include, url
from django.conf import settings
from django.views.generic.edit import CreateView
from django.contrib.auth.forms import UserCreationForm
from . import views
urlpatterns = [
url('^register/', CreateView.as_view(
template_name='registration/register.html',
form_class=UserCreationForm,
success_url=settings.LOGIN_URL
), name='register'),
# This rule should be above...
url(r'^logout/$', 'django.contrib.auth.views.logout',
{'next_page': '/'}),
# ... than this
url(r'', include('django.contrib.auth.urls')),
url(r'^$', views.index, name='index'),
]
示例12: patterns
# 需要导入模块: from django.views.generic.edit import CreateView [as 别名]
# 或者: from django.views.generic.edit.CreateView import as_view [as 别名]
from django.conf import settings
from django.conf.urls.defaults import patterns, url, include
from django.contrib import admin
from django.views.generic.edit import CreateView
from tester.models import MyTest
# Uncomment the next two lines to enable the admin:
admin.autodiscover()
admin.site.register(MyTest)
urlpatterns = patterns(
"",
# Uncomment the admin/doc line below to enable admin documentation:
# (r'^admin/doc/', include('django.contrib.admindocs.urls')),
# Uncomment the next line to enable the admin:
(r"^admin/", include(admin.site.urls)),
url("^$", CreateView.as_view(template_name="base.html", model=MyTest), name="home"),
url("^djcrop/", include("djcrop.urls")),
)
if settings.DEBUG:
urlpatterns += patterns(
"",
url(
r"^%s(?P<path>.*)$" % (settings.MEDIA_URL[1:]),
"django.views.static.serve",
{"document_root": settings.MEDIA_ROOT, "show_indexes": True},
),
)
示例13: patterns
# 需要导入模块: from django.views.generic.edit import CreateView [as 别名]
# 或者: from django.views.generic.edit.CreateView import as_view [as 别名]
from django.conf.urls import patterns,url
from django.views.generic.list import ListView
from django.views.generic.detail import DetailView
from django.views.generic.edit import CreateView
from models import Paste
display_info = {'queryset':Paste.objects.all()}
create_info = {'model':Paste}
urlpatterns = patterns(
'',
url(r'^$',ListView.as_view(model=Paste,)),
url(r'^(?P<pk>\d+)/$', DetailView.as_view(model=Paste),name="pastebin_detail_url"),
url(r'^add/$',CreateView.as_view(model=Paste,)),
)
示例14: url
# 需要导入模块: from django.views.generic.edit import CreateView [as 别名]
# 或者: from django.views.generic.edit.CreateView import as_view [as 别名]
from cspapp.views import *
from cspapp import views
from django.views.generic.edit import CreateView
from django.contrib.auth.forms import UserCreationForm
urlpatterns = [
url(r'^admin/', admin.site.urls),
url(r'^$', mainpage),
url(r'^cspapp/', include('cspapp.urls', namespace = 'cspapp')),
url(r'^accounts/login/$', login, name='login'),
url(r'^accounts/logout/$', logout, name='logout'),
url('^register/', CreateView.as_view(
template_name='register.html',
form_class=UserCreationForm,
success_url='http://127.0.0.1:8000/'),name='register'),
url(r'^delete_project/(?P<rest_pk>\d+)/$', views.delete_project, name='delete_project'),
url(r'^delete_comment/(?P<rest_pk>\d+)/$', views.delete_comment, name='delete_comment'),
url(r'^delete_activity/(?P<rest_pk>\d+)/$', views.delete_activity, name='delete_activity'),
url(r'^delete_answer/(?P<rest_pk>\d+)/$', views.delete_answer, name='delete_answer'),
url(r'^profile/(?P<rest_pk>\d+)/$', views.profile, name='profile'),
#url(r'profile/', profile),
]
if settings.DEBUG:
示例15: url
# 需要导入模块: from django.views.generic.edit import CreateView [as 别名]
# 或者: from django.views.generic.edit.CreateView import as_view [as 别名]
from django.contrib.auth import views
from tdd import urls as tdd_urls
from sla_app import urls as sla_app_urls
from django.views.generic.edit import CreateView
from django.contrib.auth.forms import UserCreationForm
from django.core.urlresolvers import reverse_lazy
urlpatterns = [
url(r"^tdd/", include(tdd_urls)),
url(r"^slapp/", include(sla_app_urls)),
url(r"^admin/", include(admin.site.urls)),
url(r"^login/$", auth.views.login, {"template_name": "sla_app/login.html"}, name="loginslap"),
url(
r"^password_reset/$",
auth.views.password_reset,
{"template_name": "sla_app/password_reset_form.html"},
name="pass_reset_form_slap",
),
url("", include("django.contrib.auth.urls")),
url(
"^register/",
CreateView.as_view(
template_name="register.html", form_class=UserCreationForm, success_url=reverse_lazy("loginslap")
),
name="registerslap",
),
url("^accounts/", include("django.contrib.auth.urls")),
]