From: Radek Czajka Date: Wed, 24 Aug 2011 09:45:23 +0000 (+0200) Subject: readonly type, source_sha1 in media admin X-Git-Url: https://git.mdrn.pl/wolnelektury.git/commitdiff_plain/87d825dfb13275cd763c844afbc29b66c2ac1aa6 readonly type, source_sha1 in media admin --- 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)