FastAPI Admin


1. Create a basic FastAPI-Admin app

from fastapi import FastAPI
from fastapi_admin.app import FastAPIAdmin

app = FastAPI()
admin = FastAPIAdmin(app)

2. Add a model to the admin interface

from pydantic import BaseModel

class User(BaseModel):
    id: int
    name: str

admin.add_model(User)

3. Customize the model's display fields

class User(BaseModel):
    id: int
    name: str

admin.add_model(User, display_fields=("id", "name"))

4. Add a custom action to the model

5. Customize the action's display name

6. Add a custom filter to the model

7. Customize the filter's display name

8. Add a custom export format to the model

9. Customize the export format's display name

10. Add a custom import handler to the model

11. Customize the import handler's display name

12. Add a custom view to the model

13. Customize the view's display name

14. Add a custom link to the navigation bar

15. Customize the link's display name

16. Add a custom menu item to the sidebar

17. Customize the menu item's display name

18. Add a custom theme to the admin interface

19. Customize the theme's colors

20. Customize the theme's fonts

21. Customize the theme's layout

22. Add a custom branding logo to the admin interface

23. Customize the branding logo's size

24. Add a custom branding name to the admin interface

25. Customize the branding name's color

26. Add a custom favicon to the admin interface

27. Customize the favicon's size

28. Add a custom background image to the login page

29. Customize the login background image's size

30. Add a custom CSS file to the admin interface

31. Add a custom JavaScript file to the admin interface

32. Add a custom view to the login page

33. Add a custom view to the logout page

34. Add a custom error handler to the admin interface

35. Add a custom template context processor to the admin interface

36. Add a custom middleware to the admin interface