diff --git a/django/contrib/admin/views/main.py b/django/contrib/admin/views/main.py index 025b7d28ed1..d9ac07c11b6 100644 --- a/django/contrib/admin/views/main.py +++ b/django/contrib/admin/views/main.py @@ -118,7 +118,7 @@ class AdminBoundField(object): self.raw_id_admin = use_raw_id_admin(field) self.is_date_time = isinstance(field, models.DateTimeField) self.is_file_field = isinstance(field, models.FileField) - self.needs_add_label = field.rel and isinstance(field.rel, models.ManyToOneRel) or isinstance(field.rel, models.ManyToManyRel) and field.rel.to._meta.admin + self.needs_add_label = field.rel and (isinstance(field.rel, models.ManyToOneRel) or isinstance(field.rel, models.ManyToManyRel)) and field.rel.to._meta.admin self.hidden = isinstance(self.field, models.AutoField) self.first = False