jeudi 11 octobre 2018

Ember Add value to a Foreign Key field in Django Rest API

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)

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

I want to input a value to the User model from Ember front end using a form, Then how can I give the value to dept field ? (assume that the Department model is already populated)




Aucun commentaire:

Enregistrer un commentaire