djapiauth/forms.py
def get_api_key_form(userfilter={}):
    """
    userfileter: when binding api key with user, filter some users if necessary
    """
    class APIKeyForm(ModelForm):
        class Meta:
            model = APIKeys
            exclude = ("apitree",)
        user = forms.ModelChoiceField(queryset=get_user_model().objects.filter(**userfilter),
                                      required=True,)
    return APIKeyForm
def get_api_key_form(userfilter={}):
    """
    userfileter: when binding api key with user, filter some users if necessary
    """
    class APIKeyForm(ModelForm):
        class Meta:
            model = APIKeys
            exclude = ("apitree",)
        user = forms.ModelChoiceField(queryset=get_user_model().objects.filter(**userfilter),
                                      required=True,)
    return APIKeyForm
def get_api_key_form ( userfilter = { } ) : class APIKeyForm ( ModelForm ) : class Meta : model = APIKeys exclude = ( "apitree" , ) user = forms . ModelChoiceField ( queryset = get_user_model ( ) . objects . filter ( * * userfilter ) , required = True , ) return APIKeyForm
userfileter: when binding api key with user, filter some users if necessary
userfileter : when binding api key with user filter some users if necessary