diff --git a/cbv/admin.py b/cbv/admin.py index 8c38f3f..1e43e82 100644 --- a/cbv/admin.py +++ b/cbv/admin.py @@ -1,3 +1,6 @@ from django.contrib import admin +from cbv.models import Article # Register your models here. + +admin.site.register(Article) diff --git a/cbv/models.py b/cbv/models.py index 71a8362..3296fb1 100644 --- a/cbv/models.py +++ b/cbv/models.py @@ -1,3 +1,7 @@ from django.db import models # Create your models here. +class Article(models.Model): + title = models.CharField(max_length=80) + author = models.CharField(max_length=80) + content = models.TextField() diff --git a/cbv/urls.py b/cbv/urls.py index f2deae7..d152da9 100644 --- a/cbv/urls.py +++ b/cbv/urls.py @@ -4,4 +4,5 @@ urlpatterns = patterns('', url(r'^testtemplateview/$',TestTemplateView.as_view()), url(r'^testredirectview/$',TestRedirectView.as_view()), + url(r'^testlistview/$',TestListView.as_view()), ) diff --git a/cbv/views.py b/cbv/views.py index 1b81295..6861d08 100644 --- a/cbv/views.py +++ b/cbv/views.py @@ -1,7 +1,8 @@ from django.shortcuts import render from django.views.generic import TemplateView,View,RedirectView +from django.views.generic import DetailView,CreateView,UpdateView,DeleteView,ListView,FormView from cbv.forms import ContactForm -from django.views.generic.edit import FormView +from cbv.models import Article # Create your views here. @@ -27,3 +28,11 @@ class ContactView(FormView): def form_valid(self): pass + + +class TestListView(ListView): + model = Article + template_name = 'testlistview.html' + + def get_context_data(self): + pass diff --git a/db.sqlite3 b/db.sqlite3 index 7346da9..e18adf4 100644 Binary files a/db.sqlite3 and b/db.sqlite3 differ