Save model int () argument must be string or number, not 'tuple'
I have two forms that I submitted to the template and when I got them all the models were restored and saved, but the last model takes all the other models and saves itself, and also does not save itself. I am getting error like below. Can anyone help me?
Exception Type: TypeError
Exception Value: int() argument must be a string or a number, not 'tuple'
I tracked it down and the problem looked like one in the view from the form as it looks like from the form
class AForm(ModelForm):
mentancy_fee = forms.IntegerField(required=False)
and here is its protection from the model
class AgentLandLordContract(models.Model):
mentancy_fee = models.IntegerField(default=0,blank=True,null = True)
so why is this form field returning a tuple and not it.I blocked only this submitted from the form and all is well
+3
user1940979
source
to share
1 answer
in the form I left a comma at the end of the field, this made the form entered into the tuple and when I found that everything was ok
mentancy_fee = forms.IntegerField(required=False),
+7
user1940979
source
to share