Groups
Groups
Sign in
Groups
Groups
Django users
Conversations
About
Send feedback
Help
Set null value for floatfield
257 views
Skip to first unread message
Rakhee Menon
unread,
Jul 1, 2018, 8:09:11 AM
7/1/18
Reply to author
Sign in to reply to author
Forward
Sign in to forward
Delete
You do not have permission to delete messages in this group
Copy link
Report message
Show original message
Either email addresses are anonymous for this group or you need the view member email addresses permission to view the original message
to Django users
Hi,
Please could anyone tell how to set null value for FloatField and when I try with null=True and blank=true I get this error
AssertionError: Expected a `Response`, `HttpResponse` or `HttpStreamingResponse` to be returned from the view, but received a `<class 'NoneType'>`
Regards,
Rakhee
Jason
unread,
Jul 1, 2018, 8:19:26 AM
7/1/18
Reply to author
Sign in to reply to author
Forward
Sign in to forward
Delete
You do not have permission to delete messages in this group
Copy link
Report message
Show original message
Either email addresses are anonymous for this group or you need the view member email addresses permission to view the original message
to Django users
You're not returning a response from the view method. this has nothing to do with setting the value on the model field.
Rakhee Menon
unread,
Jul 3, 2018, 1:24:40 AM
7/3/18
Reply to author
Sign in to reply to author
Forward
Sign in to forward
Delete
You do not have permission to delete messages in this group
Copy link
Report message
Show original message
Either email addresses are anonymous for this group or you need the view member email addresses permission to view the original message
to Django users
Yeah! but now I get this error
'required': 'This field is required.', 'null': 'This field may not be null.', 'invalid': 'Invalid data. Expected a dictionary, but got {datatype}.'}
ipdb> serializer.errors
{'cast_weight': ['A valid number is required.']}
In models.py
cast_weight = models.FloatField(
null
=
True
,
blank
=
True
)
Jason
unread,
Jul 3, 2018, 12:09:31 PM
7/3/18
Reply to author
Sign in to reply to author
Forward
Sign in to forward
Delete
You do not have permission to delete messages in this group
Copy link
Report message
Show original message
Either email addresses are anonymous for this group or you need the view member email addresses permission to view the original message
to Django users
sounds like you didn't make a migration after the change.
Reply all
Reply to author
Forward
0 new messages