答案是否定的,您不能同時使用hstore庫的當前實現。看看初始化函數(這是從他們在github源):
class DictionaryField(HStoreField):
description = _("A python dictionary in a postgresql hstore field.")
def __init__(self, *args, **kwargs):
self.schema = kwargs.pop('schema', None)
self.schema_mode = False
# if schema parameter is supplied the behaviour is slightly different
if self.schema is not None:
self._validate_schema(self.schema)
self.schema_mode = True
# DictionaryField with schema is not editable via admin
kwargs['editable'] = False
# null defaults to True to facilitate migrations
kwargs['null'] = kwargs.get('null', True)
super(DictionaryField, self).__init__(*args, **kwargs)
你可以看到,如果該模式被設置,則該字段的編輯參數設置爲false,這是什麼Django admin會查看是否允許您在管理界面中編輯值。
不幸的是,你只有幾個選擇:通過創建自己的類來繼承它,或者在他們的github頁面上打開拉請求或問題,並希望有人能夠接受它。
hstore已經看起來太強大了。感謝您的通知。 –