mirror of
https://github.com/cisagov/manage.get.gov.git
synced 2025-07-25 03:58:39 +02:00
lint
This commit is contained in:
parent
334b913732
commit
abaab14200
2 changed files with 16 additions and 13 deletions
|
@ -6,7 +6,6 @@ from django.shortcuts import redirect
|
||||||
from django_fsm import get_available_FIELD_transitions
|
from django_fsm import get_available_FIELD_transitions
|
||||||
from django.contrib import admin, messages
|
from django.contrib import admin, messages
|
||||||
from django.contrib.auth.admin import UserAdmin as BaseUserAdmin
|
from django.contrib.auth.admin import UserAdmin as BaseUserAdmin
|
||||||
from django.contrib.admin.options import BaseModelAdmin
|
|
||||||
from django.contrib.auth.models import Group
|
from django.contrib.auth.models import Group
|
||||||
from django.contrib.contenttypes.models import ContentType
|
from django.contrib.contenttypes.models import ContentType
|
||||||
from django.http.response import HttpResponseRedirect
|
from django.http.response import HttpResponseRedirect
|
||||||
|
@ -31,28 +30,31 @@ logger = logging.getLogger(__name__)
|
||||||
class MyUserAdminForm(forms.ModelForm):
|
class MyUserAdminForm(forms.ModelForm):
|
||||||
class Meta:
|
class Meta:
|
||||||
model = models.User
|
model = models.User
|
||||||
fields = '__all__'
|
fields = "__all__"
|
||||||
widgets = {
|
widgets = {
|
||||||
'groups': NoAutocompleteFilteredSelectMultiple('groups', False),
|
"groups": NoAutocompleteFilteredSelectMultiple("groups", False),
|
||||||
'user_permissions': NoAutocompleteFilteredSelectMultiple('user_permissions', False),
|
"user_permissions": NoAutocompleteFilteredSelectMultiple("user_permissions", False),
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
class DomainInformationAdminForm(forms.ModelForm):
|
class DomainInformationAdminForm(forms.ModelForm):
|
||||||
class Meta:
|
class Meta:
|
||||||
model = models.DomainInformation
|
model = models.DomainInformation
|
||||||
fields = '__all__'
|
fields = "__all__"
|
||||||
widgets = {
|
widgets = {
|
||||||
'other_contacts': NoAutocompleteFilteredSelectMultiple('other_contacts', False),
|
"other_contacts": NoAutocompleteFilteredSelectMultiple("other_contacts", False),
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
class DomainInformationInlineForm(forms.ModelForm):
|
class DomainInformationInlineForm(forms.ModelForm):
|
||||||
class Meta:
|
class Meta:
|
||||||
model = models.DomainInformation
|
model = models.DomainInformation
|
||||||
fields = '__all__'
|
fields = "__all__"
|
||||||
widgets = {
|
widgets = {
|
||||||
'other_contacts': NoAutocompleteFilteredSelectMultiple('other_contacts', False),
|
"other_contacts": NoAutocompleteFilteredSelectMultiple("other_contacts", False),
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
class DomainApplicationAdminForm(forms.ModelForm):
|
class DomainApplicationAdminForm(forms.ModelForm):
|
||||||
"""Custom form to limit transitions to available transitions"""
|
"""Custom form to limit transitions to available transitions"""
|
||||||
|
|
||||||
|
@ -60,9 +62,9 @@ class DomainApplicationAdminForm(forms.ModelForm):
|
||||||
model = models.DomainApplication
|
model = models.DomainApplication
|
||||||
fields = "__all__"
|
fields = "__all__"
|
||||||
widgets = {
|
widgets = {
|
||||||
'current_websites': NoAutocompleteFilteredSelectMultiple('current_websites', False),
|
"current_websites": NoAutocompleteFilteredSelectMultiple("current_websites", False),
|
||||||
'alternative_domains': NoAutocompleteFilteredSelectMultiple('alternative_domains', False),
|
"alternative_domains": NoAutocompleteFilteredSelectMultiple("alternative_domains", False),
|
||||||
'other_contacts': NoAutocompleteFilteredSelectMultiple('other_contacts', False),
|
"other_contacts": NoAutocompleteFilteredSelectMultiple("other_contacts", False),
|
||||||
}
|
}
|
||||||
|
|
||||||
def __init__(self, *args, **kwargs):
|
def __init__(self, *args, **kwargs):
|
||||||
|
|
|
@ -3,6 +3,7 @@
|
||||||
from django.contrib.admin.widgets import FilteredSelectMultiple
|
from django.contrib.admin.widgets import FilteredSelectMultiple
|
||||||
from django.utils.safestring import mark_safe
|
from django.utils.safestring import mark_safe
|
||||||
|
|
||||||
|
|
||||||
class NoAutocompleteFilteredSelectMultiple(FilteredSelectMultiple):
|
class NoAutocompleteFilteredSelectMultiple(FilteredSelectMultiple):
|
||||||
"""Firefox and Edge are unable to correctly initialize the source select in filter_horizontal
|
"""Firefox and Edge are unable to correctly initialize the source select in filter_horizontal
|
||||||
widgets. We add the attribute autocomplete=off to fix that."""
|
widgets. We add the attribute autocomplete=off to fix that."""
|
||||||
|
@ -10,6 +11,6 @@ class NoAutocompleteFilteredSelectMultiple(FilteredSelectMultiple):
|
||||||
def render(self, name, value, attrs=None, renderer=None):
|
def render(self, name, value, attrs=None, renderer=None):
|
||||||
if attrs is None:
|
if attrs is None:
|
||||||
attrs = {}
|
attrs = {}
|
||||||
attrs['autocomplete'] = 'off'
|
attrs["autocomplete"] = "off"
|
||||||
output = super().render(name, value, attrs=attrs, renderer=renderer)
|
output = super().render(name, value, attrs=attrs, renderer=renderer)
|
||||||
return mark_safe(output)
|
return mark_safe(output) # nosec
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue