Silver Library (Archived)
#Django (Notion) - ManyToManyField, ForeignKey 본문
#Django
-Do not forget to claim 'makemigrations' then 'migrate'! Or it won't be reflected on its server database.
[Relationship Field]
*ManyToManyField : To express Type list
*ForeignKey : Something is connected to a different object. To work as many to one. If not sure, refer #4.2. Or the following link & Django document:
# class Meta:
There is a class inside of module calls Meta class. This meta allows me to configure many things.
How I use this?
class Amenity(AbstractItem):
""" Amenity Object Definition """
#On Django's webpage, this will display as Amenitys
#To edit this; use verbose_name_plural
class Meta:
verbose_name_plural = "Amenities"
#note: Plural is not necessary if word is not plural form. verbose_name also works.
#To sync git:
git add.
git commit -m ""
Not sure what admin.ModelAdmin is?
docs.djangoproject.com/en/3.1/ref/contrib/admin/#django.contrib.admin.ModelAdmin
'Personal DB' 카테고리의 다른 글
Django - note 11th Dec (0) | 2020.12.12 |
---|---|
Django - a way to programme any stuff (0) | 2020.12.09 |
How to move mnt(windows) thing to WSL(Linux/Ubuntu)? (0) | 2020.12.02 |
Python/Django : Why formatter black never works? (0) | 2020.12.02 |
WSL - how to return Windows from Linux? (0) | 2020.12.01 |