Skip to content

Commit

Permalink
Merge pull request #24 from ppfeufer/development
Browse files Browse the repository at this point in the history
preparing v2.3.0a1
  • Loading branch information
ppfeufer authored Oct 3, 2020
2 parents b76ece7 + 1bf9f45 commit 37f61d1
Show file tree
Hide file tree
Showing 18 changed files with 803 additions and 153 deletions.
26 changes: 25 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,11 +6,35 @@ The format is based on [Keep a Changelog](http://keepachangelog.com/)
and this project adheres to [Semantic Versioning](http://semver.org/).


## [2.3.0] - xxxx-xx-xx

### Important!

Before updating to this version, make sure you have your Alliance Auth updated to version 2.8.0 (or newer).
This version of AA Fleetpings uses a JavaScript library that is introduced in Alliance Auth 2.8.0,
so have your Auth updated before installing this version.

### Fixed

- mySQL text fields can't have default values

### Added

- Filter to the admin backend
- More checks for Discord. Now checking if the Discord Service s actually activated and setup properly

### Changed

- Use clipboard.js bundled with Alliance Auth
- Minimum required Alliance Auth version set to 2.8.0 due to us using clipboard.js bundled with Alliance Auth
- Unused lib removed from templates


## [2.2.2] - 2020-09-23

### Added

- Django 3 stiff in setup.py, Should probably be in there as well ...
- Django 3 stuff in setup.py, Should probably be in there as well ...


## [2.2.1] - 2020-09-23
Expand Down
4 changes: 2 additions & 2 deletions fleetpings/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
a couple of variable to use throughout the app
"""

default_app_config = "fleetpings.apps.AaFleetpingsConfig"
default_app_config: str = "fleetpings.apps.AaFleetpingsConfig"

__version__ = "2.2.2"
__version__ = "2.3.0a1"
__title__ = "Fleet Pings"
192 changes: 177 additions & 15 deletions fleetpings/admin.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
"""
settings for the admin backend
"""

from fleetpings.form import FleetTypeAdminForm
from fleetpings.models import (
FleetComm,
Expand All @@ -16,15 +17,43 @@
from django.contrib import admin


def custom_filter(title):
"""
custom filter for model properties
:param title:
:return:
"""

class Wrapper(admin.FieldListFilter):
"""
custom_filter :: wrapper
"""

def __new__(cls, *args, **kwargs):
instance = admin.FieldListFilter.create(*args, **kwargs)
instance.title = title

return instance

return Wrapper


@admin.register(FleetComm)
class FleetCommAdmin(admin.ModelAdmin):
"""
FleetCommAdmin
"""

list_display = ("name", "notes", "is_enabled")
list_filter = ("is_enabled",)
list_display = ("_name", "notes", "is_enabled")
ordering = ("name",)
list_filter = ("is_enabled",)

@classmethod
def _name(cls, obj):
return obj.name

_name.short_description = "Fleet Comms"
_name.admin_order_field = "name"


@admin.register(FleetDoctrine)
Expand All @@ -33,11 +62,41 @@ class FleetDoctrineAdmin(admin.ModelAdmin):
FleetDoctrineAdmin
"""

list_display = ("name", "link", "notes", "is_enabled")
list_filter = ("is_enabled",)
list_display = ("_name", "_link", "_restricted_to_group", "notes", "is_enabled")
filter_horizontal = ("restricted_to_group",)
ordering = ("name",)

list_filter = (
("is_enabled", custom_filter(title="active")),
("restricted_to_group", custom_filter(title="restriction")),
)

@classmethod
def _name(cls, obj):
return obj.name

_name.short_description = "Doctrine"
_name.admin_order_field = "name"

@classmethod
def _link(cls, obj):
return obj.name

_link.short_description = "Doctrine Link"
_link.admin_order_field = "link"

@classmethod
def _restricted_to_group(cls, obj):
names = [x.name for x in obj.restricted_to_group.all().order_by("name")]

if names:
return ", ".join(names)
else:
return None

_restricted_to_group.short_description = "Restricted to"
_restricted_to_group.admin_order_field = "restricted_to_group__name"


@admin.register(FormupLocation)
class FormupLocationAdmin(admin.ModelAdmin):
Expand All @@ -46,8 +105,8 @@ class FormupLocationAdmin(admin.ModelAdmin):
"""

list_display = ("name", "notes", "is_enabled")
list_filter = ("is_enabled",)
ordering = ("name",)
list_filter = ("is_enabled",)


@admin.register(DiscordPingTargets)
Expand All @@ -56,11 +115,42 @@ class DiscordPingTargetsAdmin(admin.ModelAdmin):
DiscordPingTargetsAdmin
"""

list_display = ("name", "discord_id", "notes", "is_enabled")
list_filter = ("is_enabled",)
ordering = ("name",)
list_display = (
"_name",
"discord_id",
"_restricted_to_group",
"notes",
"is_enabled",
)

filter_horizontal = ("restricted_to_group",)
readonly_fields = ("discord_id",)
ordering = ("name",)

list_filter = (
("is_enabled", custom_filter(title="active")),
("name", custom_filter(title="target")),
("restricted_to_group", custom_filter(title="restriction")),
)

@classmethod
def _name(cls, obj):
return obj.name

_name.short_description = "Ping Target"
_name.admin_order_field = "name"

@classmethod
def _restricted_to_group(cls, obj):
names = [x.name for x in obj.restricted_to_group.all().order_by("name")]

if names:
return ", ".join(names)
else:
return None

_restricted_to_group.short_description = "Restricted to"
_restricted_to_group.admin_order_field = "restricted_to_group__name"


@admin.register(FleetType)
Expand All @@ -70,11 +160,42 @@ class FleetTypeAdmin(admin.ModelAdmin):
"""

form = FleetTypeAdminForm
list_display = ("name", "embed_color", "notes", "is_enabled")
list_filter = ("is_enabled",)

list_display = (
"_name",
"embed_color",
"_restricted_to_group",
"notes",
"is_enabled",
)

filter_horizontal = ("restricted_to_group",)
ordering = ("name",)

list_filter = (
("is_enabled", custom_filter(title="active")),
("restricted_to_group", custom_filter(title="restriction")),
)

@classmethod
def _name(cls, obj):
return obj.name

_name.short_description = "Fleet Type"
_name.admin_order_field = "name"

@classmethod
def _restricted_to_group(cls, obj):
names = [x.name for x in obj.restricted_to_group.all().order_by("name")]

if names:
return ", ".join(names)
else:
return None

_restricted_to_group.short_description = "Restricted to"
_restricted_to_group.admin_order_field = "restricted_to_group__name"


@admin.register(Webhook)
class WebhookAdmin(admin.ModelAdmin):
Expand All @@ -84,13 +205,54 @@ class WebhookAdmin(admin.ModelAdmin):

list_display = (
# "id",
"name",
"type",
"url",
"_name",
"_type",
"_url",
"_restricted_to_group",
"notes",
"is_embedded",
"is_enabled",
)
list_filter = ("is_enabled",)
ordering = ("name",)

filter_horizontal = ("restricted_to_group",)
ordering = ("name",)

list_filter = (
("is_enabled", custom_filter(title="active")),
("is_embedded", custom_filter(title="embedded")),
("type", custom_filter(title="webhook type")),
("restricted_to_group", custom_filter(title="restriction")),
)

@classmethod
def _name(cls, obj):
return obj.name

_name.short_description = "Channel Name"
_name.admin_order_field = "name"

@classmethod
def _type(cls, obj):
return obj.type

_type.short_description = "Webhook Type"
_type.admin_order_field = "type"

@classmethod
def _url(cls, obj):
return obj.url

_url.short_description = "Webhook URL"
_url.admin_order_field = "url"

@classmethod
def _restricted_to_group(cls, obj):
names = [x.name for x in obj.restricted_to_group.all().order_by("name")]

if names:
return ", ".join(names)
else:
return None

_restricted_to_group.short_description = "Restricted to"
_restricted_to_group.admin_order_field = "restricted_to_group__name"
10 changes: 9 additions & 1 deletion fleetpings/app_settings.py
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,15 @@ def fittings_installed() -> bool:

def avoid_cdn() -> bool:
"""
check if we should avpiod CDN usage
check if we should aviod CDN usage
:return: bool
"""
return AVOID_CDN


def discord_service_installed() -> bool:
"""
check if the Discord service is installed
:return:
"""
return "allianceauth.services.modules.discord" in settings.INSTALLED_APPS
2 changes: 1 addition & 1 deletion fleetpings/auth_hooks.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
from . import urls, __title__


class AaFleetpingsMenuItem(MenuItemHook):
class AaFleetpingsMenuItem(MenuItemHook): # pylint: disable=too-few-public-methods
""" This class ensures only authorized users will see the menu entry """

def __init__(self):
Expand Down
2 changes: 1 addition & 1 deletion fleetpings/form.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ class FleetTypeAdminForm(ModelForm):
form definitions for the FleetType form in admin
"""

class Meta:
class Meta: # pylint: disable=too-few-public-methods
"""
Meta
"""
Expand Down
Binary file modified fleetpings/locale/de/LC_MESSAGES/django.mo
Binary file not shown.
Loading

0 comments on commit 37f61d1

Please sign in to comment.