mirror of
https://github.com/netbox-community/netbox.git
synced 2026-01-18 01:32:17 -06:00
24 lines
598 B
Python
24 lines
598 B
Python
from .constants import *
|
|
from .forms import *
|
|
from .mixins import *
|
|
from .utils import *
|
|
|
|
|
|
def register_filterset(filterset_class):
|
|
"""
|
|
Decorator for registering a FilterForm -> FilterSet mapping.
|
|
|
|
Usage:
|
|
@register_filterset(DeviceFilterSet)
|
|
class DeviceFilterForm(NetBoxModelFilterSetForm):
|
|
...
|
|
|
|
Args:
|
|
filterset_class: The corresponding filterset class
|
|
"""
|
|
def decorator(form_class):
|
|
from netbox.registry import registry
|
|
registry['filtersets'][form_class] = filterset_class
|
|
return form_class
|
|
return decorator
|