Kathiravan Natarajan
Kathiravan Natarajan

Reputation: 3488

Need to modify the edit view in Flask admin

I am working on Flask admin. Please check the following. enter image description here

I need to edit the existing record using that edit button shown above.

My edit view is as follow : enter image description here

I need to add a field in edit view whose value appears in the image column shown in the second image.

Any help is appreciable.

Upvotes: 1

Views: 1149

Answers (1)

stamaimer
stamaimer

Reputation: 6475

Just add a field in your data model after the Image field.

class Restaurant(db.Model):

    # ...
    image = db.Column()
    field_extra = db.Column()

In Flask-Admin, use column_list to specify the field you want to display:

class RestaurantModelView(ModelView):

    column_list = ["id", "title", "course", "image"]  # fields list except `field_extra`

Upvotes: 2

Related Questions