Commits

Markus Zapke-Gründemann committed 26404b0

Replaced CBV with FBV.

  • Participants
  • Parent commits c8f90dd

Comments (0)

Files changed (4)

File docs/forms.rst

 
 .. literalinclude:: ../src/mysite/marcador/urls.py
     :linenos:
-    :emphasize-lines: 9-10
+    :emphasize-lines: 7-8
 
 Formular
 --------
 
 .. literalinclude:: ../src/mysite/marcador/views.py
     :linenos:
-    :emphasize-lines: 1-4, 8, 20-49
+    :emphasize-lines: 1-4, 7, 20-49
 
 Templates
 ----------

File docs/views_templates.rst

 Dateinamen :file:`urls.py` an:
 
 .. literalinclude:: ../src/mysite/marcador/urls.py
-    :lines: 1-8, 11-13
+    :lines: 1-6, 9-11
     :linenos:
 
 Diese neue URLConf musst du in die URLConf des Projekts einbinden (Zeile
 :file:`mysite/marcador/views.py` hinzu:
 
 .. literalinclude:: ../src/mysite/marcador/views.py
-    :lines: 5-7, 11-19
+    :lines: 5-6, 8-19
     :linenos:
 
 .. todo:: :issue:`4` Views erklären

File src/mysite/marcador/urls.py

 from django.conf.urls import patterns, include, url
 
-from .views import BookmarkList
-
 
 urlpatterns = patterns('marcador.views',
     url(r'^u/(?P<username>[-\w]+)/$', 'user',
         name='marcador_bookmark_user'),
     url(r'^create/$', 'create', name='marcador_bookmark_create'),
     url(r'^edit/(?P<pk>\d+)/$', 'edit', name='marcador_bookmark_edit'),
-    url(r'^$', BookmarkList.as_view(), name='marcador_bookmark_list'),
+    url(r'^$', 'list', name='marcador_bookmark_list'),
 )

File src/mysite/marcador/views.py

 from django.http import HttpResponseRedirect
 from django.shortcuts import get_object_or_404
 from django.shortcuts import render
-from django.views.generic import ListView
 
 from .forms import BookmarkForm
 from .models import Bookmark
 
 
-class BookmarkList(ListView):
-    queryset = Bookmark.public.all()
+def list(request):
+    context = {'object_list': Bookmark.public.all()}
+    return render(request, 'marcador/bookmark_list.html', context)
 
 
 def user(request, username):