don't show polymorphic_ctype in unique validation error messaging

see: https://github.com/ansible/ansible-tower/issues/7620
This commit is contained in:
Ryan Petrello
2017-09-19 15:58:43 -04:00
committed by Matthew Jones
parent 70f8ec78de
commit 96572fe3d4

View File

@@ -309,7 +309,10 @@ class PrimordialModel(CreatedModifiedModel):
continue
if not (self.pk and self.pk == obj.pk):
errors.append(
'%s with this (%s) combination already exists.' % (model.__name__, ', '.join(ut))
'%s with this (%s) combination already exists.' % (
model.__name__,
', '.join(set(ut) - {'polymorphic_ctype'})
)
)
if errors:
raise ValidationError(errors)