<commit_before>from django.contrib import admin
from django.utils.translation import ugettext_lazy as _

from polymorphic.admin import PolymorphicParentModelAdmin, PolymorphicChildModelAdmin
from sorl.thumbnail.admin.compat import AdminImageMixin


from bluebottle.utils.utils import set_author_editor_ip


from bluebottle.wallposts.models import SystemWallpost
from .models import Wallpost, MediaWallpost, TextWallpost, MediaWallpostPhoto, Reaction


class MediaWallpostPhotoInline(AdminImageMixin, admin.StackedInline):
    model = MediaWallpostPhoto
    extra = 0
    raw_id_fields = ('author', 'editor')


class MediaWallpostAdmin(PolymorphicChildModelAdmin):
    base_model = Wallpost
    readonly_fields = ('ip_address', 'deleted')
    raw_id_fields = ('author', 'editor')
    list_display = ('created', 'view_online', 'get_text', 'video_url', 'photos', 'author')

    readonly_fields = ('view_online', )

    ordering = ('-created', )
    inlines = (MediaWallpostPhotoInline,)

    def get_text(self, obj):
        if len(obj.text) > 150:
            return u'<span title="{text}">{short_text} [...]</span>'.format(text=obj.text, short_text=obj.text[:145])
    get_text.allow_tags = True

    def photos(self, obj):
        photos = MediaWallpostPhoto.objects.filter(mediawallpost=obj)
        if len(photos):
            return len(photos)
        return '-'

    def view_online(self, obj):
        if obj.content_type.name == 'project':
            return u'<a href="/go/projects/{slug}">{title}</a>'.format(slug=obj.content_object.slug, title=obj.content_object.title)
        if obj.content_type.name == 'task':
            return u'<a href="/go/projects/{slug}/tasks/{task_id}">{title}</a>'.format(slug=obj.content_object.project.slug, task_id=obj.content_object.id, title=obj.content_object.project.title)
        if obj.content_type.name == 'fundraiser':<commit_msg>remove files<commit_after>from django.contrib import admin
from django.utils.translation import ugettext_lazy as _

from polymorphic.admin import PolymorphicParentModelAdmin, PolymorphicChildModelAdmin
from sorl.thumbnail.admin.compat import AdminImageMixin


from bluebottle.utils.utils import set_author_editor_ip


from bluebottle.wallposts.models import SystemWallpost
from .models import Wallpost, MediaWallpost, TextWallpost, MediaWallpostPhoto, Reaction


class MediaWallpostPhotoInline(AdminImageMixin, admin.StackedInline):
    model = MediaWallpostPhoto
    extra = 0
    raw_id_fields = ('author', 'editor')


class MediaWallpostAdmin(PolymorphicChildModelAdmin):
    base_model = Wallpost
    readonly_fields = ('ip_address', 'deleted')
    raw_id_fields = ('author', 'editor')
    list_display = ('created', 'view_online', 'get_text', 'video_url', 'photos', 'author')

    readonly_fields = ('view_online', )

    ordering = ('-created', )
    inlines = (MediaWallpostPhotoInline,)

    def get_text(self, obj):
        if len(obj.text) > 150:
            return u'<span title="{text}">{short_text} [...]</span>'.format(text=obj.text, short_text=obj.text[:145])
    get_text.allow_tags = True

    def photos(self, obj):
        photos = MediaWallpostPhoto.objects.filter(mediawallpost=obj)
        if len(photos):
            return len(photos)
        return '-'

    def view_online(self, obj):
        if obj.content_object is None:
            return _(u'The project this post belongs to has been deleted')

        if obj.content_type.name == 'project':
            return u'<a href="/go/projects/{slug}">{title}</a>'.format(slug=obj.content_object.slug, title=obj.content_object.title)
        if obj.content_type.name == 'task':
            return u'<a href="/go/projects/{slug}/tasks/{task_id}">{title}</a>'.format(slug=obj.content_object.project.slug, task_id=obj.content_object.id, title=obj.content_object.project.title)
        if obj.content_type.name == 'fundraiser':
{'fraction_non_alphanumeric': 0.12538699690402477, 'fraction_numerical': 0.003611971104231166, 'mean_word_length': 4.114775725593668, 'pattern_counts': {'":': 0, '<': 15, '<?xml version=': 0, '>': 17, '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': '3601024', 'n_tokens_mistral': 1224, 'n_tokens_neox': 1186, 'n_words': 236}