mirror of
https://github.com/ae-utbm/sith.git
synced 2024-11-15 02:33:22 +00:00
Remove ajax_select from core/views/forms.py
This commit is contained in:
parent
8e7c09332f
commit
e7181257e3
@ -23,8 +23,6 @@
|
|||||||
import re
|
import re
|
||||||
from io import BytesIO
|
from io import BytesIO
|
||||||
|
|
||||||
from ajax_select import make_ajax_field
|
|
||||||
from ajax_select.fields import AutoCompleteSelectField
|
|
||||||
from captcha.fields import CaptchaField
|
from captcha.fields import CaptchaField
|
||||||
from django import forms
|
from django import forms
|
||||||
from django.conf import settings
|
from django.conf import settings
|
||||||
@ -45,6 +43,12 @@ from PIL import Image
|
|||||||
from antispam.forms import AntiSpamEmailField
|
from antispam.forms import AntiSpamEmailField
|
||||||
from core.models import Gift, Page, SithFile, User
|
from core.models import Gift, Page, SithFile, User
|
||||||
from core.utils import resize_image
|
from core.utils import resize_image
|
||||||
|
from core.views.widgets.select import (
|
||||||
|
AutoCompleteSelect,
|
||||||
|
AutoCompleteSelectGroup,
|
||||||
|
AutoCompleteSelectMultipleGroup,
|
||||||
|
AutoCompleteSelectUser,
|
||||||
|
)
|
||||||
|
|
||||||
# Widgets
|
# Widgets
|
||||||
|
|
||||||
@ -296,8 +300,12 @@ class UserGodfathersForm(forms.Form):
|
|||||||
],
|
],
|
||||||
label=_("Add"),
|
label=_("Add"),
|
||||||
)
|
)
|
||||||
user = AutoCompleteSelectField(
|
user = forms.ModelChoiceField(
|
||||||
"users", required=True, label=_("Select user"), help_text=""
|
label=_("Select user"),
|
||||||
|
help_text=None,
|
||||||
|
required=True,
|
||||||
|
widget=AutoCompleteSelectUser,
|
||||||
|
queryset=User.objects.all(),
|
||||||
)
|
)
|
||||||
|
|
||||||
def __init__(self, *args, user: User, **kwargs):
|
def __init__(self, *args, user: User, **kwargs):
|
||||||
@ -339,13 +347,12 @@ class PagePropForm(forms.ModelForm):
|
|||||||
class Meta:
|
class Meta:
|
||||||
model = Page
|
model = Page
|
||||||
fields = ["parent", "name", "owner_group", "edit_groups", "view_groups"]
|
fields = ["parent", "name", "owner_group", "edit_groups", "view_groups"]
|
||||||
|
widgets = {
|
||||||
edit_groups = make_ajax_field(
|
"parent": AutoCompleteSelect,
|
||||||
Page, "edit_groups", "groups", help_text="", label=_("edit groups")
|
"owner_group": AutoCompleteSelectGroup,
|
||||||
)
|
"edit_groups": AutoCompleteSelectMultipleGroup,
|
||||||
view_groups = make_ajax_field(
|
"view_groups": AutoCompleteSelectMultipleGroup,
|
||||||
Page, "view_groups", "groups", help_text="", label=_("view groups")
|
}
|
||||||
)
|
|
||||||
|
|
||||||
def __init__(self, *arg, **kwargs):
|
def __init__(self, *arg, **kwargs):
|
||||||
super().__init__(*arg, **kwargs)
|
super().__init__(*arg, **kwargs)
|
||||||
@ -357,13 +364,12 @@ class PageForm(forms.ModelForm):
|
|||||||
class Meta:
|
class Meta:
|
||||||
model = Page
|
model = Page
|
||||||
fields = ["parent", "name", "owner_group", "edit_groups", "view_groups"]
|
fields = ["parent", "name", "owner_group", "edit_groups", "view_groups"]
|
||||||
|
widgets = {
|
||||||
edit_groups = make_ajax_field(
|
"parent": AutoCompleteSelect,
|
||||||
Page, "edit_groups", "groups", help_text="", label=_("edit groups")
|
"owner_group": AutoCompleteSelectGroup,
|
||||||
)
|
"edit_groups": AutoCompleteSelectMultipleGroup,
|
||||||
view_groups = make_ajax_field(
|
"view_groups": AutoCompleteSelectMultipleGroup,
|
||||||
Page, "view_groups", "groups", help_text="", label=_("view groups")
|
}
|
||||||
)
|
|
||||||
|
|
||||||
def __init__(self, *args, **kwargs):
|
def __init__(self, *args, **kwargs):
|
||||||
super().__init__(*args, **kwargs)
|
super().__init__(*args, **kwargs)
|
||||||
|
Loading…
Reference in New Issue
Block a user