~widelands-dev/widelands-website/trunk

« back to all changes in this revision

Viewing changes to check_input/admin.py

  • Committer: Holger Rapp
  • Date: 2019-06-21 18:34:42 UTC
  • mfrom: (540.1.3 update_ops_script)
  • Revision ID: sirver@gmx.de-20190621183442-y2ulybzr0rdvfefd
Adapt the update script for the new server.

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)