Skip to content

Commit 4635c1c

Browse files
committed
Move helpers for the admin on IdSubmissionDetail to admin.py
- Legacy-Id: 6657
1 parent b46f0ba commit 4635c1c

2 files changed

Lines changed: 9 additions & 9 deletions

File tree

ietf/submit/admin.py

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,7 @@
11
from django.core.urlresolvers import reverse as urlreverse
22
from django.contrib import admin
3+
from django.utils.safestring import mark_safe
4+
35
from ietf.submit.models import *
46

57
class IdSubmissionStatusAdmin(admin.ModelAdmin):
@@ -19,6 +21,13 @@ def status_link(self, instance):
1921
return '<a href="%s">%s</a>' % (url, instance.status)
2022
status_link.allow_tags = True
2123

24+
def draft_link(self, instance):
25+
if instance.status_id in (-1, -2):
26+
return '<a href="http://www.ietf.org/id/%s-%s.txt">%s</a>' % (instance.filename, instance.revision, instance.filename)
27+
else:
28+
return instance.filename
29+
draft_link.allow_tags = True
30+
2231
admin.site.register(IdSubmissionDetail, IdSubmissionDetailAdmin)
2332

2433
class PreapprovalAdmin(admin.ModelAdmin):

ietf/submit/models.py

Lines changed: 0 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -57,15 +57,6 @@ def get_hash(self):
5757
self.create_hash()
5858
self.save()
5959
return self.submission_hash
60-
def draft_link(self):
61-
if self.status_id == -1:
62-
return '<a href="http://www.ietf.org/id/%s-%s.txt">%s</a>' % (self.filename, self.revision, self.filename)
63-
else:
64-
return self.filename
65-
draft_link.allow_tags = True
66-
def status_link(self):
67-
return '<a href="http://datatracker.ietf.org/submit/status/%s/%s/">%s</a>' % (self.submission_id, self.submission_hash, self.status)
68-
status_link.allow_tags = True
6960

7061
def create_submission_hash(sender, instance, **kwargs):
7162
instance.create_hash()

0 commit comments

Comments
 (0)