mirror of
https://github.com/jazzband/django-eav2.git
synced 2026-03-16 22:40:26 +00:00
Fix Value repr crash for missing entity
This commit is contained in:
parent
ae06c9629b
commit
e41aa04d3a
1 changed files with 11 additions and 1 deletions
|
|
@ -488,7 +488,17 @@ class Value(models.Model):
|
|||
return '{}: "{}" ({})'.format(self.attribute.name, self.value, self.entity)
|
||||
|
||||
def __repr__(self):
|
||||
return '{}: "{}" ({})'.format(self.attribute.name, self.value, self.entity.pk)
|
||||
entity_pk = None
|
||||
if self.entity is not None:
|
||||
try:
|
||||
entity_pk = self.entity.pk
|
||||
except AttributeError:
|
||||
entity_pk = None
|
||||
return '{}: "{}" ({})'.format(
|
||||
getattr(self.attribute, 'name', None),
|
||||
self.value,
|
||||
entity_pk,
|
||||
)
|
||||
|
||||
|
||||
class Entity(object):
|
||||
|
|
|
|||
Loading…
Reference in a new issue