Compare commits

...

9 Commits

Author SHA1 Message Date
Peter Pfeufer
223e648a23 Merge branch 'menu-separator' into 'master'
[ADD] Menu separator

See merge request allianceauth/allianceauth!1712
2025-04-29 02:47:22 +00:00
Ariel Rin
afde1f4729 Merge branch 'typehint-object-managers' into 'master'
Typehint object managers

See merge request allianceauth/allianceauth!1713
2025-04-29 02:47:12 +00:00
Ariel Rin
5c6dda0eac Typehint object managers 2025-04-29 02:47:11 +00:00
Ariel Rin
af453bc772 Merge branch 'aa_i18n-addition' into 'master'
[ADD] Temaplatetag for path relative to `static`

See merge request allianceauth/allianceauth!1714
2025-04-29 02:46:56 +00:00
Ariel Rin
e13674e886 Merge branch 'translatable-app-names' into 'master'
[CHANGE] Made app names translatable in Django admin

See merge request allianceauth/allianceauth!1715
2025-04-29 02:45:48 +00:00
Ariel Rin
e3e856b826 Merge branch 'admin-overview' into 'master'
Remove unused {% if %} tag

See merge request allianceauth/allianceauth!1718
2025-04-29 02:42:35 +00:00
T'rahk Rokym
9d1cd23a8f Remove unused {% if %} tag 2025-04-21 16:50:04 +02:00
Peter Pfeufer
148f7c116f
[CHANGE] Made app names translatable in Django admin 2025-04-10 07:08:16 +02:00
Peter Pfeufer
33e7134d6f
[ADD] Temaplatetag for path relative to static
AA-GDPR needs this
2025-04-09 20:54:51 +02:00
39 changed files with 124 additions and 25 deletions

View File

@ -1,6 +1,8 @@
from django.apps import AppConfig
from django.utils.translation import gettext_lazy as _
class AnalyticsConfig(AppConfig):
name = 'allianceauth.analytics'
label = 'analytics'
verbose_name = _('Analytics')

View File

@ -1,10 +1,12 @@
from django.apps import AppConfig
from django.core.checks import register, Tags
from django.utils.translation import gettext_lazy as _
class AuthenticationConfig(AppConfig):
name = "allianceauth.authentication"
label = "authentication"
verbose_name = _("Authentication")
def ready(self):
from allianceauth.authentication import checks, signals # noqa: F401

View File

@ -1,4 +1,5 @@
import logging
from typing import ClassVar
from django.contrib.auth.models import User, Permission
from django.db import models, transaction
@ -27,7 +28,7 @@ class State(models.Model):
help_text="Factions to whose members this state is available.")
public = models.BooleanField(default=False, help_text="Make this state available to any character.")
objects = StateManager()
objects: ClassVar[StateManager] = StateManager()
class Meta:
ordering = ['-priority']
@ -137,8 +138,10 @@ class UserProfile(models.Model):
sender=self.__class__, user=self.user, state=self.state
)
def __str__(self):
def __str__(self) -> str:
return str(self.user)
class CharacterOwnership(models.Model):
class Meta:
default_permissions = ('change', 'delete')
@ -148,7 +151,7 @@ class CharacterOwnership(models.Model):
owner_hash = models.CharField(max_length=28, unique=True)
user = models.ForeignKey(User, on_delete=models.CASCADE, related_name='character_ownerships')
objects = CharacterOwnershipManager()
objects: ClassVar[CharacterOwnershipManager] = CharacterOwnershipManager()
def __str__(self):
return f"{self.user}: {self.character}"

View File

@ -1,6 +1,8 @@
from django.apps import AppConfig
from django.utils.translation import gettext_lazy as _
class CorpUtilsConfig(AppConfig):
name = 'allianceauth.corputils'
label = 'corputils'
verbose_name = _('Corporation Stats')

View File

@ -1,5 +1,6 @@
import logging
import os
from typing import ClassVar
from allianceauth.authentication.models import CharacterOwnership, UserProfile
from bravado.exception import HTTPForbidden
@ -40,9 +41,9 @@ class CorpStats(models.Model):
verbose_name = "corp stats"
verbose_name_plural = "corp stats"
objects = CorpStatsManager()
objects: ClassVar[CorpStatsManager] = CorpStatsManager()
def __str__(self):
def __str__(self) -> str:
return f"{self.__class__.__name__} for {self.corp}"
def update(self):

View File

@ -3,6 +3,7 @@ Crontab App Config
"""
from django.apps import AppConfig
from django.utils.translation import gettext_lazy as _
class CrontabConfig(AppConfig):
@ -12,3 +13,4 @@ class CrontabConfig(AppConfig):
name = "allianceauth.crontab"
label = "crontab"
verbose_name = _("Crontab")

View File

@ -1,6 +1,8 @@
from django.apps import AppConfig
from django.utils.translation import gettext_lazy as _
class EveonlineConfig(AppConfig):
name = 'allianceauth.eveonline'
label = 'eveonline'
verbose_name = _('EVE Online')

View File

@ -1,9 +1,11 @@
from django.apps import AppConfig
from django.utils.translation import gettext_lazy as _
class EveAutogroupsConfig(AppConfig):
name = 'allianceauth.eveonline.autogroups'
label = 'eve_autogroups'
verbose_name = _('EVE Online Autogroups')
def ready(self):
import allianceauth.eveonline.autogroups.signals

View File

@ -1,4 +1,5 @@
import logging
from typing import ClassVar
from django.db import models, transaction
from django.contrib.auth.models import Group, User
from django.core.exceptions import ObjectDoesNotExist
@ -78,7 +79,7 @@ class AutogroupsConfig(models.Model):
max_length=10, default='', blank=True,
help_text='Any spaces in the group name will be replaced with this.')
objects = AutogroupsConfigManager()
objects: ClassVar[AutogroupsConfigManager] = AutogroupsConfigManager()
def __init__(self, *args, **kwargs):
super().__init__(*args, **kwargs)

View File

@ -14,10 +14,10 @@ class EveCharacterProviderManager:
class EveCharacterManager(models.Manager):
provider = EveCharacterProviderManager()
def create_character(self, character_id):
def create_character(self, character_id) -> models.Model:
return self.create_character_obj(self.provider.get_character(character_id))
def create_character_obj(self, character: providers.Character):
def create_character_obj(self, character: providers.Character) -> models.Model:
return self.create(
character_id=character.id,
character_name=character.name,

View File

@ -1,5 +1,5 @@
import logging
from typing import Union
from typing import ClassVar, Union
from django.core.exceptions import ObjectDoesNotExist
from django.db import models
@ -75,8 +75,8 @@ class EveAllianceInfo(models.Model):
alliance_ticker = models.CharField(max_length=254)
executor_corp_id = models.PositiveIntegerField()
objects = EveAllianceManager()
provider = EveAllianceProviderManager()
objects: ClassVar[EveAllianceManager] = EveAllianceManager()
provider: ClassVar[EveAllianceProviderManager] = EveAllianceProviderManager()
class Meta:
indexes = [models.Index(fields=['executor_corp_id',])]
@ -147,7 +147,7 @@ class EveCorporationInfo(models.Model):
EveAllianceInfo, blank=True, null=True, on_delete=models.SET_NULL
)
objects = EveCorporationManager()
objects: ClassVar[EveCorporationManager] = EveCorporationManager()
provider = EveCorporationProviderManager()
class Meta:
@ -214,7 +214,7 @@ class EveCharacter(models.Model):
faction_id = models.PositiveIntegerField(blank=True, null=True, default=None)
faction_name = models.CharField(max_length=254, blank=True, null=True, default='')
objects = EveCharacterManager()
objects: ClassVar[EveCharacterManager] = EveCharacterManager()
provider = EveCharacterProviderManager()
class Meta:

View File

@ -1,6 +1,8 @@
from django.apps import AppConfig
from django.utils.translation import gettext_lazy as _
class FatConfig(AppConfig):
name = 'allianceauth.fleetactivitytracking'
label = 'fleetactivitytracking'
verbose_name = _('Fleet Activity Tracking')

View File

@ -3,6 +3,7 @@ Framework App Config
"""
from django.apps import AppConfig
from django.utils.translation import gettext_lazy as _
class FrameworkConfig(AppConfig):
@ -12,3 +13,4 @@ class FrameworkConfig(AppConfig):
name = "allianceauth.framework"
label = "framework"
verbose_name = _("Framework")

View File

@ -1,10 +1,11 @@
from django.apps import AppConfig
from django.utils.translation import gettext_lazy as _
class GroupManagementConfig(AppConfig):
name = 'allianceauth.groupmanagement'
label = 'groupmanagement'
verbose_name = 'Group Management'
verbose_name = _('Group Management')
def ready(self):
from . import signals # noqa: F401

View File

@ -1,6 +1,8 @@
from django.apps import AppConfig
from django.utils.translation import gettext_lazy as _
class HRApplicationsConfig(AppConfig):
name = 'allianceauth.hrapplications'
label = 'hrapplications'
verbose_name = _('HR Applications')

View File

@ -1,3 +1,4 @@
from typing import ClassVar
from django.contrib.auth.models import User
from django.db import models
from sortedm2m.fields import SortedManyToManyField
@ -40,7 +41,7 @@ class Application(models.Model):
reviewer_character = models.ForeignKey(EveCharacter, on_delete=models.SET_NULL, blank=True, null=True)
created = models.DateTimeField(auto_now_add=True)
objects = ApplicationManager()
objects: ClassVar[ApplicationManager] = ApplicationManager()
def __str__(self):
return str(self.user) + " Application To " + str(self.form)

View File

@ -1,6 +1,7 @@
import logging
from django.apps import AppConfig
from django.utils.translation import gettext_lazy as _
logger = logging.getLogger(__name__)
@ -12,6 +13,7 @@ logger = logging.getLogger(__name__)
class MenuConfig(AppConfig):
name = "allianceauth.menu"
label = "menu"
verbose_name = _("Menu")
def ready(self):
from allianceauth.menu.core import smart_sync

View File

@ -1,3 +1,4 @@
from typing import ClassVar
from django.db import models
from django.utils.translation import gettext_lazy as _
@ -68,7 +69,7 @@ class MenuItem(models.Model):
help_text=_("External URL this menu items will link to"),
)
objects = MenuItemManager()
objects: ClassVar[MenuItemManager] = MenuItemManager()
def __str__(self) -> str:
return self.text

View File

@ -1,6 +1,8 @@
from django.apps import AppConfig
from django.utils.translation import gettext_lazy as _
class NotificationsConfig(AppConfig):
name = 'allianceauth.notifications'
label = 'notifications'
verbose_name = _('Notifications')

View File

@ -1,4 +1,5 @@
import logging
from typing import ClassVar
from django.db import models
from django.contrib.auth.models import User
@ -56,7 +57,7 @@ class Notification(models.Model):
timestamp = models.DateTimeField(auto_now_add=True, db_index=True)
viewed = models.BooleanField(default=False, db_index=True)
objects = NotificationManager()
objects: ClassVar[NotificationManager] = NotificationManager()
def __str__(self) -> str:
return f"{self.user}: {self.title}"

View File

@ -1,6 +1,8 @@
from django.apps import AppConfig
from django.utils.translation import gettext_lazy as _
class OptimerConfig(AppConfig):
name = 'allianceauth.optimer'
label = 'optimer'
verbose_name = _('Fleet Operations')

View File

@ -1,6 +1,8 @@
from django.apps import AppConfig
from django.utils.translation import gettext_lazy as _
class PermissionsToolConfig(AppConfig):
name = 'allianceauth.permissions_tool'
label = 'permissions_tool'
verbose_name = _('Permissions Audit')

View File

@ -1,9 +1,11 @@
from django.apps import AppConfig
from django.utils.translation import gettext_lazy as _
class ServicesConfig(AppConfig):
name = 'allianceauth.services'
label = 'services'
verbose_name = _('Services')
def ready(self):
from . import signals

View File

@ -1,6 +1,8 @@
from django.apps import AppConfig
from django.utils.translation import gettext_lazy as _
class DiscordServiceConfig(AppConfig):
name = 'allianceauth.services.modules.discord'
label = 'discord'
verbose_name = _('Discord Service')

View File

@ -1,5 +1,5 @@
import logging
from typing import Optional
from typing import ClassVar, Optional
from requests.exceptions import HTTPError
@ -59,7 +59,7 @@ class DiscordUser(models.Model):
help_text='Date & time this service account was activated'
)
objects = DiscordUserManager()
objects: ClassVar[DiscordUserManager] = DiscordUserManager()
class Meta:
permissions = (

View File

@ -1,6 +1,8 @@
from django.apps import AppConfig
from django.utils.translation import gettext_lazy as _
class DiscourseServiceConfig(AppConfig):
name = 'allianceauth.services.modules.discourse'
label = 'discourse'
verbose_name = _('Discourse Service')

View File

@ -1,6 +1,8 @@
from django.apps import AppConfig
from django.utils.translation import gettext_lazy as _
class ExampleServiceConfig(AppConfig):
name = 'allianceauth.services.modules.example'
label = 'example_service'
verbose_name = _('Example Service')

View File

@ -1,6 +1,8 @@
from django.apps import AppConfig
from django.utils.translation import gettext_lazy as _
class Ips4ServiceConfig(AppConfig):
name = 'allianceauth.services.modules.ips4'
label = 'ips4'
verbose_name = _('IPS4 Service')

View File

@ -1,6 +1,8 @@
from django.apps import AppConfig
from django.utils.translation import gettext_lazy as _
class MumbleServiceConfig(AppConfig):
name = 'allianceauth.services.modules.mumble'
label = 'mumble'
verbose_name = _('Mumble Service')

View File

@ -1,5 +1,6 @@
import random
import string
from typing import ClassVar
from passlib.hash import bcrypt_sha256
from django.db import models
@ -116,7 +117,7 @@ class MumbleUser(AbstractServiceModel):
help_text="Timestamp of the users Last Disconnection to Mumble"
)
objects = MumbleManager()
objects: ClassVar[MumbleManager] = MumbleManager()
def __str__(self):
return self.username

View File

@ -1,6 +1,8 @@
from django.apps import AppConfig
from django.utils.translation import gettext_lazy as _
class OpenfireServiceConfig(AppConfig):
name = 'allianceauth.services.modules.openfire'
label = 'openfire'
verbose_name = _('Openfire Service')

View File

@ -1,6 +1,8 @@
from django.apps import AppConfig
from django.utils.translation import gettext_lazy as _
class Phpbb3ServiceConfig(AppConfig):
name = 'allianceauth.services.modules.phpbb3'
label = 'phpbb3'
verbose_name = _('phpBB3 Service')

View File

@ -1,6 +1,8 @@
from django.apps import AppConfig
from django.utils.translation import gettext_lazy as _
class SmfServiceConfig(AppConfig):
name = 'allianceauth.services.modules.smf'
label = 'smf'
verbose_name = _('SMF Service')

View File

@ -1,9 +1,11 @@
from django.apps import AppConfig
from django.utils.translation import gettext_lazy as _
class Teamspeak3ServiceConfig(AppConfig):
name = 'allianceauth.services.modules.teamspeak3'
label = 'teamspeak3'
verbose_name = _('TeamSpeak 3 Service')
def ready(self):
from . import signals

View File

@ -1,6 +1,8 @@
from django.apps import AppConfig
from django.utils.translation import gettext_lazy as _
class XenforoServiceConfig(AppConfig):
name = 'allianceauth.services.modules.xenforo'
label = 'xenforo'
verbose_name = _('Xenforo Service')

View File

@ -1,6 +1,8 @@
from django.apps import AppConfig
from django.utils.translation import gettext_lazy as _
class SRPConfig(AppConfig):
name = 'allianceauth.srp'
label = 'srp'
verbose_name = _('Ship Replacement')

View File

@ -12,11 +12,7 @@
<ul class="list-group">
{% for notif in notifications %}
<li class="list-group-item">
{% if notif.state == 'opened' %}
<span class="badge bg-success me-2">{% translate "Open" %}</span>
{% else %}
<span class="badge bg-danger me-2">{% translate "Closed" %}</span>
{% endif %}
<span class="badge bg-success me-2">{% translate "Open" %}</span>
<a href="{{ notif.web_url }}" target="_blank">#{{ notif.iid }} {{ notif.title }}</a>
</li>
{% empty %}

View File

@ -67,6 +67,26 @@ def get_datatables_language_static(language: str) -> str:
return static_url
@register.simple_tag
def get_relative_datatables_language_path(language: str) -> str:
"""
Get the correct language code URL for DataTables (relative path to the static folder)
:param language: Django's language code
:type language: str
:return: Mapped language code
:rtype: str
"""
mapped_language = get_datatable_language_code(language)
static_url = (
f"allianceauth/libs/DataTables/Plugins/2.2.1/i18n/{mapped_language}.json"
if mapped_language
else ""
)
return static_url
@register.simple_tag
def get_momentjs_language_static(language: str) -> str:
@ -88,3 +108,24 @@ def get_momentjs_language_static(language: str) -> str:
)
return static_url
@register.simple_tag
def get_relative_momentjs_language_path(language: str) -> str:
"""
Get the correct language code URL for Moment.JS (relative path to the static folder)
:param language: Django's language code
:type language: str
:return: Mapped language code path
:rtype: str
"""
mapped_language = get_momentjs_language_code(language)
static_url = (
f"allianceauth/libs/moment.js/2.29.4/locale/{mapped_language}.js"
if mapped_language
else ""
)
return static_url

View File

@ -1,6 +1,8 @@
from django.apps import AppConfig
from django.utils.translation import gettext_lazy as _
class TimerBoardConfig(AppConfig):
name = 'allianceauth.timerboard'
label = 'timerboard'
verbose_name = _('Structure Timers')