mirror of https://github.com/jumpserver/jumpserver
17 lines
412 B
Python
17 lines
412 B
Python
# -*- 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()
|