mirror of
https://github.com/Findus23/acronomy.git
synced 2024-09-19 15:33:45 +02:00
parent
70953c8419
commit
6db948631b
4 changed files with 28 additions and 6 deletions
|
@ -11,9 +11,15 @@
|
|||
<strong>{{ error.obj }}</strong>:
|
||||
{{ error.msg }}
|
||||
<br>
|
||||
{% if error.obj.get_absolute_url %}
|
||||
<a href="{{ error.obj.get_absolute_url }}" class="alert-link">View</a>
|
||||
{% endif %}
|
||||
{% if error.edit_url %}
|
||||
<a href="{{ error.edit_url }}" class="alert-link">Edit</a>
|
||||
{% endif %}
|
||||
{% if error.admin_edit_url %}
|
||||
<a href="{{ error.admin_edit_url }}" class="alert-link">Admin-Edit</a>
|
||||
{% endif %}
|
||||
</div>
|
||||
{% empty %}
|
||||
<div class="alert alert-success" role="alert">
|
||||
|
|
|
@ -3,3 +3,4 @@ from .check_registry import CheckRegistry, registry
|
|||
from .messages import DEBUG, INFO, WARNING, ERROR, CRITICAL, CheckMessage, CheckWarning, CheckInfo
|
||||
from .checks.acronym import *
|
||||
from .checks.image import *
|
||||
from .checks.tags import *
|
||||
|
|
13
acros/utils/checks/checks/tags.py
Normal file
13
acros/utils/checks/checks/tags.py
Normal file
|
@ -0,0 +1,13 @@
|
|||
from acros.models import Tag
|
||||
from acros.utils.checks import BaseCheck, CheckWarning, registry
|
||||
|
||||
|
||||
class TagsCheck(BaseCheck):
|
||||
def run(self):
|
||||
for tag in Tag.objects.filter(acronyms=None):
|
||||
yield CheckWarning(
|
||||
"Tag is unused",
|
||||
obj=tag)
|
||||
|
||||
|
||||
registry.register(TagsCheck)
|
|
@ -1,6 +1,6 @@
|
|||
from django.urls import reverse
|
||||
|
||||
from acros.models import Acronym
|
||||
from acros.models import Acronym, Tag
|
||||
|
||||
DEBUG = 10
|
||||
INFO = "info"
|
||||
|
@ -30,6 +30,8 @@ class CheckMessage:
|
|||
def admin_edit_url(self):
|
||||
if isinstance(self.obj, Acronym):
|
||||
return reverse("admin:acros_acronym_change", args=[self.obj.id])
|
||||
if isinstance(self.obj, Tag):
|
||||
return reverse("admin:acros_tag_change", args=[self.obj.id])
|
||||
return None
|
||||
|
||||
|
||||
|
|
Loading…
Reference in a new issue