Django community: RSS
This page, updated regularly, aggregates Community blog posts from the Django community.
-
Deploy Django + PostgreSQL on Fly.io
In this guide we will develop a Django Todo application locally and then deploy it on [Fly.io](https://fly.io) with a [Postgres production database](https://fly.io/docs/reference/postgres/). There are a number of steps needed to … -
Professionalism: You should maintain a transition file
When you change jobs, ideally you’ll have the opportunity to brief your successor directly. But that isn’t always possible: you might get fired or laid off, you might leave for another job without a clear successor named before your last day, you might have to take sudden medical leave, etc. Situations like that will be disruptive, it’s unavoidable, but a transition file will help minimize that disruption. -
Django: Customizing how a model form renders fields
<![CDATA[ Django: Customizing how a model form renders fields I recently wanted to improve my form that contains a couple of ImageField fields. I wanted to display a small preview of the image to remind users what they saved for this particular model. Since I am using the Django Form API to render the form in a template without providing my own HTML, I couldn’t add more HTML to show the preview. Instead, what you can do is to provide custom “widgets” for some of the fields in your model form. I will use my implementation as an example, but you could use this same approach for other form fields to customize how they get rendered. Initial setup To get the ability to customize the widgets, you need to do a bit of configuration in the settings.py. You need to add 'django.forms' to your INSTALLED_APPS and add this line: FORM_RENDERER = 'django.forms.renderers.TemplatesSetting' TimonWeb has a bit more info about this. Creating your custom template The next step is to create your template in the templates directory. Creating a custom widget template is easier than it sounds since you can look at the base widget templates in Django to get the … -
Django News - Django bugfix release: 4.1.3 - Nov 4th 2022
News Django bugfix release: 4.1.3 Django 4.1.3 fixes a bug in 4.1.2 and adds compatibility with Python 3.11. djangoproject.com 2023 DSF Board Nominations (Final Day!) Applications for the 2023 Django Software Foundation Board of Directors are now open until November 4th. Please consider running. djangoproject.com Sponsored Ad Now Hiring Software Engineers Are you interested in building the next generation MLOPS Platform in Django? Apply today! Ampsight, Inc. is a small but quickly growing government services technology company located in Ashburn, Virginia, recently recognized by Inc. 5000 as one of the fastest growing companies in the United States. trinethire.com Events Become a PyCon US 2023 Volunteer! There are many ways to get involved if you are interested in serving the community and meeting others as part of the team who makes the conference possible! blogspot.com Articles How to Handle Django Forms within Modal Dialogs How to use django-crispy-forms with htmx to provide a form with server-side validation in a modal dialog. blogspot.com Static-Dynamic Content With In-Memory SQLite Andrew Godwin's overview of mixing static content with in-memory SQLite without leaving Django behind. aeracode.org Django Performance Improvements - Part 4: Caching in Django Applications The 4th in a series on improving performance in … -
Reusable cookie consent app for Django
Reusable cookie consent app for Django We at Feinheit have been working on a cookie consent app for some time. Why and what? There are many many solutions in this problem space already. We have used several scripts in the past. Some are simple banners or popups which only inform users that cookies are being used. It is our view and belief that this isn’t sufficient to fulfil the legal obligations imposed by the GDPR and other comparable legislations. We wanted a way to ask for consent and only embed any third party scripts after the consent has been given, not use some other tool which only comes into action after e.g. the Google Analytics scripts already have been loaded. Accepting only essential cookies is made very annoying by some cookie banners. They drown users in options and nudge (or maybe coerce) them towards accepting all cookies. The banner buttons are inspired (stealed) from Twitter, we think it’s nice to offer as little options as possible. Embedding third party content Also, we wanted to integrate a solution for embedding content from third party sites (e.g. Vimeo, Mailchimp and friends) where consent was asked as well when users only accept essential … -
Exercism and PDF Page Numbering - Building SaaS with Python and Django #149
In this episode, we started to work on Python learning problems on Exercism. Then I added page numbers to PDFs on my homeschool app. -
Exercism and PDF Page Numbering - Building SaaS #149
In this episode, we started to work on Python learning problems on Exercism. Then I added page numbers to PDFs on my homeschool app. -
Django News - Python 3.11 released - Oct 28th 2022
News 2023 DSF Board Nominations Applications for the 2023 Django Software Foundation Board of Directors are now open until November 4th. Please consider running. djangoproject.com What does the DSF Board actually do? An overview of the Django Software Foundation Board and its duties. djangoproject.com Python Release Python 3.11.0 Python 3.11.0 is the newest major release of the Python programming language, and it contains many new features and optimizations. python.org Python 3.12.0 alpha 1 released Python 3.12.0a1 is the first of seven planned alpha releases for the next version of Python. python.org Python Core Development Sprint 2022: 3.11 and beyond! Overview of a Python 3.11 core sprint. Something we could potentially add to Django itself, too. python.org django-developers: Changing the role of the Technical Board Thoughts from Andrew Godwin about the Django Technical Board's future. google.com Sponsored Ad Django Hosting by CodeRed Cloud At CodeRed, we’re striving to build the world’s easiest Django hosting platform. Go from polls tutorial to production in just a few minutes. Get started with a free account which includes a MariaDB or Postgres database, static + media hosting, and everything you need to run a Django site. No AWS, S3, Docker, or 3rd-party services required! codered.cloud … -
Deploying a Flask App to Render
This tutorial shows how to deploy a Flask application with PostgreSQL to Render. -
HorseRecords - Andy Ide
HorseRecords@andyide40 on Twitterdjangoandy.comdjango-autocomplete-lightdjango-qAssets in Django without losing your hair by Jacob Kaplan-Moss @Pycon US 2019Support the ShowThis podcast does not have any ads or sponsors. To support the show, please consider purchasing a book, signing up for Button, or reading the Django News newsletter. -
django-upgrade Mega Release 1.11.0
I just released version 1.11.0 of django-upgrade, a tool for automatically upgrading your Django project code. This release contains a lot of new features and fixes, thanks to new contributors including those at the Djangocon Europe sprints. Let’s look at the top changes. New admin.site.register() fixer Originally the Django admin required you to first define a ModelAdmin class, and then later register Model classes to use it with admin.site.register(): from django.contrib import admin class MyCustomAdmin(admin.ModelAdmin): ... admin.site.register(MyModel1, MyCustomAdmin) admin.site.register(MyModel2, MyCustomAdmin) With this format, the register() calls can become quite separated from the admin classes. In more complicated scenarios, you might also miss exactly which Model classes are registered to an admin class. To solve these problems, Django 1.7 (September 2014!) added the admin.register() class decorator: from django.contrib import admin @admin.register(MyModel1, MyModel2) class MyCustomAdmin(admin.ModelAdmin): ... django-upgrade can now automatically upgrade from the first form to the second: from django.contrib import admin +@admin.register(MyModel1, MyModel2) class MyCustomAdmin(admin.ModelAdmin): ... -admin.site.register(MyModel1, MyCustomAdmin) -admin.site.register(MyModel2, MyCustomAdmin) This works with various forms of admin.site.register() calls, and with GIS admin aliases as well. Thanks to Thibaut Decombe for contributing this feature. New @admin.action() and @admin.display() fixers The Django admin has two special kinds of functions: actions and display functions. … -
About my proposal for the Django Core Sprints 🌅
The story of how the proposal to organize sprints on the Django core was born and how I proposed it during the past DjangoCon US 2022 in San Diego to various components of the Django community. -
My Django active developers Sprints proposal 🌅
The story of how the proposal to organize sprints on the Django active developers was born and how I proposed it during the past DjangoCon US 2022 in San Diego to various components of the Django community. -
Personal Thoughts on the Django Software Foundation Board's Future
Thoughts from 3 years on the Board as Treasurer -
Performance "Seasons" Are Useless — Use Anniversary Reviews Instead
Stop doing performance reviews based on the calendar year. Instead, schedule performance reviews around each person’s individual calendar — a year after they join the team, switch roles, get promoted, etc. -
Migrating to a Custom User Model Mid-project in Django
This article explains step-by-step how to migrate to a custom User model mid-project in Django. -
How to Handle Django Forms within Modal Dialogs
I like django-crispy-forms. You can use it for stylish uniform HTML forms with Bootstrap, TailwindCSS, or even your custom template pack. But when it comes to custom widgets and dynamic form handling, it was always a challenge. Recently I discovered htmx. It's a JavaScript framework that handles Ajax communication based on custom HTML attributes. In this article, I will explore how you can use django-crispy-forms with htmx to provide a form with server-side validation in a modal dialog. The setup For this experiment, I will be using these PyPI packages: Django - my beloved Python web framework.django-crispy-forms - library for stylized forms.crispy-bootstrap5 - Bootstrap 5 template pack for django-crispy-forms.django-htmx - some handy htmx helpers for Django projects. Also, I will use the CDN versions of Bootstrap5 and htmx. The form I decided to add some crispy style to the login form by extending Django's authentication form and attaching a crispy helper to it. from django.contrib.auth.forms import AuthenticationFormfrom crispy_forms.helper import FormHelperfrom crispy_forms.layout import Layoutfrom crispy_bootstrap5 import bootstrap5class LoginForm(AuthenticationForm): def __init__(self, *args, **kwargs): super().__init__(*args, **kwargs) self.helper = FormHelper() self.helper.form_tag = False self.helper.include_media = False self.helper.layout = Layout( bootstrap5.FloatingField("username", autocomplete="username"), bootstrap5.FloatingField("password", autocomplete="current-password"), ) Here I set form_tag to False to skip the <form> … -
Django News - Django Developers Survey 2022 Last Call! - Oct 21st 2022
News Django Developers Survey 2022 - Last Call The Django Developers Survey 2022 closes Sunday, October 23rd. Please ensure you have filled it out and encourage others to do the same. jetbrains.com 2023 DSF Board Nominations Applications for the 2023 Django Software Foundation Board of Directors are now open until November 4th. Please consider running. djangoproject.com Nominations for 2022 Malcolm Tredinnick Memorial Prize The Malcolm Tredinnick Memorial Prize is a monetary prize, awarded annually, to the person who best exemplifies the spirit of Malcolm’s work - someone who welcomes, supports, and nurtures newcomers; freely gives feedback and assistance to others, and helps to grow the community. Nominations are open until Thursday, October 30th, 2022, AoE. djangoproject.com PyCon US 2023 Launches! PyCon US is back in Salt Lake City in 2023. blogspot.com Sponsored Ad Django for Beginners/APIs/Professionals Level up your Django knowledge with Django for Beginners, Django for APIs, or Django for Professionals. Sample chapters are available to preview for free. learndjango.com Articles 12 Factor App Revisited An illustrated 10 years later look at The Twelve-Factor App methodology and how it holds up today. architecturenotes.co Future Proofing SQL with Carefully Placed Errors A look at maintaining forward/backward compatibility not just with … -
How to Handle Django Forms within Modal Dialogs
I like django-crispy-forms. You can use it for stylish uniform HTML forms with Bootstrap, TailwindCSS, or even your custom template pack. But when it comes to custom widgets and dynamic form handling, it was always a challenge. Recently I discovered htmx. It's a JavaScript framework that handles Ajax communication based on custom HTML attributes. In this article, I will explore how you can use django-crispy-forms with htmx to provide a form with server-side validation in a modal dialog. The setup For this experiment, I will be using these PyPI packages: Django - my beloved Python web framework. django-crispy-forms - library for stylized forms. crispy-bootstrap5 - Bootstrap 5 template pack for django-crispy-forms. django-htmx - some handy htmx helpers for Django projects. Also, I will use the CDN versions of Bootstrap5 and htmx. The form I decided to add some crispy style to the login form by extending Django's authentication form and attaching a crispy helper to it. from django.contrib.auth.forms import AuthenticationForm from crispy_forms.helper import FormHelper from crispy_forms.layout import Layout from crispy_bootstrap5 import bootstrap5 class LoginForm(AuthenticationForm): def __init__(self, *args, **kwargs): super().__init__(*args, **kwargs) self.helper = FormHelper() self.helper.form_tag = False self.helper.include_media = False self.helper.layout = Layout( bootstrap5.FloatingField("username", autocomplete="username"), bootstrap5.FloatingField("password", autocomplete="current-password"), ) Here I set … -
Migrate PostgreSQL ID’s from serial to identity after upgrading to Django 4.1
The Django 4.1 release notes feature this short, innocent-looking note: On PostgreSQL, AutoField, BigAutoField, and SmallAutoField are now created as identity columns rather than serial columns with sequences. In this post, we’ll expand on what this means, why you might want to update existing columns from serial types to identity columns, and a management command to update them. Serial versus identity What are “identity” and “serial” columns? Well, basically they’re PostgreSQL’s two different ways to create auto-incrementing ID columns. Originally PostgreSQL only had serial types, used like: CREATE TABLE example ( id serial NOT NULL PRIMARY KEY ); These serial types are not true data types. Instead, it’s a shorthand that creates a column and a sequence for its default value. PostgreSQL 10 (Oct 2017) added support for SQL-standard identity columns, used like: CREATE TABLE example ( id integer NOT NULL PRIMARY KEY GENERATED BY DEFAULT AS IDENTITY ); (Documented under CREATE TABLE, search for “identity” on the page.) As the syntax shows, the column has a data type, integer, and then “identity” behaviour on top of that. There is an associated sequence for generating values, but PostgreSQL manages this internally. For regular usage, there is not much difference between … -
The Intersection of Tenure and Seniority
Patterns of short tenure are normal at the beginning of a career, but are more of a red flag in more senior roles. Here’s why. -
How To Add Sentry - Building SaaS with Python and Django #148
In this episode, I switched my error management system from Rollbar to Sentry and walked through some of Sentry’s features. -
How To Add Sentry - Building SaaS #148
In this episode, I switched my error management system from Rollbar to Sentry and walked through some of Sentry’s features. -
Django News - Django Unicorn Chat - Oct 14th 2022
News Django Developers Survey 2022 Please take a moment to fill out the Django Developers Survey 2022 and encourage others in the community to do the same. It really helps guide the direction of the framework. jetbrains.com Last call for DjangoCon US tickets Last call for DjangoCon US 2022 tickets. Join us virtually this Monday, October 17th, and save 10% on all ticket types. If you are there in person, say hi to William and Jeff. ti.to Sponsored Ad Django for Beginners/APIs/Professionals Level up your Django knowledge with Django for Beginners, Django for APIs, or Django for Professionals. Sample chapters are available to preview for free. learndjango.com Articles Building a Realtime Chat App with Django Channels and WebSockets Learn how to build a realtime chat app using Django Channels and WebSockets. honeybadger.io DjangoTricks: How to Rename a Django App A good guide to renaming existing apps which is a very common occurrence. blogspot.com To Do List - Part 1: Installing Django - CTRL Z Blog The first in a very beginner-friendly 8-part series on building a Django To Do app. ctrlzblog.com Python Type Hints - Lambdas don’t support type hints, but that’s okay A look at how Mypy can infer … -
How to Fix the set-output GitHub Actions Deprecation Warning
If you have a GitHub Actions workflow that sets an output using echo ::set-output key=value, you have started to see an unhelpful deprecation warning. Here’s how to fix it.