From 50b54f5aca484eb2de8d1e0f131f4a935d27d1c2 Mon Sep 17 00:00:00 2001 From: mathieusteele Date: Thu, 14 Oct 2010 19:14:58 -0700 Subject: [PATCH] removed requirement for primary key to be an IntegerField. --- polymorphic/showfields.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/polymorphic/showfields.py b/polymorphic/showfields.py index deb98cd..c00fc97 100644 --- a/polymorphic/showfields.py +++ b/polymorphic/showfields.py @@ -12,7 +12,7 @@ def _represent_foreign_key(o): class ShowFieldsAndTypes(object): """ model mixin, like ShowFields, but also show field types """ def __repr__(self): - out = 'id %d' % (self.pk) + out = 'id ' + str(self.pk) for f in self._meta.fields: if f.name in [ 'id' ] + self.polymorphic_internal_model_fields or 'ptr' in f.name: continue out += ', ' + f.name + ' (' + type(f).__name__ + ')' @@ -26,7 +26,7 @@ class ShowFieldsAndTypes(object): class ShowFields(object): """ model mixin that shows the object's class, it's fields and field contents """ def __repr__(self): - out = 'id %d, ' % (self.pk) + out = 'id ' + str(self.pk) + ', ' for f in self._meta.fields: if f.name in [ 'id' ] + self.polymorphic_internal_model_fields or 'ptr' in f.name: continue out += ', ' + f.name @@ -42,7 +42,7 @@ class ShowFieldTypes(object): This mixin is already used by default by PolymorphicModel. (model mixin that shows the object's class and it's field types) """ def __repr__(self): - out = self.__class__.__name__ + ': id %d' % (self.pk or - 1) + out = self.__class__.__name__ + ': id ' + str(self.pk) for f in self._meta.fields: if f.name in [ 'id' ] + self.polymorphic_internal_model_fields or 'ptr' in f.name: continue out += ', ' + f.name + ' (' + type(f).__name__ + ')'