1###### views.py #####
2from .forms import CreateArticleForm
3from django.views.generic import CreateView
4class ArticleCreateView(CreateView):
5 form_class = CreateArticleForm
6 template_name = 'articles/create_article.html'
7
8###### urls.py ######
9from .views import ArticleCreateView
10urlpatterns =[ path('articles/create/', ArticleCreateView.as_view()),]
1###### views.py #####
2from .models import Article
3from .forms import UpdateArticleForm
4from django.views.generic import UpdateView
5class ArticleUpdateView(UpdateView):
6 model = Article
7 form_class = UpdateArticleForm
8 template_name = 'articles/create_article.html'
9
10###### urls.py ######
11from .views import ArticleUpdateView
12urlpatterns =[
13 path('articles/<int:pk>/update/', ArticleUpdateView.as_view()),]
14# pk is default value (for primary key of id of an instance of object