mirror of
https://github.com/ae-utbm/sith.git
synced 2024-11-15 02:33:22 +00:00
Fix deprecated usage of schema json method and avoid multiple inheritance on select widgets
This commit is contained in:
parent
935914428b
commit
3eb3feea49
@ -1,45 +1,37 @@
|
||||
from django.forms import Select, SelectMultiple
|
||||
|
||||
from accounting.models import ClubAccount, Company
|
||||
from accounting.schemas import ClubAccountSchema, CompanySchema
|
||||
from core.views.widgets.select import AutoCompleteSelectMixin
|
||||
from core.views.widgets.select import AutoCompleteSelect, AutoCompleteSelectMultiple
|
||||
|
||||
_js = ["webpack/accounting/components/ajax-select-index.ts"]
|
||||
|
||||
|
||||
class AutoCompleteSelectClubAccount(AutoCompleteSelectMixin, Select):
|
||||
class AutoCompleteSelectClubAccount(AutoCompleteSelect):
|
||||
component_name = "club-account-ajax-select"
|
||||
model = ClubAccount
|
||||
schema = ClubAccountSchema
|
||||
|
||||
js = [
|
||||
"webpack/accounting/components/ajax-select-index.ts",
|
||||
]
|
||||
js = _js
|
||||
|
||||
|
||||
class AutoCompleteSelectMultipleClubAccount(AutoCompleteSelectMixin, SelectMultiple):
|
||||
class AutoCompleteSelectMultipleClubAccount(AutoCompleteSelectMultiple):
|
||||
component_name = "club-account-ajax-select"
|
||||
model = ClubAccount
|
||||
schema = ClubAccountSchema
|
||||
|
||||
js = [
|
||||
"webpack/accounting/components/ajax-select-index.ts",
|
||||
]
|
||||
js = _js
|
||||
|
||||
|
||||
class AutoCompleteSelectCompany(AutoCompleteSelectMixin, Select):
|
||||
class AutoCompleteSelectCompany(AutoCompleteSelect):
|
||||
component_name = "company-ajax-select"
|
||||
model = Company
|
||||
schema = CompanySchema
|
||||
|
||||
js = [
|
||||
"webpack/accounting/components/ajax-select-index.ts",
|
||||
]
|
||||
js = _js
|
||||
|
||||
|
||||
class AutoCompleteSelectMultipleCompany(AutoCompleteSelectMixin, SelectMultiple):
|
||||
class AutoCompleteSelectMultipleCompany(AutoCompleteSelectMultiple):
|
||||
component_name = "company-ajax-select"
|
||||
model = Company
|
||||
schema = CompanySchema
|
||||
|
||||
js = [
|
||||
"webpack/accounting/components/ajax-select-index.ts",
|
||||
]
|
||||
js = _js
|
||||
|
@ -1,25 +1,21 @@
|
||||
from django.forms import Select, SelectMultiple
|
||||
|
||||
from club.models import Club
|
||||
from club.schemas import ClubSchema
|
||||
from core.views.widgets.select import AutoCompleteSelectMixin
|
||||
from core.views.widgets.select import AutoCompleteSelect, AutoCompleteSelectMultiple
|
||||
|
||||
_js = ["webpack/club/components/ajax-select-index.ts"]
|
||||
|
||||
|
||||
class AutoCompleteSelectClub(AutoCompleteSelectMixin, Select):
|
||||
class AutoCompleteSelectClub(AutoCompleteSelect):
|
||||
component_name = "club-ajax-select"
|
||||
model = Club
|
||||
schema = ClubSchema
|
||||
|
||||
js = [
|
||||
"webpack/club/components/ajax-select-index.ts",
|
||||
]
|
||||
js = _js
|
||||
|
||||
|
||||
class AutoCompleteSelectMultipleClub(AutoCompleteSelectMixin, SelectMultiple):
|
||||
class AutoCompleteSelectMultipleClub(AutoCompleteSelectMultiple):
|
||||
component_name = "club-ajax-select"
|
||||
model = Club
|
||||
schema = ClubSchema
|
||||
|
||||
js = [
|
||||
"webpack/club/components/ajax-select-index.ts",
|
||||
]
|
||||
js = _js
|
||||
|
@ -47,7 +47,7 @@ class AutoCompleteSelectMixin:
|
||||
}
|
||||
if self.is_ajax:
|
||||
context["selected"] = [
|
||||
self.schema.from_orm(obj).json()
|
||||
self.schema.from_orm(obj).model_dump_json()
|
||||
for obj in self.model.objects.filter(
|
||||
**{
|
||||
f"{self.pk}__in": [
|
||||
@ -69,37 +69,37 @@ class AutoCompleteSelect(AutoCompleteSelectMixin, Select): ...
|
||||
class AutoCompleteSelectMultiple(AutoCompleteSelectMixin, SelectMultiple): ...
|
||||
|
||||
|
||||
class AutoCompleteSelectUser(AutoCompleteSelectMixin, Select):
|
||||
class AutoCompleteSelectUser(AutoCompleteSelect):
|
||||
component_name = "user-ajax-select"
|
||||
model = User
|
||||
schema = UserProfileSchema
|
||||
|
||||
|
||||
class AutoCompleteSelectMultipleUser(AutoCompleteSelectMixin, SelectMultiple):
|
||||
class AutoCompleteSelectMultipleUser(AutoCompleteSelectMultiple):
|
||||
component_name = "user-ajax-select"
|
||||
model = User
|
||||
schema = UserProfileSchema
|
||||
|
||||
|
||||
class AutoCompleteSelectGroup(AutoCompleteSelectMixin, Select):
|
||||
class AutoCompleteSelectGroup(AutoCompleteSelect):
|
||||
component_name = "group-ajax-select"
|
||||
model = Group
|
||||
schema = GroupSchema
|
||||
|
||||
|
||||
class AutoCompleteSelectMultipleGroup(AutoCompleteSelectMixin, SelectMultiple):
|
||||
class AutoCompleteSelectMultipleGroup(AutoCompleteSelectMultiple):
|
||||
component_name = "group-ajax-select"
|
||||
model = Group
|
||||
schema = GroupSchema
|
||||
|
||||
|
||||
class AutoCompleteSelectSithFile(AutoCompleteSelectMixin, Select):
|
||||
class AutoCompleteSelectSithFile(AutoCompleteSelect):
|
||||
component_name = "sith-file-ajax-select"
|
||||
model = SithFile
|
||||
schema = SithFileSchema
|
||||
|
||||
|
||||
class AutoCompleteSelectMultipleSithFile(AutoCompleteSelectMixin, SelectMultiple):
|
||||
class AutoCompleteSelectMultipleSithFile(AutoCompleteSelectMultiple):
|
||||
component_name = "sith-file-ajax-select"
|
||||
model = SithFile
|
||||
schema = SithFileSchema
|
||||
|
@ -1,35 +1,33 @@
|
||||
from django.forms import Select, SelectMultiple
|
||||
|
||||
from core.views.widgets.select import AutoCompleteSelectMixin
|
||||
from core.views.widgets.select import AutoCompleteSelect, AutoCompleteSelectMultiple
|
||||
from counter.models import Counter, Product
|
||||
from counter.schemas import ProductSchema, SimplifiedCounterSchema
|
||||
|
||||
|
||||
class CounterAutoCompleteSelectMixin(AutoCompleteSelectMixin):
|
||||
js = [
|
||||
"webpack/counter/components/ajax-select-index.ts",
|
||||
]
|
||||
_js = ["webpack/counter/components/ajax-select-index.ts"]
|
||||
|
||||
|
||||
class AutoCompleteSelectCounter(CounterAutoCompleteSelectMixin, Select):
|
||||
class AutoCompleteSelectCounter(AutoCompleteSelect):
|
||||
component_name = "counter-ajax-select"
|
||||
model = Counter
|
||||
schema = SimplifiedCounterSchema
|
||||
js = _js
|
||||
|
||||
|
||||
class AutoCompleteSelectMultipleCounter(CounterAutoCompleteSelectMixin, SelectMultiple):
|
||||
class AutoCompleteSelectMultipleCounter(AutoCompleteSelectMultiple):
|
||||
component_name = "counter-ajax-select"
|
||||
model = Counter
|
||||
schema = SimplifiedCounterSchema
|
||||
js = _js
|
||||
|
||||
|
||||
class AutoCompleteSelectProduct(CounterAutoCompleteSelectMixin, Select):
|
||||
class AutoCompleteSelectProduct(AutoCompleteSelect):
|
||||
component_name = "product-ajax-select"
|
||||
model = Product
|
||||
schema = ProductSchema
|
||||
js = _js
|
||||
|
||||
|
||||
class AutoCompleteSelectMultipleProduct(CounterAutoCompleteSelectMixin, SelectMultiple):
|
||||
class AutoCompleteSelectMultipleProduct(AutoCompleteSelectMultiple):
|
||||
component_name = "product-ajax-select"
|
||||
model = Product
|
||||
schema = ProductSchema
|
||||
js = _js
|
||||
|
@ -1,25 +1,24 @@
|
||||
from django.forms import Select, SelectMultiple
|
||||
|
||||
from core.views.widgets.select import AutoCompleteSelectMixin
|
||||
from core.views.widgets.select import (
|
||||
AutoCompleteSelect,
|
||||
AutoCompleteSelectMultiple,
|
||||
)
|
||||
from sas.models import Album
|
||||
from sas.schemas import AlbumSchema
|
||||
|
||||
_js = ["webpack/sas/components/ajax-select-index.ts"]
|
||||
|
||||
class AutoCompleteSelectAlbum(AutoCompleteSelectMixin, Select):
|
||||
|
||||
class AutoCompleteSelectAlbum(AutoCompleteSelect):
|
||||
component_name = "album-ajax-select"
|
||||
model = Album
|
||||
schema = AlbumSchema
|
||||
|
||||
js = [
|
||||
"webpack/sas/components/ajax-select-index.ts",
|
||||
]
|
||||
js = _js
|
||||
|
||||
|
||||
class AutoCompleteSelectMultipleAlbum(AutoCompleteSelectMixin, SelectMultiple):
|
||||
class AutoCompleteSelectMultipleAlbum(AutoCompleteSelectMultiple):
|
||||
component_name = "album-ajax-select"
|
||||
model = Album
|
||||
schema = AlbumSchema
|
||||
|
||||
js = [
|
||||
"webpack/sas/components/ajax-select-index.ts",
|
||||
]
|
||||
js = _js
|
||||
|
Loading…
Reference in New Issue
Block a user