Django Relationship fields (N:1) (Comment - User)
๋ชจ๋ธ ๊ด๊ณ ์ค์
![image](https://user-images.githubusercontent.com/109324637/194046766-824cc4ec-f2fb-4d1c-bb50-5fe3f0018911.png)
![image](https://user-images.githubusercontent.com/109324637/194040874-798b7fba-9560-403d-aca5-a4398194b418.png)
โ models.py์ ์ธ๋ ํค ์ถ๊ฐํด์ฃผ๊ณ migrationsํด์ฃผ๊ธฐ!
Create
1. ์ด์ ๊ณผ ๋ง์ฐฌ๊ฐ์ง๋ก ๋ถํ์ํ ์ ์ ์ ํ์ฐฝ ์ถ๋ ฅ
![image](https://user-images.githubusercontent.com/109324637/194041421-3401e77e-a2fa-46b9-8d6d-0d7ce675b86b.png)
2. Form์์ ์ถ๋ ฅ ํ๋ ์์
![image](https://user-images.githubusercontent.com/109324637/194041534-f1b36af6-c1b6-4a27-b432-c7eceb34dc9a.png)
3. ๋๋ฝ๋ ์ธ๋ํค ์ถ๊ฐํด์ฃผ๊ธฐ
![image](https://user-images.githubusercontent.com/109324637/194041980-2572ef53-9f82-4fd8-a80e-6b1c60a954ae.png)
Read
Detail ํ ํ๋ฆฟ์์ ์์ฑ์ ์ถ๋ ฅ๋๋๋ก ๋ณ๊ฒฝ
![image](https://user-images.githubusercontent.com/109324637/194042423-dfa5af50-95a2-447b-9f28-2ce1855a7e80.png)
Delete
1. ๋๊ธ ์์ฑ์ ํ์ธํด์ ๋ณธ์ธ ๋๊ธ๋ง ์ญ์ ํ ์ ์๋๋ก ํ๊ธฐ
![image](https://user-images.githubusercontent.com/109324637/194042860-895c55e8-0d29-4371-8b6e-6cb18890a1c4.png)
2. ๋๊ธ ์์ฑ์ ์ธ์ ๋๊ธ ์ญ์ ๋ฒํผ ์จ๊ธฐ๊ธฐ
![image](https://user-images.githubusercontent.com/109324637/194043112-897cebe9-98b7-4f0d-9523-3383819b0887.png)
์ธ์ฆ๋ ์ฌ์ฉ์์ ๋ํ ์ ๊ทผ ์ ํํ๊ธฐ
์ธ์ฆ๋ ์ฌ์ฉ์์ธ ๊ฒฝ์ฐ๋ง ๋๊ธ ์์ฑํ๊ธฐ
![image](https://user-images.githubusercontent.com/109324637/194043590-77083570-d227-47ff-82ad-6818eb258817.png)
![image](https://user-images.githubusercontent.com/109324637/194044518-ef0704fe-7257-4dc5-b869-c65c3009aef5.png)
![image](https://user-images.githubusercontent.com/109324637/194044615-c455592a-49eb-4dc7-a682-0a260d2aec53.png)
์ธ์ฆ๋ ์ฌ์ฉ์์ธ ๊ฒฝ์ฐ๋ง ๋๊ธ ์ญ์ ํ๊ธฐ
![image](https://user-images.githubusercontent.com/109324637/194044925-10ebb889-f613-4c5e-bf30-3cbeb39d10fe.png)
๋ฐ์ฝ๋ ์ดํฐ ์ถ๊ฐํด์ฃผ๊ธฐ
![image](https://user-images.githubusercontent.com/109324637/194045151-23298a88-0c30-4b82-8183-f5d6424e3521.png)
โ ํ๋ฒ์ ๋ค ์ถ๊ฐํ ๋ ค๊ณ ํ์ง๋ง๊ณ ์ฒ์์ ๊ตฌ์กฐ๋ฅผ ์๊ฐํ๋ฉด์ ํ๋์ฉ ์ค๊ณํ๊ธฐ
'โญ Personal_Study > Django' ์นดํ ๊ณ ๋ฆฌ์ ๋ค๋ฅธ ๊ธ
(M:N) User- User Relationship (0) | 2022.10.18 |
---|---|
(M:N) Article - User Relationship (0) | 2022.10.17 |
Django์์ css, js ๋ฑ static(์ ์ ) ์์ ๋ฑ๋ก/๊ด๋ฆฌํ๊ธฐ (0) | 2022.10.12 |
(N:1) Article - User Relationship (0) | 2022.10.09 |
(N:1) Comments - Article Relationship (0) | 2022.10.09 |
๋๊ธ