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
I have a custom field that stores the import path to a Python class. The db_value takes the class object and coverts it to the import path string and the python_value takes the string and imports the object giving me back the class. However, as of peewee 3.13.2 this no longer works and instead gives me peewee.InternalError: (1054, "Unknown column 't1' in 'field list'") when I try to save.
Field:
classPythonObjectField(CharField):
""" A custom class for storing a Python object as a reference. """defdb_value(self, value):
ifvalueisNone:
returnNoneelifisinstance(value, str):
returnvaluereturnget_object_path(value)
defpython_value(self, value):
ifvalueisNone:
returnNonereturnimport_object(value)
When debugging this I found that this affects my Model derived classes but not a simple one that only extends object. Additionally, I found that db_value is never called.
The text was updated successfully, but these errors were encountered:
It isn't calling db_value() because peewee sees that you're using a model class as a value, which is a recognized AST type. The issue that originated this fix is #2131.
I have a custom field that stores the import path to a Python class. The
db_value
takes the class object and coverts it to the import path string and thepython_value
takes the string and imports the object giving me back the class. However, as of peewee 3.13.2 this no longer works and instead gives mepeewee.InternalError: (1054, "Unknown column 't1' in 'field list'")
when I try to save.Field:
The usage would be
Model.field = SomeOtherModel
Full example script
When debugging this I found that this affects my
Model
derived classes but not a simple one that only extendsobject
. Additionally, I found thatdb_value
is never called.The text was updated successfully, but these errors were encountered: