外部キーと日時フィールドを含む django モデルに初期データを提供する方法。
例えば::
定足数/models.py
class Question(models.Model):
user=models.ForeignKey(User)
created=models.DateTimeField(auto_now_add=True)
question=models.TextField()
tags=models.CharField(max_length=50)
定足数/備品/questions.json
[
{
"model": "quorum.question",
"pk": 1,
"fields": {
"question": "what is cryptography in computer science?",
"tags": "computer science, cryptography."
}
},
{
"model": "quorum.question",
"pk": 2,
"fields": {
"question": "How python language got name? from snake? is it from monty python circus performence(the projectile stuff)?",
"tags": "python"
}
}
]