<commit_before># -*- coding: UTF-8 -*-
from django import forms
from django import http
from django import template
from django.conf.urls.defaults import url, patterns
from django.contrib import admin
from django.core import urlresolvers
from django.core.cache import cache
from django.db import transaction
from django.shortcuts import get_object_or_404, redirect, render_to_response
from assopy import models
from assopy.clients import genro

class CountryAdmin(admin.ModelAdmin):
    list_display = ('printable_name', 'vat_company', 'vat_company_verify', 'vat_person')
    list_editable = ('vat_company', 'vat_company_verify', 'vat_person')
    search_fields = ('name', 'printable_name', 'iso', 'numcode')

admin.site.register(models.Country, CountryAdmin)

class OrderItemAdminForm(forms.ModelForm):
    class Meta:
        model = models.OrderItem

    def __init__(self, *args, **kwargs):
        super(OrderItemAdminForm, self).__init__(*args, **kwargs)
        from conference.models import Ticket
        self.fields['ticket'].queryset = Ticket.objects.all().select_related('fare')

class OrderItemInlineAdmin(admin.TabularInline):
    model = models.OrderItem
    form = OrderItemAdminForm

class OrderAdminForm(forms.ModelForm):
    class Meta:
        model = models.Order

    def __init__(self, *args, **kwargs):
        super(OrderAdminForm, self).__init__(*args, **kwargs)
        self.fields['user'].queryset = models.User.objects.all().select_related('user')

class OrderAdmin(admin.ModelAdmin):
    list_display = ('code', '_user', '_created', 'method', '_items', '_complete', '_invoice', '_total_nodiscount', '_discount', '_total_payed',)
    list_select_related = True
    list_filter = ('method',)
    list_per_page = 20
    search_fields = ('code', 'user__user__first_name', 'user__user__last_name', 'user__user__email', 'billing_notes')
    date_hierarchy = 'created'
    actions = ('do_edit_invoices',)

    form = OrderAdminForm

    inlines = (
        OrderItemInlineAdmin,
    )

    def _user(self, o):
        url = urlresolvers.reverse('admin:assopy_user_change', args=(o.user.id,))
        return '<a href="%s">%s</a>' % (url, o.user.name())
    _user.short_description = 'buyer'
    _user.allow_tags = True<commit_msg>ricerca ordini nella ragione sociale<commit_after># -*- coding: UTF-8 -*-
from django import forms
from django import http
from django import template
from django.conf.urls.defaults import url, patterns
from django.contrib import admin
from django.core import urlresolvers
from django.core.cache import cache
from django.db import transaction
from django.shortcuts import get_object_or_404, redirect, render_to_response
from assopy import models
from assopy.clients import genro

class CountryAdmin(admin.ModelAdmin):
    list_display = ('printable_name', 'vat_company', 'vat_company_verify', 'vat_person')
    list_editable = ('vat_company', 'vat_company_verify', 'vat_person')
    search_fields = ('name', 'printable_name', 'iso', 'numcode')

admin.site.register(models.Country, CountryAdmin)

class OrderItemAdminForm(forms.ModelForm):
    class Meta:
        model = models.OrderItem

    def __init__(self, *args, **kwargs):
        super(OrderItemAdminForm, self).__init__(*args, **kwargs)
        from conference.models import Ticket
        self.fields['ticket'].queryset = Ticket.objects.all().select_related('fare')

class OrderItemInlineAdmin(admin.TabularInline):
    model = models.OrderItem
    form = OrderItemAdminForm

class OrderAdminForm(forms.ModelForm):
    class Meta:
        model = models.Order

    def __init__(self, *args, **kwargs):
        super(OrderAdminForm, self).__init__(*args, **kwargs)
        self.fields['user'].queryset = models.User.objects.all().select_related('user')

class OrderAdmin(admin.ModelAdmin):
    list_display = ('code', '_user', '_email', 'card_name', '_created', 'method', '_items', '_complete', '_invoice', '_total_nodiscount', '_discount', '_total_payed',)
    list_select_related = True
    list_filter = ('method',)
    list_per_page = 20
    search_fields = ('code', 'card_name', 'user__user__first_name', 'user__user__last_name', 'user__user__email', 'billing_notes')
    date_hierarchy = 'created'
    actions = ('do_edit_invoices',)

    form = OrderAdminForm

    inlines = (
        OrderItemInlineAdmin,
    )

    def _user(self, o):
        url = urlresolvers.reverse('admin:assopy_user_change', args=(o.user.id,))
        return '<a href="%s">%s</a>' % (url, o.user.name())
    _user.short_description = 'buyer'
    _user.allow_tags = True

    def _email(self, o):
        return '<a href="mailto:%s">%s</a>' % (o.user.user.email, o.user.user.email)
    _email.short_description = 'buyer email'
    _email.allow_tags = True
{'fraction_non_alphanumeric': 0.12889637742207244, 'fraction_numerical': 0.002527379949452401, 'mean_word_length': 4.458620689655173, 'pattern_counts': {'":': 0, '<': 9, '<?xml version=': 0, '>': 9, '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': '2305165', 'n_tokens_mistral': 1494, 'n_tokens_neox': 1460, 'n_words': 331}