<commit_before>from django.contrib import admin
from cms_lab_carousel.models import Carousel, Slide

class CarouselAdmin(admin.ModelAdmin):
    fieldset_frame = ('Carousel Frame', {
        'fields': [
            'title',
            'header_image',
            'footer_image',
        ],
    })

    fieldset_visibility = ('Visibility', {
        'fields': [
            'show_title',
            'show_header',
            'show_footer',
        ],
        'classes': ['collapse'],
    })

    fieldset_slides = ('Slide Settings', {
        'fields': [
            'slider_height',
            'slider_duration',
            'slide_limit',
        ],
        'classes': ['collapse'],
    })

    fieldsets = [
        fieldset_frame,
        fieldset_visibility,
        fieldset_slides,
    ]

    search_fields = ['title']

admin.site.register(Carousel, CarouselAdmin)


class CarouselFilter(admin.SimpleListFilter):
    title = 'Carousel'
    parameter_name = 'carousel'

    def lookups(self, request, model_admin):
        carousel_list = set([slide.carousel for slide in model_admin.model.objects.all()])
        return [(carousel.id, carousel.title) for carousel in carousel_list]

    def queryset(self, request, queryset):
        if self.value():
            return queryset.filter(carousel__id__exact=self.value())
        else:
            return queryset


class SlideAdmin(admin.ModelAdmin):

    fieldset_basic = ('Basic Slide Info', {
        'fields': [
            'carousel',
            'title',
            'subtitle',
            'description',
            'image',
            'image_is_downloadable',
        ],
    })

    fieldset_article = ('Scientific Article Info', {
        'fields': [
            'publication',
            'pdf',
            'pubmed_url',
            'article_url',
            'journal_name',
        ],
    })

    fieldset_page_link = ('Page Link', {
        'fields': [
            'page_link',
            'page_link_label',
            'page_link_color',
            'page_link_anchor',
            'page_link_target',
        ],
        'classes': ['collapse'],
    })<commit_msg>Move publication field above tite//subtitle/description in admin<commit_after>from django.contrib import admin
from cms_lab_carousel.models import Carousel, Slide

class CarouselAdmin(admin.ModelAdmin):
    fieldset_frame = ('Carousel Frame', {
        'fields': [
            'title',
            'header_image',
            'footer_image',
        ],
    })

    fieldset_visibility = ('Visibility', {
        'fields': [
            'show_title',
            'show_header',
            'show_footer',
        ],
        'classes': ['collapse'],
    })

    fieldset_slides = ('Slide Settings', {
        'fields': [
            'slider_height',
            'slider_duration',
            'slide_limit',
        ],
        'classes': ['collapse'],
    })

    fieldsets = [
        fieldset_frame,
        fieldset_visibility,
        fieldset_slides,
    ]

    search_fields = ['title']

admin.site.register(Carousel, CarouselAdmin)


class CarouselFilter(admin.SimpleListFilter):
    title = 'Carousel'
    parameter_name = 'carousel'

    def lookups(self, request, model_admin):
        carousel_list = set([slide.carousel for slide in model_admin.model.objects.all()])
        return [(carousel.id, carousel.title) for carousel in carousel_list]

    def queryset(self, request, queryset):
        if self.value():
            return queryset.filter(carousel__id__exact=self.value())
        else:
            return queryset


class SlideAdmin(admin.ModelAdmin):

    fieldset_basic = ('Basic Slide Info', {
        'fields': [
            'carousel',
            'publication',
            'title',
            'subtitle',
            'description',
            'image',
            'image_is_downloadable',
        ],
    })

    fieldset_article = ('Scientific Article Info', {
        'fields': [
            'pdf',
            'pubmed_url',
            'article_url',
            'journal_name',
        ],
    })

    fieldset_page_link = ('Page Link', {
        'fields': [
            'page_link',
            'page_link_label',
            'page_link_color',
            'page_link_anchor',
            'page_link_target',
        ],
        'classes': ['collapse'],
    })
{'fraction_non_alphanumeric': 0.12214269221888709, 'fraction_numerical': 0.0, 'mean_word_length': 1.8537549407114624, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 2, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '1519520', 'n_tokens_mistral': 1249, 'n_tokens_neox': 1226, 'n_words': 228}