web | https://timonweb.com/ |
---|---|
Author |
Oct. 8, 2024 » timonweb.com » [Archived Version]
When working with Django applications, it's common to have a mix of fast unit tests and slower end-to-end (E2E) tests that use Pytest's live_server fixture and browser automation tools like Playwright or Selenium. To ensure my test suite runs efficiently, I want to execute the slower tests at … Read now
Read MoreOct. 8, 2024 » timonweb.com » [Archived Version]
From time to time, I encounter scenarios where I want to restrict certain actions, such as adding new instances for a particular model in Wagtail CMS Admin. For example, if I have a ContactFormSubmission model, I don’t want admins to be able to create form submissions manually; that’s what the … Read now
Read MoreMay 2, 2024 » timonweb.com » [Archived Version]
The powerful ModelAdmin feature of Wagtail CMS has been removed as of Wagtail v6. The Wagtail team now encourages the use of SnippetViewSet, which includes advanced features like bulk actions. Here is an official migration guide from ModelAdmin to Snippets. However, if you have extensive custom code … Read now
Read MoreFeb. 29, 2024 » timonweb.com » [Archived Version]
I use PyCharm as my Python IDE and Poetry for dependency and virtual environment management. However, the magnificent combination of these tools occasionally encounters a weird issue: PyCharm deletes the Poetry virtual environment when you launch the IDE. Though the problem occurs infrequently, when it does, it leads to a … Read now
Read MoreSept. 19, 2023 » timonweb.com » [Archived Version]
Imagine this: you want to optimize your Django project's page loading times. To do this, you've installed the magnificent Django Debug Toolbar that will provide you with the necessary insight into how many queries your page generates. You click on the SQL panel in the Debug Toolbar, and... you get … Read now
Read MoreMarch 12, 2023 » timonweb.com » [Archived Version]
I've been working with the Django cache recently. And while Django has exceptional caching capabilities, I was surprised to find out that it doesn't provide a simple way to manually clear a cache. I checked online and found a couple of clear cache packages for Django, but all of them … Read now
Read MoreMarch 12, 2023 » timonweb.com » [Archived Version]
Here's a real-life case. On this blog, I have two models: Post and PostStats. As you may have already guessed, the first is for posts and the second is for statistics on each post, such as the number of views. Here is a simplified version of both models: models.py … Read now
Read MoreMarch 12, 2023 » timonweb.com » [Archived Version]
When Wagtail renders RichTextBlock in a template, it by default wraps the contents of the block with the <div class="rich-text">. The resulting markup may look like this: <div class="rich-text"> <p>I'm a paragraph that's cold, so I'm wrapped up</p> </ … Read now
Read MoreMarch 12, 2023 » timonweb.com » [Archived Version]
Recently, there have been loads of tutorials on how to integrate Tailwind CSS and Django. There are several different ways you could do this, from the simplistic "let's include a link from CDN" to "roll-up your sleeves and dive into the Webpack black hole." I've been working with Tailwind … Read now
Read MoreMarch 12, 2023 » timonweb.com » [Archived Version]
I'm pleased to announce the release of the Django Tailwind v2.0. Django Tailwind is an integration package for Tailwind CSS and Django. Its goal is to make your life easier without having to think much about the frontend tooling configuration. With the help of the package, you generate … Read now
Read More