灰烬为Django Rest API中的外键字段添加值

时间:2018-10-11 11:38:44

标签: ember.js django-models django-rest-framework

class Department(models.Model):
   dept_name = models.CharField(max_length=100,required=True)
   section_name = models.CharField(max_length=100,required=True)    

class User(models.Model):
   name = models.CharField(max_length=100, required=True)
   dept = models.ForeignkeyField(Department, on_delete=models.CASCADE, required=True)
   addr = models.TextField(required=True)

我想使用表单从Ember front end向用户模型输入一个值,然后如何将该值提供给dept字段? (假设已经填充了Department模型)

0 个答案:

没有答案