Beispiel #1
0
 def admin_action(self, obj):
     if not self.REPLY_ENABLED:
         s = ""
     elif obj.replied_at:
         s = '<a class="button" href="{}?parent_msg_id={}">查看</a>'.format(model_admin_url(models.Feedback), obj.pk)
     else:
         s = '<a class="button" href="{}?parent_msg_id={}">回复</a>'.format(
             model_admin_url(models.Feedback, "add"), obj.pk
         )
     return mark_safe(s)
Beispiel #2
0
 def user_link(self, obj):
     url = model_admin_url(obj.user)
     return mark_safe('<a href="{}" target="_blank">{}</a>'.format(url, obj.user))
Beispiel #3
0
 def target_link(self, obj):
     model = models.Purifies.get_for(id=obj.target_type_id).model
     name = '[{}]{}'.format(model._meta.verbose_name, str(obj.target))
     url = model_admin_url(obj.target, model_class=model)
     s = '<a href="{}" target="_blank">{}</a>'.format(url, name)
     return mark_safe(s)