summaryrefslogtreecommitdiffstats
path: root/news
diff options
context:
space:
mode:
authorDan McGee <dan@archlinux.org>2012-11-01 15:21:54 +0100
committerDan McGee <dan@archlinux.org>2012-11-01 15:21:54 +0100
commit761084f280007e302fc9ae9c738b32fd0490bb70 (patch)
treee2a10c390f4083ccd1e5931ffb75fc07b86fd6d6 /news
parentdf208fb0bd3f8e5783a6e41f411e7aa80179b2b6 (diff)
downloadarchweb-761084f280007e302fc9ae9c738b32fd0490bb70.tar.gz
archweb-761084f280007e302fc9ae9c738b32fd0490bb70.tar.xz
Allow editing news.safe_mode flag via admin screen
We need to mark the property as editable, but you still don't have access to it through the normal non-admin views and edit screen. Signed-off-by: Dan McGee <dan@archlinux.org>
Diffstat (limited to 'news')
-rw-r--r--news/admin.py2
-rw-r--r--news/models.py3
2 files changed, 3 insertions, 2 deletions
diff --git a/news/admin.py b/news/admin.py
index 1b7de1d..ad3cf51 100644
--- a/news/admin.py
+++ b/news/admin.py
@@ -3,7 +3,7 @@ from django.contrib import admin
from .models import News
class NewsAdmin(admin.ModelAdmin):
- list_display = ('title', 'author', 'postdate', 'last_modified')
+ list_display = ('title', 'author', 'postdate', 'last_modified', 'safe_mode')
list_filter = ('postdate', 'author')
search_fields = ('title', 'content')
diff --git a/news/models.py b/news/models.py
index 42adc19..d51db7c 100644
--- a/news/models.py
+++ b/news/models.py
@@ -16,7 +16,7 @@ class News(models.Model):
title = models.CharField(max_length=255)
guid = models.CharField(max_length=255, editable=False)
content = models.TextField()
- safe_mode = models.BooleanField(default=True, editable=False)
+ safe_mode = models.BooleanField(default=True)
def get_absolute_url(self):
return '/news/%s/' % self.slug
@@ -34,6 +34,7 @@ class News(models.Model):
get_latest_by = 'postdate'
ordering = ('-postdate',)
+
def set_news_fields(sender, **kwargs):
news = kwargs['instance']
current_time = now()