0
from django.db import models
from django.contrib.auth.models import User
class WorkDailyRecord(models.Model):
user = models.ForeignKey(User)
date = models.DateTimeField(auto_now=True)
contents = models.TextField()
check_user = models.ManyToManyField(User)
target_user = models.ManyToManyField(User)
ONGOING_OR_END =(
('ing', '진행중'),
('end', '완료'),
)
ongoing_or_end = models.CharField(
max_length=3,
choices=ONGOING_OR_END,
default='ing',
)
我寫的代碼,然後我給錯誤...Django的models.py誤差(約ManyToManyField)
於是我在網上搜索,我發現,我必須使用「related_name」屬性。
但我不知道爲什麼我必須使用attr?
爲什麼?
哇,謝謝!玩的很開心。新年快樂〜 – chobo