【发布时间】:2016-03-10 09:03:44
【问题描述】:
这里是菜鸟。 在我从管理面板保存(单击保存)一个对象后,我试图立即执行一个功能, 我尝试了 get_or_create,但我不知道如何使它工作
这是我的代码 (models.py)
#The function creates a group of folders
def Create_Space():
queuepath = r"C:\Users\BrianC\Desktop\DjangoPrueba\prueba6\queue"
acceptedpath = r"C:\Users\BrianC\Desktop\DjangoPrueba\prueba6\accepted"
if not os.path.exists(queuepath) and not os.path.exists(acceptedpath) :
os.makedirs(queuepath)
os.makedirs(acceptedpath)
#Here is the model
class Espacio (models.Model):
prom_name = models.CharField(max_length=30, null=False)
prom_email = models.EmailField(max_length=254, null=True)
phone_contact = models.BigIntegerField(max_length=50, null=False)
school_name = models.CharField(max_length=30, null=False)
school_phone = models.BigIntegerField(max_length=50, null=False)
school_address = models.TextField(null=False)
other_details = models.TextField()
【问题讨论】:
-
这个问题的重复:stackoverflow.com/questions/30252693/… 这也有更好的答案
标签: python django django-models get save