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.models import ClubAccount, Company
|
||||||
from accounting.schemas import ClubAccountSchema, CompanySchema
|
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"
|
component_name = "club-account-ajax-select"
|
||||||
model = ClubAccount
|
model = ClubAccount
|
||||||
schema = ClubAccountSchema
|
schema = ClubAccountSchema
|
||||||
|
|
||||||
js = [
|
js = _js
|
||||||
"webpack/accounting/components/ajax-select-index.ts",
|
|
||||||
]
|
|
||||||
|
|
||||||
|
|
||||||
class AutoCompleteSelectMultipleClubAccount(AutoCompleteSelectMixin, SelectMultiple):
|
class AutoCompleteSelectMultipleClubAccount(AutoCompleteSelectMultiple):
|
||||||
component_name = "club-account-ajax-select"
|
component_name = "club-account-ajax-select"
|
||||||
model = ClubAccount
|
model = ClubAccount
|
||||||
schema = ClubAccountSchema
|
schema = ClubAccountSchema
|
||||||
|
|
||||||
js = [
|
js = _js
|
||||||
"webpack/accounting/components/ajax-select-index.ts",
|
|
||||||
]
|
|
||||||
|
|
||||||
|
|
||||||
class AutoCompleteSelectCompany(AutoCompleteSelectMixin, Select):
|
class AutoCompleteSelectCompany(AutoCompleteSelect):
|
||||||
component_name = "company-ajax-select"
|
component_name = "company-ajax-select"
|
||||||
model = Company
|
model = Company
|
||||||
schema = CompanySchema
|
schema = CompanySchema
|
||||||
|
|
||||||
js = [
|
js = _js
|
||||||
"webpack/accounting/components/ajax-select-index.ts",
|
|
||||||
]
|
|
||||||
|
|
||||||
|
|
||||||
class AutoCompleteSelectMultipleCompany(AutoCompleteSelectMixin, SelectMultiple):
|
class AutoCompleteSelectMultipleCompany(AutoCompleteSelectMultiple):
|
||||||
component_name = "company-ajax-select"
|
component_name = "company-ajax-select"
|
||||||
model = Company
|
model = Company
|
||||||
schema = CompanySchema
|
schema = CompanySchema
|
||||||
|
|
||||||
js = [
|
js = _js
|
||||||
"webpack/accounting/components/ajax-select-index.ts",
|
|
||||||
]
|
|
||||||
|
@ -1,25 +1,21 @@
|
|||||||
from django.forms import Select, SelectMultiple
|
|
||||||
|
|
||||||
from club.models import Club
|
from club.models import Club
|
||||||
from club.schemas import ClubSchema
|
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"
|
component_name = "club-ajax-select"
|
||||||
model = Club
|
model = Club
|
||||||
schema = ClubSchema
|
schema = ClubSchema
|
||||||
|
|
||||||
js = [
|
js = _js
|
||||||
"webpack/club/components/ajax-select-index.ts",
|
|
||||||
]
|
|
||||||
|
|
||||||
|
|
||||||
class AutoCompleteSelectMultipleClub(AutoCompleteSelectMixin, SelectMultiple):
|
class AutoCompleteSelectMultipleClub(AutoCompleteSelectMultiple):
|
||||||
component_name = "club-ajax-select"
|
component_name = "club-ajax-select"
|
||||||
model = Club
|
model = Club
|
||||||
schema = ClubSchema
|
schema = ClubSchema
|
||||||
|
|
||||||
js = [
|
js = _js
|
||||||
"webpack/club/components/ajax-select-index.ts",
|
|
||||||
]
|
|
||||||
|
@ -47,7 +47,7 @@ class AutoCompleteSelectMixin:
|
|||||||
}
|
}
|
||||||
if self.is_ajax:
|
if self.is_ajax:
|
||||||
context["selected"] = [
|
context["selected"] = [
|
||||||
self.schema.from_orm(obj).json()
|
self.schema.from_orm(obj).model_dump_json()
|
||||||
for obj in self.model.objects.filter(
|
for obj in self.model.objects.filter(
|
||||||
**{
|
**{
|
||||||
f"{self.pk}__in": [
|
f"{self.pk}__in": [
|
||||||
@ -69,37 +69,37 @@ class AutoCompleteSelect(AutoCompleteSelectMixin, Select): ...
|
|||||||
class AutoCompleteSelectMultiple(AutoCompleteSelectMixin, SelectMultiple): ...
|
class AutoCompleteSelectMultiple(AutoCompleteSelectMixin, SelectMultiple): ...
|
||||||
|
|
||||||
|
|
||||||
class AutoCompleteSelectUser(AutoCompleteSelectMixin, Select):
|
class AutoCompleteSelectUser(AutoCompleteSelect):
|
||||||
component_name = "user-ajax-select"
|
component_name = "user-ajax-select"
|
||||||
model = User
|
model = User
|
||||||
schema = UserProfileSchema
|
schema = UserProfileSchema
|
||||||
|
|
||||||
|
|
||||||
class AutoCompleteSelectMultipleUser(AutoCompleteSelectMixin, SelectMultiple):
|
class AutoCompleteSelectMultipleUser(AutoCompleteSelectMultiple):
|
||||||
component_name = "user-ajax-select"
|
component_name = "user-ajax-select"
|
||||||
model = User
|
model = User
|
||||||
schema = UserProfileSchema
|
schema = UserProfileSchema
|
||||||
|
|
||||||
|
|
||||||
class AutoCompleteSelectGroup(AutoCompleteSelectMixin, Select):
|
class AutoCompleteSelectGroup(AutoCompleteSelect):
|
||||||
component_name = "group-ajax-select"
|
component_name = "group-ajax-select"
|
||||||
model = Group
|
model = Group
|
||||||
schema = GroupSchema
|
schema = GroupSchema
|
||||||
|
|
||||||
|
|
||||||
class AutoCompleteSelectMultipleGroup(AutoCompleteSelectMixin, SelectMultiple):
|
class AutoCompleteSelectMultipleGroup(AutoCompleteSelectMultiple):
|
||||||
component_name = "group-ajax-select"
|
component_name = "group-ajax-select"
|
||||||
model = Group
|
model = Group
|
||||||
schema = GroupSchema
|
schema = GroupSchema
|
||||||
|
|
||||||
|
|
||||||
class AutoCompleteSelectSithFile(AutoCompleteSelectMixin, Select):
|
class AutoCompleteSelectSithFile(AutoCompleteSelect):
|
||||||
component_name = "sith-file-ajax-select"
|
component_name = "sith-file-ajax-select"
|
||||||
model = SithFile
|
model = SithFile
|
||||||
schema = SithFileSchema
|
schema = SithFileSchema
|
||||||
|
|
||||||
|
|
||||||
class AutoCompleteSelectMultipleSithFile(AutoCompleteSelectMixin, SelectMultiple):
|
class AutoCompleteSelectMultipleSithFile(AutoCompleteSelectMultiple):
|
||||||
component_name = "sith-file-ajax-select"
|
component_name = "sith-file-ajax-select"
|
||||||
model = SithFile
|
model = SithFile
|
||||||
schema = SithFileSchema
|
schema = SithFileSchema
|
||||||
|
@ -1,35 +1,33 @@
|
|||||||
from django.forms import Select, SelectMultiple
|
from core.views.widgets.select import AutoCompleteSelect, AutoCompleteSelectMultiple
|
||||||
|
|
||||||
from core.views.widgets.select import AutoCompleteSelectMixin
|
|
||||||
from counter.models import Counter, Product
|
from counter.models import Counter, Product
|
||||||
from counter.schemas import ProductSchema, SimplifiedCounterSchema
|
from counter.schemas import ProductSchema, SimplifiedCounterSchema
|
||||||
|
|
||||||
|
_js = ["webpack/counter/components/ajax-select-index.ts"]
|
||||||
class CounterAutoCompleteSelectMixin(AutoCompleteSelectMixin):
|
|
||||||
js = [
|
|
||||||
"webpack/counter/components/ajax-select-index.ts",
|
|
||||||
]
|
|
||||||
|
|
||||||
|
|
||||||
class AutoCompleteSelectCounter(CounterAutoCompleteSelectMixin, Select):
|
class AutoCompleteSelectCounter(AutoCompleteSelect):
|
||||||
component_name = "counter-ajax-select"
|
component_name = "counter-ajax-select"
|
||||||
model = Counter
|
model = Counter
|
||||||
schema = SimplifiedCounterSchema
|
schema = SimplifiedCounterSchema
|
||||||
|
js = _js
|
||||||
|
|
||||||
|
|
||||||
class AutoCompleteSelectMultipleCounter(CounterAutoCompleteSelectMixin, SelectMultiple):
|
class AutoCompleteSelectMultipleCounter(AutoCompleteSelectMultiple):
|
||||||
component_name = "counter-ajax-select"
|
component_name = "counter-ajax-select"
|
||||||
model = Counter
|
model = Counter
|
||||||
schema = SimplifiedCounterSchema
|
schema = SimplifiedCounterSchema
|
||||||
|
js = _js
|
||||||
|
|
||||||
|
|
||||||
class AutoCompleteSelectProduct(CounterAutoCompleteSelectMixin, Select):
|
class AutoCompleteSelectProduct(AutoCompleteSelect):
|
||||||
component_name = "product-ajax-select"
|
component_name = "product-ajax-select"
|
||||||
model = Product
|
model = Product
|
||||||
schema = ProductSchema
|
schema = ProductSchema
|
||||||
|
js = _js
|
||||||
|
|
||||||
|
|
||||||
class AutoCompleteSelectMultipleProduct(CounterAutoCompleteSelectMixin, SelectMultiple):
|
class AutoCompleteSelectMultipleProduct(AutoCompleteSelectMultiple):
|
||||||
component_name = "product-ajax-select"
|
component_name = "product-ajax-select"
|
||||||
model = Product
|
model = Product
|
||||||
schema = ProductSchema
|
schema = ProductSchema
|
||||||
|
js = _js
|
||||||
|
@ -1,25 +1,24 @@
|
|||||||
from django.forms import Select, SelectMultiple
|
from core.views.widgets.select import (
|
||||||
|
AutoCompleteSelect,
|
||||||
from core.views.widgets.select import AutoCompleteSelectMixin
|
AutoCompleteSelectMultiple,
|
||||||
|
)
|
||||||
from sas.models import Album
|
from sas.models import Album
|
||||||
from sas.schemas import AlbumSchema
|
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"
|
component_name = "album-ajax-select"
|
||||||
model = Album
|
model = Album
|
||||||
schema = AlbumSchema
|
schema = AlbumSchema
|
||||||
|
|
||||||
js = [
|
js = _js
|
||||||
"webpack/sas/components/ajax-select-index.ts",
|
|
||||||
]
|
|
||||||
|
|
||||||
|
|
||||||
class AutoCompleteSelectMultipleAlbum(AutoCompleteSelectMixin, SelectMultiple):
|
class AutoCompleteSelectMultipleAlbum(AutoCompleteSelectMultiple):
|
||||||
component_name = "album-ajax-select"
|
component_name = "album-ajax-select"
|
||||||
model = Album
|
model = Album
|
||||||
schema = AlbumSchema
|
schema = AlbumSchema
|
||||||
|
|
||||||
js = [
|
js = _js
|
||||||
"webpack/sas/components/ajax-select-index.ts",
|
|
||||||
]
|
|
||||||
|
Loading…
Reference in New Issue
Block a user