<commit_before>from django.utils.translation import ugettext as _
from django.db.models import Count
from django.shortcuts import render_to_response, get_object_or_404
from django.contrib.admin.helpers import AdminForm
from django.views.defaults import RequestContext

from selvbetjening.core.events.models import Event, AttendState,\
     payment_registered_source
from selvbetjening.core.invoice.models import Invoice, Payment

from selvbetjening.sadmin.base import admin_formize
from selvbetjening.sadmin.base.sadmin import SModelAdmin, main_menu
from selvbetjening.sadmin.base.admin import TranslationInline
from selvbetjening.sadmin.base.nav import SPage, LeafSPage

from selvbetjening.sadmin.events.admins.attendee import AttendeeAdmin
from selvbetjening.sadmin.events.admins.optiongroup import OptionGroupAdmin
from selvbetjening.sadmin.events.forms import InvoiceFormattingForm, RegisterPaymentForm

class EventAdmin(SModelAdmin):
    class Meta:
        app_name = 'events'
        name = 'event'
        display_name = 'Event'
        display_name_plural = 'Events'
        model = Event

    def attendees_count(event):
        return event.attendees.count()
    attendees_count.short_description = 'Attendees'
    attendees_count.admin_order_field = 'attend__count'

    list_display = ('title', attendees_count, 'startdate',)
    list_filter = ('registration_open',)
    search_fields = ('title',)

    inlines = [TranslationInline]

    fieldsets = (
        (None, {
            'fields' : ('title', 'description', 'startdate', 'enddate', 'registration_open'),
            }),<commit_msg>Tilføjet link direkte til listen over attendees i sadmin listen over events.<commit_after>from django.utils.translation import ugettext as _
from django.db.models import Count
from django.shortcuts import render_to_response, get_object_or_404
from django.contrib.admin.helpers import AdminForm
from django.views.defaults import RequestContext
from django.core.urlresolvers import reverse

from selvbetjening.core.events.models import Event, AttendState,\
     payment_registered_source
from selvbetjening.core.invoice.models import Invoice, Payment

from selvbetjening.sadmin.base import admin_formize
from selvbetjening.sadmin.base.sadmin import SModelAdmin, main_menu
from selvbetjening.sadmin.base.admin import TranslationInline
from selvbetjening.sadmin.base.nav import SPage, LeafSPage

from selvbetjening.sadmin.events.admins.attendee import AttendeeAdmin
from selvbetjening.sadmin.events.admins.optiongroup import OptionGroupAdmin
from selvbetjening.sadmin.events.forms import InvoiceFormattingForm, RegisterPaymentForm

class EventAdmin(SModelAdmin):
    class Meta:
        app_name = 'events'
        name = 'event'
        display_name = 'Event'
        display_name_plural = 'Events'
        model = Event

    def attendees_count(event):
        return '<a href="%s">%s</a>' % (reverse('sadmin:events_attendee_changelist', args=[event.pk]),
                                        event.attendees.count())
    attendees_count.short_description = 'Attendees'
    attendees_count.admin_order_field = 'attend__count'
    attendees_count.allow_tags = True

    list_display = ('title', attendees_count, 'startdate',)
    list_filter = ('registration_open',)
    search_fields = ('title',)

    inlines = [TranslationInline]

    fieldsets = (
        (None, {
            'fields' : ('title', 'description', 'startdate', 'enddate', 'registration_open'),
            }),
{'fraction_non_alphanumeric': 0.0858948577994829, 'fraction_numerical': 0.0017236426314277506, 'mean_word_length': 4.291793313069909, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 5, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 1, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '5553189', 'n_tokens_mistral': 1059, 'n_tokens_neox': 1022, 'n_words': 229}