  @HStoreField.register_lookup
  class ValuesTransform(Transform):
      lookup_name = 'values'
      output_field = ArrayField(TextField())
  
      def as_sql(self, compiler, connection):
          lhs, params = compiler.compile(self.lhs)
          return 'avals(%s)' % lhs, params
 
</s> remove     def as_sql(self, compiler, connection):
        lhs, params = compiler.compile(self.lhs)
        return 'akeys(%s)' % lhs, params

 </s> add  </s> remove class ValuesTransform(Transform):
 </s> add class ValuesTransform(lookups.FunctionTransform): </s> remove class KeysTransform(Transform):
 </s> add class KeysTransform(lookups.FunctionTransform): </s> remove 
    @property
    def output_field(self):
        return IntegerField()
 </s> add     output_field = IntegerField() </s> remove 
    def as_postgresql(self, compiler, connection):
        lhs, params = compiler.compile(self.lhs)
        return "UNACCENT(%s)" % lhs, params
 </s> add     function = 'UNACCENT'
  @HStoreField.register_lookup
  class ValuesTransform(Transform):
      lookup_name = 'values'
      output_field = ArrayField(TextField())




keep keep keep keep replace replace replace replace
 Move % addition to lookups, refactor postgres lookups.

These refactorings making overriding some text based lookup names on
other fields (specifically `contains`) much cleaner. It also removes a
bunch of duplication in the contrib.postgres lookups. 
django/contrib/postgres/fields/hstore.py