# HG changeset patch # User neko259 # Date 2015-10-29 16:29:59 # Node ID c9a1cd47c75d7c6cef3e767654af6a2173821aaf # Parent 674f43a12bd850b96d652fbf0ce6856b05ea2f09 Made some fields in post admin read-only. Show attachment as its url diff --git a/boards/admin.py b/boards/admin.py --- a/boards/admin.py +++ b/boards/admin.py @@ -10,7 +10,8 @@ class PostAdmin(admin.ModelAdmin): list_filter = ('pub_time',) search_fields = ('id', 'title', 'text', 'poster_ip') exclude = ('referenced_posts', 'refmap') - readonly_fields = ('poster_ip', 'threads', 'thread', 'images', 'uid') + readonly_fields = ('poster_ip', 'threads', 'thread', 'images', + 'attachments', 'uid', 'url', 'pub_time', 'opening') def ban_poster(self, request, queryset): bans = 0 diff --git a/boards/models/attachment/__init__.py b/boards/models/attachment/__init__.py --- a/boards/models/attachment/__init__.py +++ b/boards/models/attachment/__init__.py @@ -38,4 +38,5 @@ class Attachment(models.Model): return file_viewer(self.file, self.mimetype).get_view() - + def __str__(self): + return self.file.url