# HG changeset patch # User neko259 # Date 2016-10-17 08:51:16 # Node ID a45f98f45b8d4beff3856993dd92d162ae5655f1 # Parent ccb8591c14c6c5b0cae4c04410b6d4c900eb2884 Do not show IP colored lines and feed selectors when there is no saved IP diff --git a/boards/models/post/__init__.py b/boards/models/post/__init__.py --- a/boards/models/post/__init__.py +++ b/boards/models/post/__init__.py @@ -8,7 +8,7 @@ from boards.models import Attachment, Ke from boards.models.attachment import FILE_TYPES_IMAGE from boards.models.base import Viewable from boards.models.post.export import get_exporter, DIFF_TYPE_JSON -from boards.models.post.manager import PostManager +from boards.models.post.manager import PostManager, NO_IP from boards.utils import datetime_to_epoch from django.core.exceptions import ObjectDoesNotExist from django.core.urlresolvers import reverse @@ -403,3 +403,7 @@ class Post(models.Model, Viewable): def get_ip_color(self): return hashlib.md5(self.poster_ip.encode()).hexdigest()[:6] + + def has_ip(self): + return self.poster_ip != NO_IP + diff --git a/boards/templates/boards/post.html b/boards/templates/boards/post.html --- a/boards/templates/boards/post.html +++ b/boards/templates/boards/post.html @@ -7,7 +7,7 @@
#{{ post.id }} {{ post.title }} - {% if perms.boards.change_post %} + {% if perms.boards.change_post and post.has_ip %} * {% else %}