From 87d825dfb13275cd763c844afbc29b66c2ac1aa6 Mon Sep 17 00:00:00 2001 From: Radek Czajka Date: Wed, 24 Aug 2011 11:45:23 +0200 Subject: [PATCH 1/1] readonly type, source_sha1 in media admin --- apps/catalogue/admin.py | 1 + apps/catalogue/models.py | 2 +- 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/apps/catalogue/admin.py b/apps/catalogue/admin.py index dda39b51a..32c8f8c71 100644 --- a/apps/catalogue/admin.py +++ b/apps/catalogue/admin.py @@ -21,6 +21,7 @@ class TagAdmin(admin.ModelAdmin): class MediaInline(admin.TabularInline): model = BookMedia + readonly_fields = ['type', 'source_sha1'] extra = 0 diff --git a/apps/catalogue/models.py b/apps/catalogue/models.py index df7a79ece..a0ebf052c 100644 --- a/apps/catalogue/models.py +++ b/apps/catalogue/models.py @@ -182,7 +182,7 @@ def book_upload_path(ext=None, maxlen=100): class BookMedia(models.Model): - type = models.CharField(_('type'), choices=MEDIA_FORMATS, max_length="100") + type = models.CharField(_('type'), choices=MEDIA_FORMATS, max_length="100", editable=False) name = models.CharField(_('name'), max_length="100") file = OverwritingFileField(_('file'), upload_to=book_upload_path()) uploaded_at = models.DateTimeField(_('creation date'), auto_now_add=True, editable=False) -- 2.20.1