Creating a simple CRUD interface
CRUD refers to Create, Read, Update, and Delete. A basic necessity of having an admin interface is to have the ability to create, modify, or delete the records/resources from the application as and when needed. We will create a simple admin interface that will allow the admin users to perform these operations on the records that other normal users generally can't.
Getting ready
We will start with our authentication application from the Authenticating using the Flask-Login extension recipe in Chapter 6, Authenticating in Flask, and add admin authentication and an interface for admins to the same, to allow only the admin users to create, update, and delete user records. Here, in this recipe, I will cover some specific parts that are needed to understand the concepts. For the complete application, refer to the code samples available with the book.
How to do it…
We will start with our models by adding a new field called admin
to the User
model in models.py
. This...