Setup the admin dash.
(self)
| 527 | ) |
| 528 | |
| 529 | def setup_admin_dash(self): |
| 530 | """Setup the admin dash.""" |
| 531 | # Get the admin dash. |
| 532 | admin_dash = self.admin_dash |
| 533 | |
| 534 | if admin_dash and admin_dash.models: |
| 535 | # Build the admin dashboard |
| 536 | admin = ( |
| 537 | admin_dash.admin |
| 538 | if admin_dash.admin |
| 539 | else Admin( |
| 540 | engine=Model.get_db_engine(), |
| 541 | title="Nextpy Admin Dashboard", |
| 542 | logo_url="https://nextpy.org/Nextpy.svg", |
| 543 | ) |
| 544 | ) |
| 545 | |
| 546 | for model in admin_dash.models: |
| 547 | view = admin_dash.view_overrides.get(model, ModelView) |
| 548 | admin.add_view(view(model)) |
| 549 | |
| 550 | admin.mount_to(self.api) |
| 551 | |
| 552 | def get_frontend_packages(self, imports: Dict[str, set[ReactImportVar]]): |
| 553 | """Gets the frontend packages to be installed and filters out the unnecessary ones. |
no test coverage detected