In my model I have a getter and setter for a property:
class SomeModel(ext_models.TimeStampedModel):
...
@property
def test_field(self):
return {'key1': 'val1', 'key2': 'val2'}
@test_field.setter
def test_field(self, value):
print(value)
I'd like to use the test_field
in the admin as a dropdown.
I have tried to add it in the fieldsets
, but I receive the error
Unknown field(s) test_field specified
I have also added it to the readonly_fields
and then the field is at least displayed, however just a string and not editable of course.
Is there a nice way to get a simple dropdown widget displaying the dict?