def __init__(self, *args, **kwargs): super(GroupForm, self).__init__(*args, **kwargs) group = kwargs.get('instance', None) if group: self.fields['roles'].initial = [ role.id for role in get_global_roles(group) ]
def __init__(self, *args, **kwargs): super(UserChangeForm, self).__init__(*args, **kwargs) user = kwargs.get('instance', None) if user: self.fields['roles'].initial = [ role.id for role in get_global_roles(user) ]
def __init__(self, *args, **kwargs): super(GroupForm, self).__init__(*args, **kwargs) group = kwargs.get('instance', None) if group: self.fields['roles'].initial = [role.id for role in get_global_roles(group)]
def __init__(self, *args, **kwargs): super(UserChangeForm, self).__init__(*args, **kwargs) user = kwargs.get('instance', None) if user: self.fields['roles'].initial = [role.id for role in get_global_roles(user)]