From 945337177d35a5c038e29b6594e1251f26d42156 Mon Sep 17 00:00:00 2001 From: Dan McGee Date: Sat, 29 Mar 2014 11:56:29 -0500 Subject: Add last_modified column to mirrors This will make it easier in the future to clear out inactive mirrors that haven't been touched in a while. Signed-off-by: Dan McGee --- mirrors/admin.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'mirrors/admin.py') diff --git a/mirrors/admin.py b/mirrors/admin.py index 17365486..d958e21b 100644 --- a/mirrors/admin.py +++ b/mirrors/admin.py @@ -67,7 +67,7 @@ class MirrorAdmin(admin.ModelAdmin): 'isos', 'admin_email', 'alternate_email') list_filter = ('tier', 'active', 'public') search_fields = ('name', 'admin_email', 'alternate_email') - readonly_fields = ('created',) + readonly_fields = ('created', 'last_modified') inlines = [ MirrorUrlInlineAdmin, MirrorRsyncInlineAdmin, -- cgit v1.2.3-2-g168b From d3a36903d0fb738e3a916169fb109072efbff721 Mon Sep 17 00:00:00 2001 From: Dan McGee Date: Sat, 31 May 2014 15:30:13 -0500 Subject: Convert ~~~ to date/username text when editing mirror notes Requested by Florian to make leaving notes on mirrors a bit easier. Signed-off-by: Dan McGee --- mirrors/admin.py | 8 ++++++++ 1 file changed, 8 insertions(+) (limited to 'mirrors/admin.py') diff --git a/mirrors/admin.py b/mirrors/admin.py index d958e21b..d5c89c2a 100644 --- a/mirrors/admin.py +++ b/mirrors/admin.py @@ -1,3 +1,4 @@ +from datetime import datetime from urlparse import urlparse, urlunsplit from django import forms @@ -73,6 +74,13 @@ class MirrorAdmin(admin.ModelAdmin): MirrorRsyncInlineAdmin, ] + def save_model(self, request, obj, form, change): + if '~~~' in obj.notes: + date = datetime.utcnow().strftime('%Y-%m-%d') + usertext = request.user.get_full_name() + obj.notes = obj.notes.replace('~~~', '%s (%s)' % (date, usertext)) + obj.save() + class MirrorProtocolAdmin(admin.ModelAdmin): list_display = ('protocol', 'is_download', 'default') -- cgit v1.2.3-2-g168b