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 |
Source code in src/hyperadmin/routing.py
249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 | |
generate_routes()
Generates the routes for the registered models.
Source code in src/hyperadmin/routing.py
276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 | |
get_routers()
Returns the list of generated APIRouters.
Source code in src/hyperadmin/routing.py
366 367 368 | |