~widelands-dev/widelands-website/django_staticfiles

« back to all changes in this revision

Viewing changes to images/admin.py

  • Committer: Holger Rapp
  • Date: 2009-03-01 20:47:48 UTC
  • Revision ID: sirver@kallisto.local-20090301204748-h3ouqkp8zhv10ydq
First (working) commit of wlimages app, the app that will handle image uploading and managing. Uploading works now; images can only be uploaded once (with the same filename). Much stil missing. 

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
 
#!/usr/bin/env python -tt
2
 
# encoding: utf-8
3
 
#
4
 
# File: images/admin.py
5
 
#
6
 
# Created by Holger Rapp on 2009-03-01.
7
 
# Copyright (c) 2009 HolgerRapp@gmx.net. All rights reserved.
8
 
#
9
 
# Last Modified: $Date$
10
 
#
11
 
 
12
 
from django.contrib import admin
13
 
from django.utils.translation import ugettext_lazy as _
14
 
from images.models import Image
15
 
 
16
 
class ImageAdmin(admin.ModelAdmin):
17
 
    fieldsets = (
18
 
        (None, {'fields': ('content_type', 'object_id')}),
19
 
        (_('Content'), {'fields': ('user', 'image', 'revision', 'name')}),
20
 
        (_('Meta'), {'fields': ('date_submitted', 'ip_address')}),
21
 
    )
22
 
    list_display = ('user', 'date_submitted', 'content_type', 'get_content_object', '__unicode__')
23
 
    list_filter = ('date_submitted',)
24
 
    date_hierarchy = 'date_submitted'
25
 
    search_fields = ('image', 'user__username')
26
 
 
27
 
admin.site.register(Image, ImageAdmin)