Ephes Blog

Miscellaneous things. Mostly Weeknotes and links I stumbled upon.

Date -

Weeknotes 2023-05-29

, Jochen
can't wait to quit my day job and start my new landscaping company, Move Fast and Rake Things --Annika Backstrom
vacation in ostfriesland illustration

Holiday week. Didn't do much except for some light programming in the morning, working on the comment feature of the Vue.js theme for django-cast.





Out of Context Images

Weeknotes 2023-05-22

, Jochen

"sorry about that, i wasn’t making a strange face because of what you said on the team sync meeting, but because i’ve been watching my own camera the whole time, and at all times i am nothing but a horse discovering his own reflection" --henry ✷


Less busy week, good. Created a first release for cast-vue, a Vue.js theme for django-cast. It's a weird mix of pre-rendered html via Django and classic http API based SPA. I like it 😆. To support cast-vue, some changes had to be made to django-cast, so there's a new release for it too. The only major feature that is missing from cast-vue in comparison to the bootstrap ones is comments.




TIL: Using django-filter Filtersets in Wagtail API v2

, Jochen

For this blog I have a "Filter / Full text search" box at the top. Now I wanted to build a Vue.js theme for the Wagtail based blog engine. Since I now have to fetch all posts via the Wagtail API v2, I wondered if it would be possible to keep the filter box and just pass the form data as query parameters to the API (which is based on Django REST framework).

When I tried to add one of the query parameters, I got the following error message from DRF:

Query parameter is not an operation or a recognized field: date_facets

Fortunately, it was relatively easy to combine my existing django-filter filterset called PostFilterset with a slightly modified PagesAPIViewSet by adding a use_post_filter flag:

class FilteredPagesAPIViewSet(PagesAPIViewSet):
    def get_filtered_queryset(self) -> QuerySet:
        # allow additional query parameters from PostFilterset + use_post_filter flag
        additional_query_params = PostFilterset.Meta.fields + ["use_post_filter"]
        self.known_query_parameters = self.known_query_parameters.union(additional_query_params)
        queryset = super().get_queryset()
        return PostFilterset(
            data=self.request.GET.copy(), queryset=queryset, fetch_facet_counts=True).qs

    def get_queryset(self):
        if self.request.GET.dict().get("use_post_filter", "false") == "true":
            return self.get_filtered_queryset()
        return super().get_queryset()

wagtail_api_router = WagtailAPIRouter("cast:api:wagtail")
wagtail_api_router.register_endpoint("pages", FilteredPagesAPIViewSet)

Weeknotes 2023-05-15

, Jochen

"Adam Smith's invisible hand — the idea that free markets lead to efficiency as if guided by unseen forces — is invisible, at least in part, because it is not there." --Joseph Stiglitz

Octupus and Kids with scarlet fever

Another busy week for me. Time for a regular week, I think. Or vacation or something. The pytest workshop was a lot of fun and we used a simple mastodon client as a sample application. Mastodon.py is great and now I have to fight the urge to build some mastodon bots by connecting GPT-4 (yay, got API access) to the fediverse (what could possibly go wrong?). Since we used bootstrap5 for the pytest sample app, I thought: How hard could it be to create a bootstrap5 theme for django-cast? So now this site and python-podcast are both bootstrap5. Also some health issues - the kids were sick with scarlet fever and some serious dental work 🦷 for me. Fun.



Weeknotes 2023-05-08

, Jochen
"The worst thing that ever happened in software engineering was when Kirk asked Scotty how long something would take and Scotty said thirty minutes and Kirk said you’ve got five and Scotty got it done in five and impressionable children watched this and grew up to become managers." --Isaac Freeman
Pytest Knolling

Had a busy week. I have been working on a Vue.js theme for django-cast. It's not finished yet, but enough to see how it works. Hope to get back to it soon. Then we produced a new podcast episode about building GUI applications with Python and miaplan. It was a lot of fun. And then I did a stream about the reading of the nlp with transformers book. Doing so many different things and making meaningful progress is kind of hard. Speaking of which: I also had to do some more preparation for the upcoming pytest course.



Mastodon / Twitter