我有一个这样的模型:
class MyModel(models.Model):
rate = models.CharField(max_length=100)
amount = models.FloatField()
userid = models.CharField(max_length=100)
date = models.CharField() //This should be used to save the date
def save(self): # ALL the signature
super(MyModel, self).save()
一种形式:
class MyForm(forms.ModelForm):
rate = forms.CharField()
amount = forms.FloatField()
class Meta:
model = MyModel
fields = ("rate", "amount")
def save(self, commit=True):
send = super(MyForm, self).save(commit=False)
if commit:
send.save()
return send
目前,我的表单正在保存字段
rate
和
amount
在我的数据库中,一旦用户使用表单。我想节省我的数据库
user
提交表单的人、保存表单的日期/时间以及用户不能提交但“自动”保存的某些其他数据。在Django我该怎么做?