You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Describe the bug
Serialising a model-object after using a F Expression directly against a objects fields (as opposed to using .filter.update), causes the fields that the F expression is against, to return an object and not the actual value of the field.
Reproduce
Lets say we have the following model:
classPost(models.Model):
''' Represents a post '''id=fields.IntField(pk=True)
title=fields.TextField(max_length=150)
content=fields.TextField(max_length=1200)
created=fields.DatetimeField(auto_now=True)
likes=fields.BigIntField(
default=0
)
dislikes=fields.BigIntField(
default=0
)
def__str__(self) ->str:
returnf"{self.created} | {self.title}"
And we try do some 'updates' to a 'post' object like below, causes undefined behaviour.
Expected behavior
Expecting the value of "likes" and "dislikes" to actually bt eh value of "likes" and "dislikes" on the object after being incremented/decremented, not a object
The text was updated successfully, but these errors were encountered:
Describe the bug
Serialising a model-object after using a F Expression directly against a objects fields (as opposed to using .filter.update), causes the fields that the F expression is against, to return an object and not the actual value of the field.
Reproduce
Lets say we have the following model:
And we try do some 'updates' to a 'post' object like below, causes undefined behaviour.
Serialising the above post, causes the 'likes' and 'dislikes' field to be replaced by a object, which looks something along the lines of:
Expected behavior
Expecting the value of "likes" and "dislikes" to actually bt eh value of "likes" and "dislikes" on the object after being incremented/decremented, not a object
The text was updated successfully, but these errors were encountered: