

def _remove_hstore_virtual_fields(self):
    ' remove hstore virtual fields from class '
    cls = self.model
    if hasattr(cls, '_hstore_virtual_fields'):
        for field_name in cls._hstore_virtual_fields.keys():
            delattr(cls, field_name)
        delattr(cls, '_hstore_virtual_fields')
    if (parse_version(get_version()[0:3]) >= parse_version('1.8')):
        hstore_fields = []
        for field in getattr(cls._meta, 'virtual_fields'):
            if hasattr(field, 'hstore_field_name'):
                hstore_fields.append(field)
        for field in hstore_fields:
            getattr(cls._meta, 'virtual_fields').remove(field)
        fields = [f for f in cls._meta.fields if (not hasattr(f, 'hstore_field_name'))]
        cls._meta.fields = cls._meta.fields.__class__(fields)
    else:
        for meta_fields in ['fields', 'local_fields', 'virtual_fields']:
            hstore_fields = []
            for field in getattr(cls._meta, meta_fields):
                if hasattr(field, 'hstore_field_name'):
                    hstore_fields.append(field)
            for field in hstore_fields:
                getattr(cls._meta, meta_fields).remove(field)

dataset/ETHPy150Open djangonauts/django-hstore/django_hstore/fields.py DictionaryField._remove_hstore_virtual_fields/original