meeb/django-distill

Make `distill_func` optional

Closed this issue · 3 comments

I find that I very often create a function that does nothing:

def return_none() -> None:
    return None

just so I can provide it to distill_func:

urlpatterns = [
    distill_path('', TemplateView.as_view(template_name='home.html'), name='home',
                 distill_func=return_none),
    # ... (the same repeating many times)
]

It seems that using a return_none-like function by default (and defaulting to it when it is not provided for distill_path) would be a more elegant approach in these cases.

meeb commented

This sounds fine. I've pushed this feature as a commit just now. It'll be bundled into the next release.

Nice, thank you very much! Also thank you for the work on django-distill, it is a nice and simple library that does the job very well!

meeb commented

No problem and thanks for the kind words! As there's nothing else really in the pipeline I've pushed this feature up as the 2.8 release on PyPI.