def is_foreign_key_field(self, field_name): field = getattr(self.model, field_name) if isinstance(field, peewee.ForeignKeyField): return True