can i insert data through model.py in django
model.py
class details(models.Model):
team_id = models.AutoField(primary_key = True)
gbu_id = models.IntegerField()
team_name = models.CharField(max_length=48)
team_desc = models.TextField()
updated_time = models.DateTimeField(default=datetime.datetime.now())
status = models.IntegerField(default=1)
@staticmethod
def add_team_details():
details_obj = details()
details_obj.gbu_id = "2"
details_obj.team_name = "FTO"
details_obj.team_desc = "test data"
details_obj.save()
return "Success"
Aucun commentaire:
Enregistrer un commentaire