25 Oct 2021

feedDjango community aggregator: Community blog posts

Dear Potheads, You Can Work for the U.S. Government, Maybe

If you've used marijuana, can you still get hired by the Federal Government? Yes, but it's complicated. I'll try to explainā€¦

25 Oct 2021 5:00am GMT

24 Oct 2021

feedDjango community aggregator: Community blog posts

Django tip: Redirecting straight from urls.py

<![CDATA[ Django tip: Redirecting straight from urls.py

This might be obvious to you if you are used to working with Class-based Views, but for me this was new and pretty cool.

I wanted to redirect one URL to another view and before implementing lean function view with the redirect function, I decided to look if better solution exists.. And indeed it does. Meet RedirectView.

You can use it inline in your urls.py to greatly simplify things. It can redirect either based on another route name or to any arbitrary URL.

For example here is usage from my project:

urlpatterns = [
    path('', RedirectView.as_view(pattern_name='profile-detail', permanent=True)),

These are URL patterns prefixed with account and I wanted the unspecified URL to redirect to account/profile which this accomplishes. The permanent settings dictate whether 301 or 302 is returned as a status code.

Instead of pattern_name you can use url attribute and redirect to anywhere. Or you can pass None there to raise status code 410, which means that this URL is no longer available.

And last attribute query_string lets us specify whether possible query string in the URL should be kept (True) or removed (False, default value).

And that's it!

This can be useful also to redirect .well-known URLs, like the one for password change or to redirect your RSS feed if you decide to move it to another URL.


24 Oct 2021 11:50pm GMT

22 Oct 2021

feedDjango community aggregator: Community blog posts

Django News - DjangoCon US this Friday/Saturday - Oct 22nd 2021


DjangoCon US - October 22-23

The major US Django conference is online and free this year. Talks premier October 22-23, 2021, and you can watch them by joining our YouTube channel today!


Python Developers Survey 2021

Please take a moment to fill out the annual Python survey that helps guide development of the language and informs the community.


Psycopg 3.0 released

A major update of the popular database adapter supporting Python 3.6-3.10 and PostgreSQL 10-14.


PyPI User Feedback - Packaging - Discussions on Python.org

Feedback is requested for users of PyPI.


Sponsored Jobs

Building Intelligent Space Infrastructure

Cognitive Space is building intelligent infrastructure for the new space domain with Python at the core. We are looking for passionate Python developers in backend, dev ops, and machine learning. šŸ––



Three more uses for functools.partial() in Django

Adam Johnson on three more ways to use functools.partial() with Django.


Help users change passwords easily by adding a well-known URL for changing passwords

By redirecting requests to /.well-known/change-password to the change password URL, you can let users update their passwords easier than before.


Django related fields and the caveats of implicit SQL INNER JOINs

A look at the Django ORM's behind-the-scenes mechanics when using related sets. Very cool.


Checking out Django in a GitHub Action

Using GitHub actions for checking out a repo.


Sponsored Link

WANTED: IMPACTFUL Projects for a better world

Space Exploration. Forest fire management. Lightning strike predictions. These are three IMPACTFUL Projects (defined as projects that are impressive, purposeful, transformative and unquestionably benefit humankind) Six Feet Up has had the privilege to work on. Six Feet Up is committed to completing 10 IMPACTFUL Projects by 2025, and the company is well on its way to achieving this goal. Want to work with us? Let's talk!




Pydantic models for Django.


groveco/django-sql-explorer: Easily share data across your company via SQL queries. From Grove Collab.

Easily share data across your company via SQL queries.



Elastic's own elasticsearch-dsl-py is nice to work with, but sometimes it's nice to work with a more Django-friendly library which is where django-elasticsearch-dsl shines.


This RSS feed is published on https://django-news.com/. You can also subscribe via email.

22 Oct 2021 3:00pm GMT