summaryrefslogtreecommitdiffstats
path: root/mirrors
diff options
context:
space:
mode:
authorDan McGee <dan@archlinux.org>2014-05-31 22:30:13 +0200
committerDan McGee <dan@archlinux.org>2014-05-31 22:30:18 +0200
commitd3a36903d0fb738e3a916169fb109072efbff721 (patch)
tree8a113e83096895d6bd62fff3631386df1a9f8826 /mirrors
parentbe4b9dc36338b57ad8b78491ef31cb91fbde9335 (diff)
downloadarchweb-d3a36903d0fb738e3a916169fb109072efbff721.tar.gz
archweb-d3a36903d0fb738e3a916169fb109072efbff721.tar.xz
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 <dan@archlinux.org>
Diffstat (limited to 'mirrors')
-rw-r--r--mirrors/admin.py8
1 files changed, 8 insertions, 0 deletions
diff --git a/mirrors/admin.py b/mirrors/admin.py
index d958e21..d5c89c2 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')