<commit_before>from ordinances.models import Ancestor
from django.contrib import admin

class AncestorAdmin(admin.ModelAdmin):
    list_display = ('submitter',
                    'given_name',
                    'surname',
                    'birth_year',
                    'location',
                    'baptism_date',
                    'confirmation_date',
                    'initiatory_date',
                    'endowment_date',
                    'sealing_to_spouse_date',
                    'sealing_to_parents_date')

    fieldsets = [
        (None, {'fields': ['given_name', 'surname', 'birth_year', 'location']}),
        ('Ordinance information', {'fields': ['baptism_date',
                                              'confirmation_date',
                                              'initiatory_date',
                                              'endowment_date',
                                              'sealing_to_spouse_date',
                                              'sealing_to_parents_date']})
    ]

    def save_model(self, request, obj, form, change):
        if getattr(obj, 'submitter', None) is None:
            obj.submitter = request.user
        obj.save()

    def queryset(self, request):
        if request.user.is_superuser:
            return Ancestor.objects.all()
        else:
            return Ancestor.objects.filter(submitter=request.user)

admin.site.register(Ancestor, AncestorAdmin)<commit_msg>Sort admin lists by name<commit_after>from ordinances.models import Ancestor
from django.contrib import admin

class AncestorAdmin(admin.ModelAdmin):
    list_display = ('submitter',
                    'surname',
                    'given_name',
                    'birth_year',
                    'location',
                    'baptism_date',
                    'confirmation_date',
                    'initiatory_date',
                    'endowment_date',
                    'sealing_to_spouse_date',
                    'sealing_to_parents_date')

    fieldsets = [
        (None, {'fields': ['given_name', 'surname', 'birth_year', 'location']}),
        ('Ordinance information', {'fields': ['baptism_date',
                                              'confirmation_date',
                                              'initiatory_date',
                                              'endowment_date',
                                              'sealing_to_spouse_date',
                                              'sealing_to_parents_date']})
    ]

    def save_model(self, request, obj, form, change):
        if getattr(obj, 'submitter', None) is None:
            obj.submitter = request.user
        obj.save()

    def queryset(self, request):
        if request.user.is_superuser:
            return Ancestor.objects.order_by('surname', 'given_name')
        else:
            return Ancestor.objects.filter(submitter=request.user).order_by('surname', 'given_name')

admin.site.register(Ancestor, AncestorAdmin)
{'fraction_non_alphanumeric': 0.09803921568627451, 'fraction_numerical': 0.0, 'mean_word_length': 1.4003189792663477, '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': 20, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '7107388', 'n_tokens_mistral': 779, 'n_tokens_neox': 733, 'n_words': 135}