~widelands-dev/widelands-website/django_staticfiles

« back to all changes in this revision

Viewing changes to check_input/admin.py

  • Committer: franku
  • Date: 2017-11-30 15:53:56 UTC
  • mfrom: (476.1.12 spam_fight)
  • Revision ID: somal@arcor.de-20171130155356-gcx9f8krnkvf6v0y
mergedĀ theĀ anti_spam_app

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
from check_input.models import SuspiciousInput
 
2
from django.contrib import admin
 
3
from django.contrib.contenttypes.models import ContentType
 
4
 
 
5
 
 
6
class SuspiciousInputAdmin(admin.ModelAdmin):
 
7
    list_display = ('text', 'user', 'get_app')
 
8
    readonly_fields = ('text', 'user', 'get_app',)
 
9
    exclude = ('content_type', 'object_id', )
 
10
    
 
11
    def get_app(self, obj):
 
12
        app = ContentType.objects.get_for_id(
 
13
            obj.content_type_id)
 
14
 
 
15
        return '%s/%s' % (app.app_label, app.name)
 
16
    get_app.short_description = 'Found in App/Model'
 
17
 
 
18
admin.site.register(SuspiciousInput, SuspiciousInputAdmin)