python_django_'s profile picture. Let's Learn Python & Django together :)

Pydja

@python_django_

Let's Learn Python & Django together :)

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


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.


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!


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


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.


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


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)


Loading...

Something went wrong.


Something went wrong.