Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Ignoring specific fields, especially @property #39

Open
DefiDebauchery opened this issue Nov 2, 2024 · 1 comment
Open

Ignoring specific fields, especially @property #39

DefiDebauchery opened this issue Nov 2, 2024 · 1 comment
Assignees
Labels
bug Something isn't working

Comments

@DefiDebauchery
Copy link

I have a @property field that is simply used as a transformer:

class MySettings(ChangeDetectionMixin, BaseModel):
    myval: int

    @property
    def val(self) -> str:
        return str(Decimal(self.myval) / 10 ** 9)
    
    @val.setter
    def val(self, value: str) -> None:
        self.myval = int(Decimal(value) * 10 ** 9)

(I am certain there's a better way to do this, but haven't quite figured it out and not quite the focus)

I don't really have interest in val being evaluated as a changed field, especially since reverting the base field would still consider the model changed.

@ddanier ddanier self-assigned this Nov 27, 2024
@ddanier ddanier added the bug Something isn't working label Nov 27, 2024
@ddanier
Copy link
Member

ddanier commented Nov 27, 2024

Thanks for the report. I consider this to be a bug actually.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants