Routing
URL structure
For each registered model (e.g. Product), the following routes are generated under your mount prefix (e.g. /admin):
| Method | Pattern | View | Controlled by |
|---|---|---|---|
GET |
/admin/product/ |
List view | can_list |
GET |
/admin/product/create |
Create form | can_create |
POST |
/admin/product/ |
Handle create | can_create |
GET |
/admin/product/{id} |
Detail view | can_detail |
GET |
/admin/product/{id}/edit |
Edit form | can_edit |
PUT |
/admin/product/{id} |
Handle update | can_edit |
DELETE |
/admin/product/{id} |
Delete action | can_delete |
Routes are only registered for operations enabled by AdminOptions.
HyperAdminRouter
hyperadmin.routing.HyperAdminRouter
Generates and owns all FastAPI routers for HyperAdmin.
Called internally by Admin.mount(). Iterates SiteRegistry and
calls create_admin_router for each registered model.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
engine
|
Any
|
The async SQLAlchemy engine passed to every adapter. |
required |
templates
|
Jinja2Templates
|
The shared |
required |
timezone
|
tzinfo | None
|
The admin's configured display timezone ( |
None
|
datetime_format
|
str
|
The admin's configured |
'%Y-%m-%d %H:%M:%S'
|
session_factory
|
SessionFactory | None
|
A host-provided session factory forwarded to every
adapter alongside (or instead of) |
None
|
debug
|
bool
|
The admin's |
False
|
route_class
|
type[APIRoute] | None
|
The admin's |
None
|
The timezone and datetime format reach the view layer by living on the
shared Jinja environment (as the hyperadmin_timezone /
hyperadmin_datetime_format globals register_template_filters
sets), not as a constructor argument the view classes read — every view
renders through this one environment, so there is nothing else to wire.
Source code in src/hyperadmin/routing.py
420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 462 463 464 465 466 467 468 469 470 471 472 473 474 475 476 477 478 479 480 481 482 483 484 485 486 487 488 489 490 491 492 493 494 495 496 497 498 499 500 501 502 503 504 505 506 507 508 509 510 511 512 513 514 515 516 517 518 519 520 521 522 523 524 525 526 527 528 529 530 531 532 533 534 535 536 537 538 539 540 541 542 543 544 545 546 547 548 549 550 551 552 553 554 555 556 557 558 559 560 561 562 563 564 565 566 567 568 569 570 571 572 573 574 575 576 577 578 579 580 581 582 583 584 585 586 587 588 589 590 591 592 593 594 595 596 | |
generate_routes()
Generates the routes for the registered models.
Source code in src/hyperadmin/routing.py
485 486 487 488 489 490 491 492 493 494 495 496 497 498 499 500 501 502 503 504 505 506 507 508 509 510 511 512 513 514 515 516 517 518 519 520 521 522 523 524 525 526 527 528 529 530 531 532 533 534 535 536 537 538 539 540 541 542 543 544 545 546 547 548 549 550 551 552 553 554 555 556 557 558 559 560 561 562 563 564 565 566 567 568 569 570 571 572 573 574 575 576 577 578 579 580 581 582 583 584 | |
get_routers()
Returns the list of generated APIRouters.
Source code in src/hyperadmin/routing.py
594 595 596 | |