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
Previously if an attribute was in the hidden list on the model it was only hidden from serialization not when getting the value using dot notation eg myModel.some_att
Not sure when this changed , but now when using dot notation to get attributes (that are hidden from serialization) an error similar to the following:
AttributeError: class model 'myModel' has no attribute some_att
To Reproduce
Steps to reproduce the behavior:
add a model
add attributes to fillable including the attribute to be hidden
add attribute to be hidden to hidden
save a model in any way you like to create a db row
load the model from the primary key id
print the hidden attribute via "print("hidden att {}".format(model.hidden_att_name))
See error
Expected behavior
the value of the attribute should be returned
Desktop (please complete the following information):
OS: Mac OSX
Version 10.15.7
What database are you using?
Type: Postgres
Version 10.12
Masonite ORM 1.0.63
The text was updated successfully, but these errors were encountered:
In your example you are using the created model instance straight after creating it.
This may be a hydration issue when populating the model at some point well after it was created is the issue.
As I noted above can you try getting the the model into a new var via the primary key .find(pk) or .first()
this will hydrate the model from the select directly
I will also investigate further and rollback to previous ORM versions to establish when this changed (or if its just me ;)
Describe the bug
Previously if an attribute was in the hidden list on the model it was only hidden from serialization not when getting the value using dot notation eg myModel.some_att
Not sure when this changed , but now when using dot notation to get attributes (that are hidden from serialization) an error similar to the following:
AttributeError: class model 'myModel' has no attribute some_att
To Reproduce
Steps to reproduce the behavior:
Expected behavior
the value of the attribute should be returned
Desktop (please complete the following information):
What database are you using?
The text was updated successfully, but these errors were encountered: