Commit 533b7d94 authored by sberna's avatar sberna

Enhanced admin interface

parent f3bf33d3
......@@ -91,6 +91,7 @@ class LinkInline(TranslationGenericTabularInline):
class MenuItemAdmin(TabbedTranslationAdmin):
list_display = ('description', 'menu', 'priority', 'url')
list_editable = ('priority',)
class CarouselItemAdmin(TabbedTranslationAdmin):
......@@ -147,6 +148,7 @@ class FAQAdmin(TabbedTranslationAdmin):
class OpenDataSectionAdmin(TabbedTranslationAdmin):
list_display = ('slug', 'title', 'group', 'priority', 'highlight')
list_editable = ('priority',)
form = OpenDataSectionAdminForm
def get_readonly_fields(self, request, obj=None):
......@@ -149,6 +149,17 @@ class ClassificazioneQSNAdmin(ClassificazioneAdmin):
class FocusAdmin(TabbedTranslationAdmin):
list_display = ('nome', 'slug', 'num_progetti')
def num_progetti(self, obj):
return obj.num_progetti
num_progetti.short_description = 'numero di progetti'
num_progetti.admin_order_field = 'num_progetti'
def get_queryset(self, request):
from django.db.models import Count
return super().get_queryset(request).annotate(num_progetti=Count('progetti'))
def get_readonly_fields(self, request, obj=None):
if not request.user.is_superuser:
return self.readonly_fields + ('slug',)
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment