From 8a7389064632f5279cea5ece512a81b14113ba33 Mon Sep 17 00:00:00 2001 From: Adarnof Date: Mon, 9 Apr 2018 21:53:41 -0400 Subject: [PATCH] Ensure ticker is fetched if alliance_or_corp used. Closes #1011 --- allianceauth/services/hooks.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/allianceauth/services/hooks.py b/allianceauth/services/hooks.py index 7eae2371..3e564bbe 100644 --- a/allianceauth/services/hooks.py +++ b/allianceauth/services/hooks.py @@ -4,6 +4,7 @@ from django.utils.functional import cached_property from django.core.exceptions import ObjectDoesNotExist from django.conf import settings from string import Formatter +import re from allianceauth.hooks import get_hooks @@ -164,7 +165,7 @@ class NameFormatter: 'username': self.user.username, } - if main_char is not None and 'alliance_ticker' in self.string_formatter: + if main_char is not None and re.match('.*alliance(?:_or_corp)?_ticker', self.string_formatter): # Reduces db lookups try: format_data['alliance_ticker'] = getattr(getattr(main_char, 'alliance', None), 'alliance_ticker', None)