1

How can I tell flask-admin to use an alternative representation for Foreign Key Fields such as the following in this RoleUser link table?

Flask-Admin

David Watson
  • 3,394
  • 2
  • 36
  • 51

1 Answers1

6

The simplest way is to add __str__ methods (__unicode__ for Python 2) to your models.

class Role(db.Model):
    # snip
    def __str__(self):
        return self.name
dirn
  • 19,454
  • 5
  • 69
  • 74