ProgerHub
4.86K subscribers
137 photos
2 videos
64 files
301 links
Ads & contact: @crazydev93

A channel with programming news and tips and tricks, nice for beginners but also for experienced programmers. 💻
Download Telegram
Programmatically saving image to Django ImageField from another ImageField

In this tutorial, we will learn how to save an image in a model from another ImageField of the same or different model.

https://bit.ly/3AOAO5c

#python #django #ImageField
In Django a database index is automatically created on the ForeignKey. You can disable this by setting db_index to False. You may want to avoid the overhead of an index if you are creating a foreign key for consistency rather than joins, or if you will be creating an alternative index like a partial or multiple column index.

#django #python #tips
If you need to run remote commands on servers with #Python, then Fabric is your friend.

You can use it to do remote installs, run docker commands, cleanup scripts and so much more.

Source
Django 6.1's tip Fetch Modes: #python #django #fetch_modes

Django 6.1 fixes N+1 without you rewriting your queries you never touch the for loop. You just tell the queryset how permissive it should be about surprise trips to the database — and FETCH_PEERS quietly turns "101 queries" into "2 queries" with zero extra code at the call site.

Docs
❤3