from django.shortcuts import get_object_or_404

from .models import Post


class PostGetMixin:

    errors = {
        'url_kwargs':
            "Generic view {} must be called with "
            "year, month, and slug.",
    }

    def get_object(self, queryset=None):
        year = self.kwargs.get('year')
        month = self.kwargs.get('month')
        slug = self.kwargs.get('slug')
        if (year is None
                or month is None
                or slug is None):
            raise AttributeError(
                self.errors['url_kwargs'].format(
                    self.__class__.__name__))
        return get_object_or_404(
            Post,
            pub_date__year=year,
            pub_date__month=month,
            slug__iexact=slug)

@@ -87,16 +87,74 @@
 etMixin:
+%0A    month_url_kwarg = 'month'%0A    year_url_kwarg = 'year'
 %0A%0A    er
@@ -352,22 +352,48 @@
 rgs.get(
-'year'
+%0A            self.year_url_kwarg
 )%0A      
@@ -418,23 +418,49 @@
 rgs.get(
-'month'
+%0A            self.month_url_kwarg
 )%0A      
@@ -488,14 +488,40 @@
 get(
-'slug'
+%0A            self.slug_url_kwarg
 )%0A  

Add date URL kwarg options to PostGetMixin.