<commit_before># -*- coding: UTF-8 -*-
from django.contrib import admin
from conference.admin import TicketAdmin
from conference.models import Ticket
from p3 import models

class TicketConferenceAdmin(TicketAdmin):
    list_display = TicketAdmin.list_display + ('_order', '_assigned',)
    
    def _order(self, o):
        return o.orderitem.order.code

    def _assigned(self, o):
        try:
            return o.p3_conference.assigned_to
        except models.TicketConference.DoesNotExist:
            return ''

admin.site.unregister(Ticket)
admin.site.register(Ticket, TicketConferenceAdmin)
<commit_msg>queryset custom per ridurre numero query<commit_after># -*- coding: UTF-8 -*-
from django.contrib import admin
from conference.admin import TicketAdmin
from conference.models import Ticket
from p3 import models

class TicketConferenceAdmin(TicketAdmin):
    list_display = TicketAdmin.list_display + ('_order', '_assigned',)
    
    def _order(self, o):
        return o.orderitem.order.code

    def _assigned(self, o):
        try:
            return o.p3_conference.assigned_to
        except models.TicketConference.DoesNotExist:
            return ''

    def queryset(self, request):
        qs = super(TicketConferenceAdmin, self).queryset(request)
        qs = qs.select_related('orderitem__order', 'p3_conference', 'user',)
        return qs

admin.site.unregister(Ticket)
admin.site.register(Ticket, TicketConferenceAdmin)

{'fraction_non_alphanumeric': 0.0954356846473029, 'fraction_numerical': 0.004840940525587829, 'mean_word_length': 3.5077881619937696, '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': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '6662997', 'n_tokens_mistral': 441, 'n_tokens_neox': 436, 'n_words': 101}