📜  django 创建视图类 - Python 代码示例

📅  最后修改于: 2022-03-11 14:46:41.304000             🧑  作者: Mango

代码示例1
###### views.py #####
from .forms import  CreateArticleForm
from django.views.generic import CreateView
class ArticleCreateView(CreateView):
    form_class = CreateArticleForm
    template_name = 'articles/create_article.html'
    
###### urls.py  ######
from .views import ArticleCreateView
urlpatterns =[ path('articles/create/', ArticleCreateView.as_view()),]