admin: fix linting

This commit is contained in:
Jens Langhammer 2020-05-20 13:59:56 +02:00
parent c329a724e8
commit cafe2f1e1f
9 changed files with 58 additions and 36 deletions

View File

@ -29,9 +29,7 @@ class PolicyListView(LoginRequiredMixin, PermissionListMixin, ListView):
template_name = "administration/policy/list.html" template_name = "administration/policy/list.html"
def get_context_data(self, **kwargs): def get_context_data(self, **kwargs):
kwargs["types"] = { kwargs["types"] = {x.__name__: x for x in all_subclasses(Policy)}
x.__name__: x for x in all_subclasses(Policy)
}
return super().get_context_data(**kwargs) return super().get_context_data(**kwargs)
def get_queryset(self): def get_queryset(self):

View File

@ -26,9 +26,7 @@ class PropertyMappingListView(LoginRequiredMixin, PermissionListMixin, ListView)
paginate_by = 40 paginate_by = 40
def get_context_data(self, **kwargs): def get_context_data(self, **kwargs):
kwargs["types"] = { kwargs["types"] = {x.__name__: x for x in all_subclasses(PropertyMapping)}
x.__name__: x for x in all_subclasses(PropertyMapping)
}
return super().get_context_data(**kwargs) return super().get_context_data(**kwargs)
def get_queryset(self): def get_queryset(self):

View File

@ -26,9 +26,7 @@ class ProviderListView(LoginRequiredMixin, PermissionListMixin, ListView):
ordering = "id" ordering = "id"
def get_context_data(self, **kwargs): def get_context_data(self, **kwargs):
kwargs["types"] = { kwargs["types"] = {x.__name__: x for x in all_subclasses(Provider)}
x.__name__: x for x in all_subclasses(Provider)
}
return super().get_context_data(**kwargs) return super().get_context_data(**kwargs)
def get_queryset(self): def get_queryset(self):

View File

@ -26,9 +26,7 @@ class SourceListView(LoginRequiredMixin, PermissionListMixin, ListView):
template_name = "administration/source/list.html" template_name = "administration/source/list.html"
def get_context_data(self, **kwargs): def get_context_data(self, **kwargs):
kwargs["types"] = { kwargs["types"] = {x.__name__: x for x in all_subclasses(Source)}
x.__name__: x for x in all_subclasses(Source)
}
return super().get_context_data(**kwargs) return super().get_context_data(**kwargs)
def get_queryset(self): def get_queryset(self):

View File

@ -26,9 +26,7 @@ class StageListView(LoginRequiredMixin, PermissionListMixin, ListView):
paginate_by = 40 paginate_by = 40
def get_context_data(self, **kwargs): def get_context_data(self, **kwargs):
kwargs["types"] = { kwargs["types"] = {x.__name__: x for x in all_subclasses(Stage)}
x.__name__: x for x in all_subclasses(Stage)
}
return super().get_context_data(**kwargs) return super().get_context_data(**kwargs)
def get_queryset(self): def get_queryset(self):

View File

@ -101,6 +101,7 @@ def debug(obj) -> str:
LOGGER.debug(obj) LOGGER.debug(obj)
return "" return ""
@register.filter @register.filter
def doc(obj) -> str: def doc(obj) -> str:
"""Return docstring of object""" """Return docstring of object"""

View File

