mirror of https://github.com/jumpserver/jumpserver
You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
17 lines
412 B
17 lines
412 B
5 years ago
|
# -*- coding: utf-8 -*-
|
||
|
#
|
||
|
|
||
|
from django import forms
|
||
|
|
||
|
__all__ = ['OrgModelForm']
|
||
|
|
||
|
|
||
|
class OrgModelForm(forms.ModelForm):
|
||
|
def __init__(self, *args, **kwargs):
|
||
|
super().__init__(*args, **kwargs)
|
||
|
for name, field in self.fields.items():
|
||
|
if not hasattr(field, 'queryset'):
|
||
|
continue
|
||
|
model = field.queryset.model
|
||
|
field.queryset = model.objects.all()
|