5.4.1 Coding the tag_detail()
Function View
Open /organizer/views.py
and program the bare minimum functionality of a view (accept an HttpRequest
object, return an HttpResponse
object), as shown in Example 5.5.
organizer/views.py
in f0d1985791
16 def tag_detail(request): 17 return HttpResponse()
Our first task is to select the data for the Tag
object that the user has selected. For the moment, we will assume that we have somehow been passed the unique slug value of the Tag
as the variable slug
, and we use it in our code (but Python will yell at you if you try to run this). We use the get()
method of our Tag
model manager, which returns a single object. We want our search for the ...
Get Django Unleashed now with the O’Reilly learning platform.
O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.