@ -6,28 +6,45 @@ from django.db import migrations, models
class Migration(migrations.Migration): class Migration(migrations.Migration):
dependencies = [ dependencies = [
('passbook_sources_oauth', '0001_initial'), ("passbook_sources_oauth", "0001_initial"),
] ]
operations = [ operations = [
migrations.AlterField( migrations.AlterField(
model_name='oauthsource', model_name="oauthsource",
name='access_token_url', name="access_token_url",
field=models.CharField(help_text='URL used by passbook to retrive tokens.', max_length=255, verbose_name='Access Token URL'), field=models.CharField(
help_text="URL used by passbook to retrive tokens.",
max_length=255,
verbose_name="Access Token URL",
),
), ),
migrations.AlterField( migrations.AlterField(
model_name='oauthsource', model_name="oauthsource",
name='request_token_url', name="request_token_url",
field=models.CharField(blank=True, help_text='URL used to request the initial token. This URL is only required for OAuth 1.', max_length=255, verbose_name='Request Token URL'), field=models.CharField(
blank=True,
help_text="URL used to request the initial token. This URL is only required for OAuth 1.",
max_length=255,
verbose_name="Request Token URL",
),
), ),
migrations.AlterField( migrations.AlterField(
model_name='oauthsource', model_name="oauthsource",
name='authorization_url', name="authorization_url",
field=models.CharField(help_text='URL the user is redirect to to conest the flow.', max_length=255, verbose_name='Authorization URL'), field=models.CharField(
help_text="URL the user is redirect to to conest the flow.",
max_length=255,
verbose_name="Authorization URL",
),
), ),
migrations.AlterField( migrations.AlterField(
model_name='oauthsource', model_name="oauthsource",
name='profile_url', name="profile_url",
field=models.CharField(help_text='URL used by passbook to get user information.', max_length=255, verbose_name='Profile URL'), field=models.CharField(
help_text="URL used by passbook to get user information.",
max_length=255,
verbose_name="Profile URL",
),
), ),
] ]

View File

@ -14,20 +14,28 @@ class OAuthSource(Source):
provider_type = models.CharField(max_length=255) provider_type = models.CharField(max_length=255)
request_token_url = models.CharField( request_token_url = models.CharField(
blank=True, max_length=255, verbose_name=_("Request Token URL"), blank=True,
help_text=_("URL used to request the initial token. This URL is only required for OAuth 1.") max_length=255,
verbose_name=_("Request Token URL"),
help_text=_(
"URL used to request the initial token. This URL is only required for OAuth 1."
),
) )
authorization_url = models.CharField( authorization_url = models.CharField(
max_length=255, verbose_name=_("Authorization URL"), max_length=255,
help_text=_("URL the user is redirect to to conest the flow.") verbose_name=_("Authorization URL"),
help_text=_("URL the user is redirect to to conest the flow."),
) )
access_token_url = models.CharField( access_token_url = models.CharField(
max_length=255, verbose_name=_("Access Token URL"), max_length=255,
help_text=_("URL used by passbook to retrive tokens.") verbose_name=_("Access Token URL"),
help_text=_("URL used by passbook to retrive tokens."),
) )
profile_url = models.CharField( profile_url = models.CharField(
max_length=255, verbose_name=_("Profile URL"), max_length=255,
help_text=_("URL used by passbook to get user information.")) verbose_name=_("Profile URL"),
help_text=_("URL used by passbook to get user information."),
)
consumer_key = models.TextField() consumer_key = models.TextField()
consumer_secret = models.TextField() consumer_secret = models.TextField()
@ -145,6 +153,7 @@ class AzureADOAuthSource(OAuthSource):
verbose_name = _("Azure AD OAuth Source") verbose_name = _("Azure AD OAuth Source")
verbose_name_plural = _("Azure AD OAuth Sources") verbose_name_plural = _("Azure AD OAuth Sources")
class OpenIDOAuthSource(OAuthSource): class OpenIDOAuthSource(OAuthSource):
"""Abstract subclass of OAuthSource to specify OpenID Form""" """Abstract subclass of OAuthSource to specify OpenID Form"""

View File

@ -5780,20 +5780,25 @@ definitions:
minLength: 1 minLength: 1
request_token_url: request_token_url:
title: Request Token URL title: Request Token URL
description: URL used to request the initial token. This URL is only required
for OAuth 1.
type: string type: string
maxLength: 255 maxLength: 255
authorization_url: authorization_url:
title: Authorization URL title: Authorization URL
description: URL the user is redirect to to conest the flow.
type: string type: string
maxLength: 255 maxLength: 255
minLength: 1 minLength: 1
access_token_url: access_token_url:
title: Access Token URL title: Access Token URL
description: URL used by passbook to retrive tokens.
type: string type: string
maxLength: 255 maxLength: 255
minLength: 1 minLength: 1
profile_url: profile_url:
title: Profile URL title: Profile URL
description: URL used by passbook to get user information.
type: string type: string
maxLength: 255 maxLength: 255
minLength: 1 minLength: 1