Let's Learn Python & Django together :)

Joined April 2022
Photos and videos
14 Apr 2022
ForeignKey.related_name The name is used for feedback from the associated model. Also the default value for related_query_name (the feedback name used when filtering the query result). If you don't want Django to create feedback, set related_name to ' ' or add ' ' at the end
14 Apr 2022
By default, a FileField instance is created as a varchar column in the database. As with other fields, you can change the maximum length using the max_length argument.
14 Apr 2022
A little about FileField and ImageField. To improve performance, files are not stored in the database. Files and images are stored in MEDIA ROOT. All that will be saved in the database is the path to the file!
14 Apr 2022
The auto_now and auto_now_add options will always use the date in the default timezone at the moment of creation or update, which is determined in settings.py

14 Apr 2022
DateField.auto_now_add=True -> The field value will be automatically set to the current date when the object is created (first saved). Useful for storing creation time.

14 Apr 2022
DateField.auto_now=True ->The field value will be automatically set to the current date each time the object is saved (when calling Model.save()). The field isn’t updated when making updates to other fields in other ways such as QuerySet.update() #django

14 Apr 2022
Hey, I'm a web developer and use Python and Django. During my work, I discover something amazing and new every day. Let's share with them)