On Sat, Sep 17, 2022 at 11:48:06PM +0530, Nishant Sagar wrote:
> While saving the values to the data to the database I'm getting this Field
> 'roof_age' expected a number but got ('1',)
>
> How can I resolve this?
> Here is my views.py file
> def form(requests):
> if requests.method == 'POST':
> name=requests.POST['name'],
> # roof_age= requests.POST['roof_age'],
> roof_age= int(requests.POST.get('roof_age')),
You have an errant comma at the end of the line which makes roof_age a
tuple. Get rid of the comma.
Also, I agree with the other reply that you should probably be using a
Form[1] to handle POST input.
[1] https://docs.djangoproject.com/en/4.1/topics/forms/
--
You received this message because you are subscribed to the Google Groups "Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to django-users+unsubscribe@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/django-users/20220917222454.GD3098%40fattuba.com.
Subscribe to:
Post Comments (Atom)
No comments:
Post a Comment