-
Notifications
You must be signed in to change notification settings - Fork 5
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
formfilters, filtersets added for all object types
- Loading branch information
Showing
3 changed files
with
112 additions
and
78 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,36 +1,56 @@ | ||
from netbox.filtersets import NetBoxModelFilterSet | ||
from .models import LUN, StorageSession, Datastore | ||
from .models import StoragePool, LUN, StorageSession, Datastore, VMDK | ||
|
||
|
||
# class StorageLUNFilterSet(NetBoxModelFilterSet): | ||
class StoragePoolFilterSet(NetBoxModelFilterSet): | ||
|
||
# class Meta: | ||
# model = StorageLUN | ||
# fields = ('id', 'storage_pool', 'name',) | ||
class Meta: | ||
model = StoragePool | ||
fields = ('id', 'name', 'device') | ||
|
||
# def search(self, queryset, name, value): | ||
# return queryset.filter(description__icontains=value) | ||
def search(self, queryset, name, value): | ||
return queryset.filter(description__icontains=value) | ||
|
||
|
||
# class StorageSessionFilterSet(NetBoxModelFilterSet): | ||
class LUNFilterSet(NetBoxModelFilterSet): | ||
|
||
# class Meta: | ||
# model = StorageSession | ||
# fields = ( | ||
# 'id', 'name', 'cluster', 'storage_lun_groups', | ||
# ) | ||
class Meta: | ||
model = LUN | ||
fields = ('id', 'storage_pool', 'name',) | ||
|
||
# def search(self, queryset, name, value): | ||
# return queryset.filter(description__icontains=value) | ||
def search(self, queryset, name, value): | ||
return queryset.filter(description__icontains=value) | ||
|
||
|
||
# class StorageLUNGroupFilterSet(NetBoxModelFilterSet): | ||
class DatastoreFilterSet(NetBoxModelFilterSet): | ||
|
||
# class Meta: | ||
# model = StorageLUNGroup | ||
# fields = ( | ||
# 'id', 'storage_pool_allocation', 'name', 'vm', | ||
# ) | ||
class Meta: | ||
model = Datastore | ||
fields = ('id', 'lun', 'name',) | ||
|
||
# def search(self, queryset, name, value): | ||
# return queryset.filter(description__icontains=value) | ||
def search(self, queryset, name, value): | ||
return queryset.filter(description__icontains=value) | ||
|
||
|
||
class StorageSessionFilterSet(NetBoxModelFilterSet): | ||
|
||
class Meta: | ||
model = StorageSession | ||
fields = ( | ||
'id', 'name', 'cluster', 'datastores', | ||
) | ||
|
||
def search(self, queryset, name, value): | ||
return queryset.filter(description__icontains=value) | ||
|
||
|
||
class VMDKFilterSet(NetBoxModelFilterSet): | ||
|
||
class Meta: | ||
model = VMDK | ||
fields = ( | ||
'id', 'name', 'vm', 'datastore', | ||
) | ||
|
||
def search(self, queryset, name, value): | ||
return queryset.filter(description__icontains=value) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters