If you examine the current iteration of
PostGetMixin, you might notice we’re only a few steps away from very generic behavior. For our site, falling down the rabbit hole isn’t all that helpful. On a larger project, where we might need very specific generic behavior, creating such behavior might prove to be incredibly beneficial. In the interest of uncovering all of the secrets of building your own GCBV classes, we will thus follow the rabbit down the rabbit hole.
The first thing to do is make it so that the
pub_date is not hardcoded in the class. In Example 18.39, we introduce the
date_field attribute (with a smart default for our own site) and use that attribute in a dictionary that we use for filter arguments ...