Skip to content

Commit

Permalink
Merge pull request #673 from EsupPortail/develop
Browse files Browse the repository at this point in the history
Develop
  • Loading branch information
ptitloup authored Sep 22, 2022
2 parents c3e6f0c + 998d395 commit d15c1d8
Show file tree
Hide file tree
Showing 2 changed files with 49 additions and 6 deletions.
4 changes: 2 additions & 2 deletions pod/meeting/admin.py
Original file line number Diff line number Diff line change
Expand Up @@ -24,12 +24,12 @@ class Meta(object):
admin.site,
attrs={"style": "width: 20em"},
),
"additional_owners": widgets.AutocompleteSelect(
"additional_owners": widgets.AutocompleteSelectMultiple(
Meeting._meta.get_field("additional_owners"),
admin.site,
attrs={"style": "width: 20em"},
),
"restrict_access_to_groups": widgets.AutocompleteSelect(
"restrict_access_to_groups": widgets.AutocompleteSelectMultiple(
Meeting._meta.get_field("restrict_access_to_groups"),
admin.site,
attrs={"style": "width: 20em"},
Expand Down
51 changes: 47 additions & 4 deletions pod/video/admin.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
"""Admin pages for Esup-Pod Video items."""
from django.conf import settings
from django.contrib import admin
from django.contrib.admin import widgets
from django.contrib.auth.models import User
from django.urls import reverse
from django.utils.html import format_html
Expand Down Expand Up @@ -315,15 +316,57 @@ class ChannelSuperAdminForm(ChannelForm):
is_superuser = True
admin_form = True

class Meta(object):
model = Channel
fields = "__all__"
widgets = {
"owners": widgets.AutocompleteSelectMultiple(
Channel._meta.get_field("owners"),
admin.site,
attrs={"style": "width: 20em"},
),
"users": widgets.AutocompleteSelectMultiple(
Channel._meta.get_field("users"),
admin.site,
attrs={"style": "width: 20em"},
),
"allow_to_groups": widgets.AutocompleteSelectMultiple(
Channel._meta.get_field("allow_to_groups"),
admin.site,
attrs={"style": "width: 20em"},
),
}


class ChannelAdminForm(ChannelForm):
is_staff = True
is_superuser = False
admin_form = True

class Meta(object):
model = Channel
fields = "__all__"
widgets = {
"owners": widgets.AutocompleteSelectMultiple(
Channel._meta.get_field("owners"),
admin.site,
attrs={"style": "width: 20em"},
),
"users": widgets.AutocompleteSelectMultiple(
Channel._meta.get_field("users"),
admin.site,
attrs={"style": "width: 20em"},
),
"allow_to_groups": widgets.AutocompleteSelectMultiple(
Channel._meta.get_field("allow_to_groups"),
admin.site,
attrs={"style": "width: 20em"},
),
}


class ChannelAdmin(admin.ModelAdmin):
search_fields = ["name"]
search_fields = ["title"]

def get_owners(self, obj):
owners = []
Expand Down Expand Up @@ -397,7 +440,7 @@ class ThemeAdmin(admin.ModelAdmin):
list_display = ("title", "channel")
list_filter = (("channel", admin.RelatedOnlyFieldListFilter),)
ordering = ("channel", "title")
search_fields = ["name"]
search_fields = ["title"]
autocomplete_fields = ["parentId", "channel"]

class Media:
Expand Down Expand Up @@ -434,7 +477,7 @@ def formfield_for_foreignkey(self, db_field, request, **kwargs):
class TypeAdmin(TranslationAdmin):
form = TypeForm
prepopulated_fields = {"slug": ("title",)}
search_fields = ["name"]
search_fields = ["title"]

class Media:
css = {
Expand Down Expand Up @@ -474,7 +517,7 @@ def get_queryset(self, request):
class DisciplineAdmin(TranslationAdmin):
form = DisciplineForm
prepopulated_fields = {"slug": ("title",)}
search_fields = ["name"]
search_fields = ["title"]

class Media:
css = {
Expand Down

0 comments on commit d15c1d8

Please sign in to comment.