def get_fields(self):

        ret = SortedDict()

        mapper = class_mapper(self.cls.__class__)

        r = self.context['request']
        try:
            # URI field for get pk field
            pk_field = primary_key(self.cls.__class__)
            ret['href'] = AlchemyUriField(source=pk_field,
                                          path=r.build_absolute_uri(r.path),
                                          read_only=True)
        except KeyNotFoundException:
            pass

        # Get all the Column fields
        for col_prop in mapper.iterate_properties:
            if isinstance(col_prop, ColumnProperty):
                field_nm = str(col_prop).split('.')[1]
                field_cls = col_prop.columns[0].type.__class__

                assert field_cls in self.field_mapping, \
                    field_cls % "Field %s has not been mapped"

                ret[field_nm] = self.field_mapping[field_cls]()

        # Get all the relationship fields
        for rel_prop in mapper.iterate_properties:
            if isinstance(rel_prop, RelationshipProperty):
                field_nm = str(rel_prop).split('.')[1]
                # many becomes same as uselist so that
                # RelatedField can iterate over the queryset
                kwargs = dict(
                    path=r.build_absolute_uri(r.path),
                    read_only=True
                )
                if rel_prop.uselist:
                    kwargs['many'] = True
                ret[field_nm] = AlchemyRelatedField(**kwargs)

        return ret
dataset/ETHPy150Open dealertrack/djangorest-alchemy/djangorest_alchemy/serializers.py/AlchemyModelSerializer.get_fields/swapped operands of `%`