mirror of
https://gitlab.com/allianceauth/allianceauth.git
synced 2025-07-09 12:30:15 +02:00
Restructure Alliance Auth package (#867)
* Refactor allianceauth into its own package * Add setup * Add missing default_app_config declarations * Fix timerboard namespacing * Remove obsolete future imports * Remove py2 mock support * Remove six * Add experimental 3.7 support and multiple Dj versions * Remove python_2_unicode_compatible * Add navhelper as local package * Update requirements
This commit is contained in:
parent
d10580b56b
commit
786859294d
15
.coveragerc
15
.coveragerc
@ -1,20 +1,7 @@
|
|||||||
[run]
|
[run]
|
||||||
branch = True
|
branch = True
|
||||||
source =
|
source =
|
||||||
alliance_auth
|
allianceauth
|
||||||
authentication
|
|
||||||
corputils
|
|
||||||
eveonline
|
|
||||||
fleetactivitytracking
|
|
||||||
fleetup
|
|
||||||
groupmanagement
|
|
||||||
hrapplications
|
|
||||||
notifications
|
|
||||||
optimer
|
|
||||||
permissions_tool
|
|
||||||
services
|
|
||||||
srp
|
|
||||||
timerboard
|
|
||||||
|
|
||||||
omit =
|
omit =
|
||||||
*/migrations/*
|
*/migrations/*
|
||||||
|
3
.gitignore
vendored
3
.gitignore
vendored
@ -67,3 +67,6 @@ celerybeat-schedule
|
|||||||
|
|
||||||
#pycharm
|
#pycharm
|
||||||
.idea/*
|
.idea/*
|
||||||
|
|
||||||
|
#log folder
|
||||||
|
log/*
|
||||||
|
@ -2,9 +2,11 @@ language: python
|
|||||||
python:
|
python:
|
||||||
- "3.5"
|
- "3.5"
|
||||||
- "3.6"
|
- "3.6"
|
||||||
|
- "3.7-dev"
|
||||||
# command to install dependencies
|
# command to install dependencies
|
||||||
install:
|
install:
|
||||||
- pip install requests
|
- pip install requests
|
||||||
|
- pip install Django==$DJANGO_VERSION
|
||||||
- pip install -r requirements.txt
|
- pip install -r requirements.txt
|
||||||
- pip install -r testing-requirements.txt
|
- pip install -r testing-requirements.txt
|
||||||
# command to run tests
|
# command to run tests
|
||||||
@ -12,3 +14,10 @@ script: coverage run runtests.py
|
|||||||
cache: pip
|
cache: pip
|
||||||
after_success:
|
after_success:
|
||||||
coveralls
|
coveralls
|
||||||
|
matrix:
|
||||||
|
allow_failures:
|
||||||
|
- python: "3.7-dev"
|
||||||
|
env:
|
||||||
|
- DJANGO_VERSION=1.10.8 # Remove in December 2017
|
||||||
|
- DJANGO_VERSION=1.11.5
|
||||||
|
# Add 2.0 when available and allow_failures (env: KEY=VALUE)
|
||||||
|
7
MANIFEST.in
Normal file
7
MANIFEST.in
Normal file
@ -0,0 +1,7 @@
|
|||||||
|
include LICENSE
|
||||||
|
include README.md
|
||||||
|
include MANIFEST.in
|
||||||
|
graft allianceauth
|
||||||
|
|
||||||
|
global-exclude __pycache__
|
||||||
|
global-exclude *.py[co]
|
@ -1,8 +0,0 @@
|
|||||||
from __future__ import absolute_import, unicode_literals
|
|
||||||
|
|
||||||
# This will make sure the app is always imported when
|
|
||||||
# Django starts so that shared_task will use this app.
|
|
||||||
from .celeryapp import app as celery_app # noqa
|
|
||||||
|
|
||||||
__version__ = '1.16-dev'
|
|
||||||
NAME = 'Alliance Auth v%s' % __version__
|
|
@ -27,39 +27,39 @@ INSTALLED_APPS = [
|
|||||||
'django.contrib.humanize',
|
'django.contrib.humanize',
|
||||||
'django_celery_beat',
|
'django_celery_beat',
|
||||||
'bootstrapform',
|
'bootstrapform',
|
||||||
'geelweb.django.navhelper',
|
'allianceauth.thirdparty.navhelper',
|
||||||
'bootstrap_pagination',
|
'bootstrap_pagination',
|
||||||
'sortedm2m',
|
'sortedm2m',
|
||||||
'authentication',
|
'allianceauth.authentication',
|
||||||
'services',
|
'allianceauth.services',
|
||||||
'eveonline',
|
'allianceauth.eveonline',
|
||||||
'groupmanagement',
|
'allianceauth.groupmanagement',
|
||||||
'notifications',
|
'allianceauth.notifications',
|
||||||
'esi',
|
'esi',
|
||||||
|
|
||||||
# Optional apps - remove if not desired
|
# Optional apps - remove if not desired
|
||||||
'corputils',
|
'allianceauth.corputils',
|
||||||
'hrapplications',
|
'allianceauth.hrapplications',
|
||||||
'timerboard',
|
'allianceauth.timerboard',
|
||||||
'srp',
|
'allianceauth.srp',
|
||||||
'optimer',
|
'allianceauth.optimer',
|
||||||
'fleetup',
|
'allianceauth.fleetup',
|
||||||
'fleetactivitytracking',
|
'allianceauth.fleetactivitytracking',
|
||||||
'permissions_tool',
|
'allianceauth.permissions_tool',
|
||||||
|
|
||||||
# Services - remove if not used
|
# Services - remove if not used
|
||||||
'services.modules.mumble',
|
'allianceauth.services.modules.mumble',
|
||||||
'services.modules.discord',
|
'allianceauth.services.modules.discord',
|
||||||
'services.modules.discourse',
|
'allianceauth.services.modules.discourse',
|
||||||
'services.modules.ipboard',
|
'allianceauth.services.modules.ipboard',
|
||||||
'services.modules.ips4',
|
'allianceauth.services.modules.ips4',
|
||||||
'services.modules.market',
|
'allianceauth.services.modules.market',
|
||||||
'services.modules.openfire',
|
'allianceauth.services.modules.openfire',
|
||||||
'services.modules.seat',
|
'allianceauth.services.modules.seat',
|
||||||
'services.modules.smf',
|
'allianceauth.services.modules.smf',
|
||||||
'services.modules.phpbb3',
|
'allianceauth.services.modules.phpbb3',
|
||||||
'services.modules.xenforo',
|
'allianceauth.services.modules.xenforo',
|
||||||
'services.modules.teamspeak3',
|
'allianceauth.services.modules.teamspeak3',
|
||||||
]
|
]
|
||||||
|
|
||||||
#####################################################
|
#####################################################
|
||||||
@ -84,11 +84,11 @@ CELERYBEAT_SCHEDULE = {
|
|||||||
'schedule': crontab(day_of_month='*/1'),
|
'schedule': crontab(day_of_month='*/1'),
|
||||||
},
|
},
|
||||||
'run_model_update': {
|
'run_model_update': {
|
||||||
'task': 'eveonline.tasks.run_model_update',
|
'task': 'allianceauth.eveonline.tasks.run_model_update',
|
||||||
'schedule': crontab(minute=0, hour="*/6"),
|
'schedule': crontab(minute=0, hour="*/6"),
|
||||||
},
|
},
|
||||||
'check_all_character_ownership': {
|
'check_all_character_ownership': {
|
||||||
'task': 'authentication.tasks.check_all_character_ownership',
|
'task': 'allianceauth.authentication.tasks.check_all_character_ownership',
|
||||||
'schedule': crontab(hour='*/4'),
|
'schedule': crontab(hour='*/4'),
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -137,9 +137,9 @@ TEMPLATES = [
|
|||||||
'django.template.context_processors.media',
|
'django.template.context_processors.media',
|
||||||
'django.template.context_processors.static',
|
'django.template.context_processors.static',
|
||||||
'django.template.context_processors.tz',
|
'django.template.context_processors.tz',
|
||||||
'services.context_processors.auth_settings',
|
'allianceauth.services.context_processors.auth_settings',
|
||||||
'notifications.context_processors.user_notification_count',
|
'allianceauth.notifications.context_processors.user_notification_count',
|
||||||
'groupmanagement.context_processors.can_manage_groups',
|
'allianceauth.groupmanagement.context_processors.can_manage_groups',
|
||||||
],
|
],
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
@ -166,7 +166,7 @@ AUTH_PASSWORD_VALIDATORS = [
|
|||||||
},
|
},
|
||||||
]
|
]
|
||||||
|
|
||||||
AUTHENTICATION_BACKENDS = ['authentication.backends.StateBackend', 'django.contrib.auth.backends.ModelBackend']
|
AUTHENTICATION_BACKENDS = ['allianceauth.authentication.backends.StateBackend', 'django.contrib.auth.backends.ModelBackend']
|
||||||
LOGIN_URL = 'auth_login_user'
|
LOGIN_URL = 'auth_login_user'
|
||||||
|
|
||||||
# Internationalization
|
# Internationalization
|
||||||
@ -188,10 +188,6 @@ USE_TZ = True
|
|||||||
|
|
||||||
STATIC_URL = '/static/'
|
STATIC_URL = '/static/'
|
||||||
STATIC_ROOT = os.path.join(BASE_DIR, "static")
|
STATIC_ROOT = os.path.join(BASE_DIR, "static")
|
||||||
STATICFILES_DIRS = (
|
|
||||||
os.path.join(BASE_DIR, "customization/static"),
|
|
||||||
os.path.join(BASE_DIR, "stock/static"),
|
|
||||||
)
|
|
||||||
|
|
||||||
# Bootstrap messaging css workaround
|
# Bootstrap messaging css workaround
|
||||||
MESSAGE_TAGS = {
|
MESSAGE_TAGS = {
|
||||||
@ -522,12 +518,12 @@ LOGGING = {
|
|||||||
},
|
},
|
||||||
'notifications': { # creates notifications for users with logging_notifications permission
|
'notifications': { # creates notifications for users with logging_notifications permission
|
||||||
'level': 'ERROR', # edit this line to change logging level to notifications
|
'level': 'ERROR', # edit this line to change logging level to notifications
|
||||||
'class': 'notifications.handlers.NotificationHandler',
|
'class': 'allianceauth.notifications.handlers.NotificationHandler',
|
||||||
'formatter': 'verbose',
|
'formatter': 'verbose',
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
'loggers': {
|
'loggers': {
|
||||||
'authentication': {
|
'allianceauth': {
|
||||||
'handlers': ['log_file', 'console', 'notifications'],
|
'handlers': ['log_file', 'console', 'notifications'],
|
||||||
'level': 'DEBUG',
|
'level': 'DEBUG',
|
||||||
},
|
},
|
||||||
@ -535,18 +531,6 @@ LOGGING = {
|
|||||||
'handlers': ['log_file', 'console', 'notifications'],
|
'handlers': ['log_file', 'console', 'notifications'],
|
||||||
'level': 'DEBUG',
|
'level': 'DEBUG',
|
||||||
},
|
},
|
||||||
'eveonline': {
|
|
||||||
'handlers': ['log_file', 'console', 'notifications'],
|
|
||||||
'level': 'DEBUG',
|
|
||||||
},
|
|
||||||
'groupmanagement': {
|
|
||||||
'handlers': ['log_file', 'console', 'notifications'],
|
|
||||||
'level': 'DEBUG',
|
|
||||||
},
|
|
||||||
'hrapplications': {
|
|
||||||
'handlers': ['log_file', 'console', 'notifications'],
|
|
||||||
'level': 'DEBUG',
|
|
||||||
},
|
|
||||||
'portal': {
|
'portal': {
|
||||||
'handlers': ['log_file', 'console', 'notifications'],
|
'handlers': ['log_file', 'console', 'notifications'],
|
||||||
'level': 'DEBUG',
|
'level': 'DEBUG',
|
||||||
@ -555,38 +539,6 @@ LOGGING = {
|
|||||||
'handlers': ['log_file', 'console', 'notifications'],
|
'handlers': ['log_file', 'console', 'notifications'],
|
||||||
'level': 'DEBUG',
|
'level': 'DEBUG',
|
||||||
},
|
},
|
||||||
'services': {
|
|
||||||
'handlers': ['log_file', 'console', 'notifications'],
|
|
||||||
'level': 'DEBUG',
|
|
||||||
},
|
|
||||||
'srp': {
|
|
||||||
'handlers': ['log_file', 'console', 'notifications'],
|
|
||||||
'level': 'DEBUG',
|
|
||||||
},
|
|
||||||
'timerboard': {
|
|
||||||
'handlers': ['log_file', 'console', 'notifications'],
|
|
||||||
'level': 'DEBUG',
|
|
||||||
},
|
|
||||||
'sigtracker': {
|
|
||||||
'handlers': ['log_file', 'console', 'notifications'],
|
|
||||||
'level': 'DEBUG',
|
|
||||||
},
|
|
||||||
'optimer': {
|
|
||||||
'handlers': ['log_file', 'console', 'notifications'],
|
|
||||||
'level': 'DEBUG',
|
|
||||||
},
|
|
||||||
'corputils': {
|
|
||||||
'handlers': ['log_file', 'console', 'notifications'],
|
|
||||||
'level': 'DEBUG',
|
|
||||||
},
|
|
||||||
'fleetactivitytracking': {
|
|
||||||
'handlers': ['log_file', 'console', 'notifications'],
|
|
||||||
'level': 'ERROR',
|
|
||||||
},
|
|
||||||
'fleetup': {
|
|
||||||
'handlers': ['log_file', 'console', 'notifications'],
|
|
||||||
'level': 'DEBUG',
|
|
||||||
},
|
|
||||||
'util': {
|
'util': {
|
||||||
'handlers': ['log_file', 'console', 'notifications'],
|
'handlers': ['log_file', 'console', 'notifications'],
|
||||||
'level': 'DEBUG',
|
'level': 'DEBUG',
|
||||||
|
@ -1,91 +0,0 @@
|
|||||||
from django.conf.urls import include, url
|
|
||||||
|
|
||||||
from django.conf.urls.i18n import i18n_patterns
|
|
||||||
from django.utils.translation import ugettext_lazy as _
|
|
||||||
from django.contrib import admin
|
|
||||||
import authentication.urls
|
|
||||||
from authentication import hmac_urls
|
|
||||||
import authentication.views
|
|
||||||
import services.views
|
|
||||||
import groupmanagement.views
|
|
||||||
import notifications.views
|
|
||||||
import esi.urls
|
|
||||||
from alliance_auth import NAME
|
|
||||||
from alliance_auth.hooks import get_hooks
|
|
||||||
from django.views.generic.base import TemplateView
|
|
||||||
|
|
||||||
admin.site.site_header = NAME
|
|
||||||
|
|
||||||
|
|
||||||
# Functional/Untranslated URL's
|
|
||||||
urlpatterns = [
|
|
||||||
# Locale
|
|
||||||
url(r'^i18n/', include('django.conf.urls.i18n')),
|
|
||||||
|
|
||||||
# Authentication
|
|
||||||
url(r'', include(authentication.urls, namespace='authentication')),
|
|
||||||
url(r'^account/login/$', TemplateView.as_view(template_name='public/login.html'), name='auth_login_user'),
|
|
||||||
url(r'account/', include(hmac_urls)),
|
|
||||||
|
|
||||||
# Admin urls
|
|
||||||
url(r'^admin/', include(admin.site.urls)),
|
|
||||||
|
|
||||||
# SSO
|
|
||||||
url(r'^sso/', include(esi.urls, namespace='esi')),
|
|
||||||
url(r'^sso/login$', authentication.views.sso_login, name='auth_sso_login'),
|
|
||||||
|
|
||||||
# Notifications
|
|
||||||
url(r'^remove_notifications/(\w+)/$', notifications.views.remove_notification, name='auth_remove_notification'),
|
|
||||||
url(r'^notifications/mark_all_read/$', notifications.views.mark_all_read, name='auth_mark_all_notifications_read'),
|
|
||||||
url(r'^notifications/delete_all_read/$', notifications.views.delete_all_read,
|
|
||||||
name='auth_delete_all_read_notifications'),
|
|
||||||
]
|
|
||||||
|
|
||||||
# User viewed/translated URLS
|
|
||||||
urlpatterns += i18n_patterns(
|
|
||||||
# Group management
|
|
||||||
url(_(r'^groups/'), groupmanagement.views.groups_view, name='auth_groups'),
|
|
||||||
url(_(r'^group/management/'), groupmanagement.views.group_management,
|
|
||||||
name='auth_group_management'),
|
|
||||||
url(_(r'^group/membership/$'), groupmanagement.views.group_membership,
|
|
||||||
name='auth_group_membership'),
|
|
||||||
url(_(r'^group/membership/(\w+)/$'), groupmanagement.views.group_membership_list,
|
|
||||||
name='auth_group_membership_list'),
|
|
||||||
url(_(r'^group/membership/(\w+)/remove/(\w+)/$'), groupmanagement.views.group_membership_remove,
|
|
||||||
name='auth_group_membership_remove'),
|
|
||||||
url(_(r'^group/request_add/(\w+)'), groupmanagement.views.group_request_add,
|
|
||||||
name='auth_group_request_add'),
|
|
||||||
url(_(r'^group/request/accept/(\w+)'), groupmanagement.views.group_accept_request,
|
|
||||||
name='auth_group_accept_request'),
|
|
||||||
url(_(r'^group/request/reject/(\w+)'), groupmanagement.views.group_reject_request,
|
|
||||||
name='auth_group_reject_request'),
|
|
||||||
|
|
||||||
url(_(r'^group/request_leave/(\w+)'), groupmanagement.views.group_request_leave,
|
|
||||||
name='auth_group_request_leave'),
|
|
||||||
url(_(r'group/leave_request/accept/(\w+)'), groupmanagement.views.group_leave_accept_request,
|
|
||||||
name='auth_group_leave_accept_request'),
|
|
||||||
url(_(r'^group/leave_request/reject/(\w+)'), groupmanagement.views.group_leave_reject_request,
|
|
||||||
name='auth_group_leave_reject_request'),
|
|
||||||
|
|
||||||
url(_(r'^services/$'), services.views.services_view, name='auth_services'),
|
|
||||||
|
|
||||||
# Tools
|
|
||||||
url(_(r'^tool/fleet_formatter_tool/$'), services.views.fleet_formatter_view,
|
|
||||||
name='auth_fleet_format_tool_view'),
|
|
||||||
|
|
||||||
# Notifications
|
|
||||||
url(_(r'^notifications/$'), notifications.views.notification_list, name='auth_notification_list'),
|
|
||||||
url(_(r'^notifications/(\w+)/$'), notifications.views.notification_view, name='auth_notification_view'),
|
|
||||||
|
|
||||||
|
|
||||||
)
|
|
||||||
|
|
||||||
# Append hooked service urls
|
|
||||||
services = get_hooks('services_hook')
|
|
||||||
for svc in services:
|
|
||||||
urlpatterns += svc().urlpatterns
|
|
||||||
|
|
||||||
# Append app urls
|
|
||||||
app_urls = get_hooks('url_hook')
|
|
||||||
for app in app_urls:
|
|
||||||
urlpatterns += [app().include_pattern]
|
|
7
allianceauth/__init__.py
Normal file
7
allianceauth/__init__.py
Normal file
@ -0,0 +1,7 @@
|
|||||||
|
# This will make sure the app is always imported when
|
||||||
|
# Django starts so that shared_task will use this app.
|
||||||
|
|
||||||
|
__version__ = '2.0-dev'
|
||||||
|
NAME = 'Alliance Auth v%s' % __version__
|
||||||
|
default_app_config = 'allianceauth.apps.AllianceAuthConfig'
|
||||||
|
|
5
allianceauth/apps.py
Normal file
5
allianceauth/apps.py
Normal file
@ -0,0 +1,5 @@
|
|||||||
|
from django.apps import AppConfig
|
||||||
|
|
||||||
|
|
||||||
|
class AllianceAuthConfig(AppConfig):
|
||||||
|
name = 'allianceauth'
|
1
allianceauth/authentication/__init__.py
Normal file
1
allianceauth/authentication/__init__.py
Normal file
@ -0,0 +1 @@
|
|||||||
|
default_app_config = 'allianceauth.authentication.apps.AuthenticationConfig'
|
@ -1,12 +1,11 @@
|
|||||||
from __future__ import unicode_literals
|
|
||||||
|
|
||||||
from django.contrib import admin
|
from django.contrib import admin
|
||||||
from django.contrib.auth.admin import UserAdmin as BaseUserAdmin
|
from django.contrib.auth.admin import UserAdmin as BaseUserAdmin
|
||||||
from django.contrib.auth.models import User, Permission
|
from django.contrib.auth.models import User, Permission
|
||||||
from django.utils.text import slugify
|
from django.utils.text import slugify
|
||||||
from authentication.models import State, get_guest_state, CharacterOwnership, UserProfile
|
from allianceauth.services.hooks import ServicesHook
|
||||||
from alliance_auth.hooks import get_hooks
|
|
||||||
from services.hooks import ServicesHook
|
from allianceauth.authentication.models import State, get_guest_state, CharacterOwnership, UserProfile
|
||||||
|
from allianceauth.hooks import get_hooks
|
||||||
|
|
||||||
|
|
||||||
def make_service_hooks_update_groups_action(service):
|
def make_service_hooks_update_groups_action(service):
|
@ -1,14 +1,12 @@
|
|||||||
from __future__ import unicode_literals
|
|
||||||
|
|
||||||
from django.apps import AppConfig
|
from django.apps import AppConfig
|
||||||
from django.core.checks import register, Tags
|
from django.core.checks import register, Tags
|
||||||
|
|
||||||
|
|
||||||
class AuthenticationConfig(AppConfig):
|
class AuthenticationConfig(AppConfig):
|
||||||
name = 'authentication'
|
name = 'allianceauth.authentication'
|
||||||
|
label = 'authentication'
|
||||||
|
|
||||||
def ready(self):
|
def ready(self):
|
||||||
super(AuthenticationConfig, self).ready()
|
super(AuthenticationConfig, self).ready()
|
||||||
import authentication.signals
|
from allianceauth.authentication import checks
|
||||||
from authentication import checks
|
|
||||||
register(Tags.security)(checks.check_login_scopes_setting)
|
register(Tags.security)(checks.check_login_scopes_setting)
|
@ -1,8 +1,9 @@
|
|||||||
from django.contrib.auth.backends import ModelBackend
|
from django.contrib.auth.backends import ModelBackend
|
||||||
from django.contrib.auth.models import Permission
|
from django.contrib.auth.models import Permission
|
||||||
from authentication.models import UserProfile, CharacterOwnership
|
|
||||||
from django.contrib.auth.models import User
|
from django.contrib.auth.models import User
|
||||||
|
|
||||||
|
from .models import UserProfile, CharacterOwnership
|
||||||
|
|
||||||
|
|
||||||
class StateBackend(ModelBackend):
|
class StateBackend(ModelBackend):
|
||||||
@staticmethod
|
@staticmethod
|
@ -1,4 +1,3 @@
|
|||||||
from __future__ import unicode_literals
|
|
||||||
from django.core.checks import Error
|
from django.core.checks import Error
|
||||||
from django.conf import settings
|
from django.conf import settings
|
||||||
|
|
@ -1,4 +1,3 @@
|
|||||||
from __future__ import unicode_literals
|
|
||||||
from django import forms
|
from django import forms
|
||||||
from django.utils.translation import ugettext_lazy as _
|
from django.utils.translation import ugettext_lazy as _
|
||||||
|
|
@ -1,5 +1,6 @@
|
|||||||
from django.conf.urls import url, include
|
from django.conf.urls import url, include
|
||||||
from authentication import views
|
|
||||||
|
from allianceauth.authentication import views
|
||||||
|
|
||||||
urlpatterns = [
|
urlpatterns = [
|
||||||
url(r'^activate/complete/$', views.activation_complete, name='registration_activation_complete'),
|
url(r'^activate/complete/$', views.activation_complete, name='registration_activation_complete'),
|
@ -1,10 +1,11 @@
|
|||||||
from __future__ import unicode_literals
|
|
||||||
from django.db.models import Manager, QuerySet, Q
|
|
||||||
from django.db import transaction
|
|
||||||
from eveonline.managers import EveManager
|
|
||||||
from eveonline.models import EveCharacter
|
|
||||||
import logging
|
import logging
|
||||||
|
|
||||||
|
from django.db import transaction
|
||||||
|
from django.db.models import Manager, QuerySet, Q
|
||||||
|
from allianceauth.eveonline.managers import EveManager
|
||||||
|
|
||||||
|
from allianceauth.eveonline.models import EveCharacter
|
||||||
|
|
||||||
logger = logging.getLogger(__name__)
|
logger = logging.getLogger(__name__)
|
||||||
|
|
||||||
|
|
||||||
@ -42,7 +43,7 @@ class StateQuerySet(QuerySet):
|
|||||||
if states.exists():
|
if states.exists():
|
||||||
return states[0]
|
return states[0]
|
||||||
else:
|
else:
|
||||||
from authentication.models import get_guest_state
|
from allianceauth.authentication.models import get_guest_state
|
||||||
return get_guest_state()
|
return get_guest_state()
|
||||||
|
|
||||||
def delete(self):
|
def delete(self):
|
||||||
@ -68,7 +69,7 @@ class StateManager(Manager):
|
|||||||
if states.exists():
|
if states.exists():
|
||||||
return states[0]
|
return states[0]
|
||||||
else:
|
else:
|
||||||
from authentication.models import get_guest_state
|
from allianceauth.authentication.models import get_guest_state
|
||||||
return get_guest_state()
|
return get_guest_state()
|
||||||
|
|
||||||
def get_for_user(self, user):
|
def get_for_user(self, user):
|
@ -2,11 +2,11 @@
|
|||||||
# Generated by Django 1.10.5 on 2017-03-22 23:09
|
# Generated by Django 1.10.5 on 2017-03-22 23:09
|
||||||
from __future__ import unicode_literals
|
from __future__ import unicode_literals
|
||||||
|
|
||||||
import authentication.models
|
import allianceauth.authentication.models
|
||||||
from django.conf import settings
|
|
||||||
from django.db import migrations, models
|
|
||||||
import django.db.models.deletion
|
import django.db.models.deletion
|
||||||
|
from django.conf import settings
|
||||||
from django.contrib.auth.hashers import make_password
|
from django.contrib.auth.hashers import make_password
|
||||||
|
from django.db import migrations, models
|
||||||
|
|
||||||
|
|
||||||
def create_guest_state(apps, schema_editor):
|
def create_guest_state(apps, schema_editor):
|
||||||
@ -212,7 +212,7 @@ class Migration(migrations.Migration):
|
|||||||
fields=[
|
fields=[
|
||||||
('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
|
('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
|
||||||
('main_character', models.OneToOneField(blank=True, null=True, on_delete=django.db.models.deletion.SET_NULL, to='eveonline.EveCharacter')),
|
('main_character', models.OneToOneField(blank=True, null=True, on_delete=django.db.models.deletion.SET_NULL, to='eveonline.EveCharacter')),
|
||||||
('state', models.ForeignKey(default=authentication.models.get_guest_state_pk, on_delete=django.db.models.deletion.SET_DEFAULT, to='authentication.State')),
|
('state', models.ForeignKey(default=allianceauth.authentication.models.get_guest_state_pk, on_delete=django.db.models.deletion.SET_DEFAULT, to='authentication.State')),
|
||||||
('user', models.OneToOneField(on_delete=django.db.models.deletion.CASCADE, related_name='profile', to=settings.AUTH_USER_MODEL)),
|
('user', models.OneToOneField(on_delete=django.db.models.deletion.CASCADE, related_name='profile', to=settings.AUTH_USER_MODEL)),
|
||||||
],
|
],
|
||||||
options={
|
options={
|
@ -1,17 +1,16 @@
|
|||||||
from __future__ import unicode_literals
|
|
||||||
from django.utils.encoding import python_2_unicode_compatible
|
|
||||||
from django.db import models, transaction
|
|
||||||
from django.contrib.auth.models import User, Permission
|
|
||||||
from authentication.managers import CharacterOwnershipManager, StateManager
|
|
||||||
from eveonline.models import EveCharacter, EveCorporationInfo, EveAllianceInfo
|
|
||||||
from notifications import notify
|
|
||||||
from django.utils.translation import ugettext_lazy as _
|
|
||||||
import logging
|
import logging
|
||||||
|
|
||||||
|
from django.contrib.auth.models import User, Permission
|
||||||
|
from django.db import models, transaction
|
||||||
|
from django.utils.translation import ugettext_lazy as _
|
||||||
|
from allianceauth.eveonline.models import EveCharacter, EveCorporationInfo, EveAllianceInfo
|
||||||
|
from allianceauth.notifications import notify
|
||||||
|
|
||||||
|
from .managers import CharacterOwnershipManager, StateManager
|
||||||
|
|
||||||
logger = logging.getLogger(__name__)
|
logger = logging.getLogger(__name__)
|
||||||
|
|
||||||
|
|
||||||
@python_2_unicode_compatible
|
|
||||||
class State(models.Model):
|
class State(models.Model):
|
||||||
name = models.CharField(max_length=20, unique=True)
|
name = models.CharField(max_length=20, unique=True)
|
||||||
permissions = models.ManyToManyField(Permission, blank=True)
|
permissions = models.ManyToManyField(Permission, blank=True)
|
||||||
@ -58,7 +57,6 @@ def get_guest_state_pk():
|
|||||||
return get_guest_state().pk
|
return get_guest_state().pk
|
||||||
|
|
||||||
|
|
||||||
@python_2_unicode_compatible
|
|
||||||
class UserProfile(models.Model):
|
class UserProfile(models.Model):
|
||||||
class Meta:
|
class Meta:
|
||||||
default_permissions = ('change',)
|
default_permissions = ('change',)
|
||||||
@ -78,14 +76,13 @@ class UserProfile(models.Model):
|
|||||||
notify(self.user, _('State Changed'),
|
notify(self.user, _('State Changed'),
|
||||||
_('Your user state has been changed to %(state)s') % ({'state': state}),
|
_('Your user state has been changed to %(state)s') % ({'state': state}),
|
||||||
'info')
|
'info')
|
||||||
from authentication.signals import state_changed
|
from allianceauth.authentication.signals import state_changed
|
||||||
state_changed.send(sender=self.__class__, user=self.user, state=self.state)
|
state_changed.send(sender=self.__class__, user=self.user, state=self.state)
|
||||||
|
|
||||||
def __str__(self):
|
def __str__(self):
|
||||||
return str(self.user)
|
return str(self.user)
|
||||||
|
|
||||||
|
|
||||||
@python_2_unicode_compatible
|
|
||||||
class CharacterOwnership(models.Model):
|
class CharacterOwnership(models.Model):
|
||||||
class Meta:
|
class Meta:
|
||||||
default_permissions = ('change', 'delete')
|
default_permissions = ('change', 'delete')
|
@ -1,14 +1,15 @@
|
|||||||
from __future__ import unicode_literals
|
|
||||||
from django.db.models.signals import post_save, pre_delete, m2m_changed, pre_save
|
|
||||||
from django.db.models import Q
|
|
||||||
from django.dispatch import receiver, Signal
|
|
||||||
from django.contrib.auth.models import User
|
|
||||||
from authentication.models import CharacterOwnership, UserProfile, get_guest_state, State
|
|
||||||
from esi.models import Token
|
|
||||||
from eveonline.managers import EveManager
|
|
||||||
from eveonline.models import EveCharacter
|
|
||||||
import logging
|
import logging
|
||||||
|
|
||||||
|
from .models import CharacterOwnership, UserProfile, get_guest_state, State
|
||||||
|
from django.contrib.auth.models import User
|
||||||
|
from django.db.models import Q
|
||||||
|
from django.db.models.signals import post_save, pre_delete, m2m_changed, pre_save
|
||||||
|
from django.dispatch import receiver, Signal
|
||||||
|
from esi.models import Token
|
||||||
|
from allianceauth.eveonline.managers import EveManager
|
||||||
|
|
||||||
|
from allianceauth.eveonline.models import EveCharacter
|
||||||
|
|
||||||
logger = logging.getLogger(__name__)
|
logger = logging.getLogger(__name__)
|
||||||
|
|
||||||
|
|
Before Width: | Height: | Size: 158 KiB After Width: | Height: | Size: 158 KiB |
Before Width: | Height: | Size: 2.3 KiB After Width: | Height: | Size: 2.3 KiB |
Before Width: | Height: | Size: 2.2 KiB After Width: | Height: | Size: 2.2 KiB |
@ -1,10 +1,11 @@
|
|||||||
from alliance_auth.celeryapp import app
|
|
||||||
from esi.models import Token
|
|
||||||
from esi.errors import TokenExpiredError, TokenInvalidError
|
|
||||||
from authentication.models import CharacterOwnership
|
|
||||||
|
|
||||||
import logging
|
import logging
|
||||||
|
|
||||||
|
from esi.errors import TokenExpiredError, TokenInvalidError
|
||||||
|
from esi.models import Token
|
||||||
|
|
||||||
|
from allianceauth.authentication.models import CharacterOwnership
|
||||||
|
from allianceauth.celeryapp import app
|
||||||
|
|
||||||
logger = logging.getLogger(__name__)
|
logger = logging.getLogger(__name__)
|
||||||
|
|
||||||
|
|
@ -1,19 +1,12 @@
|
|||||||
from __future__ import unicode_literals
|
from unittest import mock
|
||||||
|
|
||||||
try:
|
|
||||||
# Py3
|
|
||||||
from unittest import mock
|
|
||||||
except ImportError:
|
|
||||||
# Py2
|
|
||||||
import mock
|
|
||||||
|
|
||||||
from django.test import TestCase
|
from django.test import TestCase
|
||||||
from django.contrib.auth.models import User
|
from django.contrib.auth.models import User
|
||||||
from alliance_auth.tests.auth_utils import AuthUtils
|
from allianceauth.tests.auth_utils import AuthUtils
|
||||||
from authentication.models import CharacterOwnership, UserProfile, State, get_guest_state
|
from .models import CharacterOwnership, UserProfile, State, get_guest_state
|
||||||
from authentication.backends import StateBackend
|
from .backends import StateBackend
|
||||||
from authentication.tasks import check_character_ownership
|
from .tasks import check_character_ownership
|
||||||
from eveonline.models import EveCharacter, EveCorporationInfo, EveAllianceInfo
|
from allianceauth.eveonline.models import EveCharacter, EveCorporationInfo, EveAllianceInfo
|
||||||
from esi.models import Token
|
from esi.models import Token
|
||||||
|
|
||||||
|
|
@ -1,7 +1,8 @@
|
|||||||
from django.conf.urls import url
|
from django.conf.urls import url
|
||||||
from django.contrib.auth.decorators import login_required
|
from django.contrib.auth.decorators import login_required
|
||||||
from django.views.generic.base import TemplateView
|
from django.views.generic.base import TemplateView
|
||||||
from authentication import views
|
|
||||||
|
from . import views
|
||||||
|
|
||||||
app_name = 'authentication'
|
app_name = 'authentication'
|
||||||
|
|
@ -1,20 +1,21 @@
|
|||||||
from __future__ import unicode_literals
|
import logging
|
||||||
from django.contrib.auth import login, authenticate
|
|
||||||
from django.shortcuts import redirect
|
|
||||||
from django.contrib.auth.decorators import login_required
|
|
||||||
from django.utils.translation import ugettext_lazy as _
|
|
||||||
from authentication.forms import RegistrationForm
|
|
||||||
from authentication.models import CharacterOwnership
|
|
||||||
from django.contrib import messages
|
|
||||||
from django.contrib.auth.models import User
|
|
||||||
from django.conf import settings
|
from django.conf import settings
|
||||||
|
from django.contrib import messages
|
||||||
|
from django.contrib.auth import login, authenticate
|
||||||
|
from django.contrib.auth.decorators import login_required
|
||||||
|
from django.contrib.auth.models import User
|
||||||
from django.core import signing
|
from django.core import signing
|
||||||
from django.core.urlresolvers import reverse
|
from django.core.urlresolvers import reverse
|
||||||
|
from django.shortcuts import redirect
|
||||||
|
from django.utils.translation import ugettext_lazy as _
|
||||||
from esi.decorators import token_required
|
from esi.decorators import token_required
|
||||||
from registration.backends.hmac.views import RegistrationView as BaseRegistrationView, \
|
from registration.backends.hmac.views import RegistrationView as BaseRegistrationView, \
|
||||||
ActivationView as BaseActivationView, REGISTRATION_SALT
|
ActivationView as BaseActivationView, REGISTRATION_SALT
|
||||||
from registration.signals import user_registered
|
from registration.signals import user_registered
|
||||||
import logging
|
|
||||||
|
from .models import CharacterOwnership
|
||||||
|
from .forms import RegistrationForm
|
||||||
|
|
||||||
logger = logging.getLogger(__name__)
|
logger = logging.getLogger(__name__)
|
||||||
|
|
@ -1,4 +1,3 @@
|
|||||||
from __future__ import absolute_import, unicode_literals
|
|
||||||
import os
|
import os
|
||||||
from celery import Celery
|
from celery import Celery
|
||||||
|
|
1
allianceauth/corputils/__init__.py
Normal file
1
allianceauth/corputils/__init__.py
Normal file
@ -0,0 +1 @@
|
|||||||
|
default_app_config = 'allianceauth.corputils.apps.CorpUtilsConfig'
|
@ -1,6 +1,6 @@
|
|||||||
from __future__ import unicode_literals
|
|
||||||
from corputils.models import CorpStats, CorpMember
|
|
||||||
from django.contrib import admin
|
from django.contrib import admin
|
||||||
|
|
||||||
|
from .models import CorpStats, CorpMember
|
||||||
|
|
||||||
admin.site.register(CorpStats)
|
admin.site.register(CorpStats)
|
||||||
admin.site.register(CorpMember)
|
admin.site.register(CorpMember)
|
@ -1,7 +1,6 @@
|
|||||||
from __future__ import unicode_literals
|
|
||||||
|
|
||||||
from django.apps import AppConfig
|
from django.apps import AppConfig
|
||||||
|
|
||||||
|
|
||||||
class CorpUtilsConfig(AppConfig):
|
class CorpUtilsConfig(AppConfig):
|
||||||
name = 'corputils'
|
name = 'allianceauth.corputils'
|
||||||
|
label = 'corputils'
|
@ -1,6 +1,7 @@
|
|||||||
from services.hooks import MenuItemHook, UrlHook
|
from allianceauth.services.hooks import MenuItemHook, UrlHook
|
||||||
from alliance_auth import hooks
|
|
||||||
from corputils import urls
|
from allianceauth import hooks
|
||||||
|
from allianceauth.corputils import urls
|
||||||
|
|
||||||
|
|
||||||
class CorpStats(MenuItemHook):
|
class CorpStats(MenuItemHook):
|
@ -1,23 +1,21 @@
|
|||||||
from __future__ import unicode_literals
|
|
||||||
from django.utils.encoding import python_2_unicode_compatible
|
|
||||||
from django.db import models
|
|
||||||
from eveonline.models import EveCorporationInfo, EveCharacter
|
|
||||||
from esi.models import Token
|
|
||||||
from esi.errors import TokenError
|
|
||||||
from notifications import notify
|
|
||||||
from authentication.models import CharacterOwnership, UserProfile
|
|
||||||
from bravado.exception import HTTPForbidden
|
|
||||||
from corputils.managers import CorpStatsManager
|
|
||||||
import logging
|
import logging
|
||||||
import os
|
import os
|
||||||
|
|
||||||
|
from allianceauth.authentication.models import CharacterOwnership, UserProfile
|
||||||
|
from bravado.exception import HTTPForbidden
|
||||||
|
from django.db import models
|
||||||
|
from esi.errors import TokenError
|
||||||
|
from esi.models import Token
|
||||||
|
from allianceauth.eveonline.models import EveCorporationInfo, EveCharacter
|
||||||
|
from allianceauth.notifications import notify
|
||||||
|
|
||||||
|
from allianceauth.corputils.managers import CorpStatsManager
|
||||||
|
|
||||||
SWAGGER_SPEC_PATH = os.path.join(os.path.dirname(os.path.abspath(__file__)), 'swagger.json')
|
SWAGGER_SPEC_PATH = os.path.join(os.path.dirname(os.path.abspath(__file__)), 'swagger.json')
|
||||||
|
|
||||||
logger = logging.getLogger(__name__)
|
logger = logging.getLogger(__name__)
|
||||||
|
|
||||||
|
|
||||||
@python_2_unicode_compatible
|
|
||||||
class CorpStats(models.Model):
|
class CorpStats(models.Model):
|
||||||
token = models.ForeignKey(Token, on_delete=models.CASCADE)
|
token = models.ForeignKey(Token, on_delete=models.CASCADE)
|
||||||
corp = models.OneToOneField(EveCorporationInfo)
|
corp = models.OneToOneField(EveCorporationInfo)
|
@ -1,5 +1,5 @@
|
|||||||
from corputils.models import CorpStats
|
from allianceauth.celeryapp import app
|
||||||
from alliance_auth.celeryapp import app
|
from allianceauth.corputils import CorpStats
|
||||||
|
|
||||||
|
|
||||||
@app.task
|
@app.task
|
@ -1,21 +1,14 @@
|
|||||||
from __future__ import unicode_literals
|
from unittest import mock
|
||||||
|
|
||||||
try:
|
|
||||||
# Py3
|
|
||||||
from unittest import mock
|
|
||||||
except ImportError:
|
|
||||||
# Py2
|
|
||||||
import mock
|
|
||||||
|
|
||||||
from django.test import TestCase
|
from django.test import TestCase
|
||||||
from alliance_auth.tests.auth_utils import AuthUtils
|
from allianceauth.tests.auth_utils import AuthUtils
|
||||||
from corputils.models import CorpStats, CorpMember
|
from .models import CorpStats, CorpMember
|
||||||
from eveonline.models import EveCorporationInfo, EveAllianceInfo, EveCharacter
|
from allianceauth.eveonline.models import EveCorporationInfo, EveAllianceInfo, EveCharacter
|
||||||
from esi.models import Token
|
from esi.models import Token
|
||||||
from esi.errors import TokenError
|
from esi.errors import TokenError
|
||||||
from bravado.exception import HTTPForbidden
|
from bravado.exception import HTTPForbidden
|
||||||
from django.contrib.auth.models import Permission
|
from django.contrib.auth.models import Permission
|
||||||
from authentication.models import CharacterOwnership
|
from allianceauth.authentication.models import CharacterOwnership
|
||||||
|
|
||||||
|
|
||||||
class CorpStatsManagerTestCase(TestCase):
|
class CorpStatsManagerTestCase(TestCase):
|
||||||
@ -106,7 +99,7 @@ class CorpStatsUpdateTestCase(TestCase):
|
|||||||
self.corpstats.update()
|
self.corpstats.update()
|
||||||
self.assertFalse(CorpMember.objects.filter(character_id='2', corpstats=self.corpstats).exists())
|
self.assertFalse(CorpMember.objects.filter(character_id='2', corpstats=self.corpstats).exists())
|
||||||
|
|
||||||
@mock.patch('corputils.models.notify')
|
@mock.patch('allianceauth.corputils.models.notify')
|
||||||
@mock.patch('esi.clients.SwaggerClient')
|
@mock.patch('esi.clients.SwaggerClient')
|
||||||
def test_update_deleted_token(self, SwaggerClient, notify):
|
def test_update_deleted_token(self, SwaggerClient, notify):
|
||||||
SwaggerClient.from_spec.return_value.Character.get_characters_character_id.return_value.result.return_value = {'corporation_id': 2}
|
SwaggerClient.from_spec.return_value.Character.get_characters_character_id.return_value.result.return_value = {'corporation_id': 2}
|
||||||
@ -115,7 +108,7 @@ class CorpStatsUpdateTestCase(TestCase):
|
|||||||
self.assertFalse(CorpStats.objects.filter(corp=self.corp).exists())
|
self.assertFalse(CorpStats.objects.filter(corp=self.corp).exists())
|
||||||
self.assertTrue(notify.called)
|
self.assertTrue(notify.called)
|
||||||
|
|
||||||
@mock.patch('corputils.models.notify')
|
@mock.patch('allianceauth.corputils.models.notify')
|
||||||
@mock.patch('esi.clients.SwaggerClient')
|
@mock.patch('esi.clients.SwaggerClient')
|
||||||
def test_update_http_forbidden(self, SwaggerClient, notify):
|
def test_update_http_forbidden(self, SwaggerClient, notify):
|
||||||
SwaggerClient.from_spec.return_value.Character.get_characters_character_id.return_value.result.return_value = {'corporation_id': 2}
|
SwaggerClient.from_spec.return_value.Character.get_characters_character_id.return_value.result.return_value = {'corporation_id': 2}
|
||||||
@ -124,7 +117,7 @@ class CorpStatsUpdateTestCase(TestCase):
|
|||||||
self.assertFalse(CorpStats.objects.filter(corp=self.corp).exists())
|
self.assertFalse(CorpStats.objects.filter(corp=self.corp).exists())
|
||||||
self.assertTrue(notify.called)
|
self.assertTrue(notify.called)
|
||||||
|
|
||||||
@mock.patch('corputils.models.notify')
|
@mock.patch('allianceauth.corputils.models.notify')
|
||||||
@mock.patch('esi.clients.SwaggerClient')
|
@mock.patch('esi.clients.SwaggerClient')
|
||||||
def test_update_token_character_corp_changed(self, SwaggerClient, notify):
|
def test_update_token_character_corp_changed(self, SwaggerClient, notify):
|
||||||
SwaggerClient.from_spec.return_value.Character.get_characters_character_id.return_value.result.return_value = {'corporation_id': 3}
|
SwaggerClient.from_spec.return_value.Character.get_characters_character_id.return_value.result.return_value = {'corporation_id': 3}
|
12
allianceauth/corputils/urls.py
Normal file
12
allianceauth/corputils/urls.py
Normal file
@ -0,0 +1,12 @@
|
|||||||
|
from django.conf.urls import url
|
||||||
|
|
||||||
|
from . import views
|
||||||
|
|
||||||
|
app_name = 'corputils'
|
||||||
|
urlpatterns = [
|
||||||
|
url(r'^$', views.corpstats_view, name='view'),
|
||||||
|
url(r'^add/$', views.corpstats_add, name='add'),
|
||||||
|
url(r'^(?P<corp_id>(\d)*)/$', views.corpstats_view, name='view_corp'),
|
||||||
|
url(r'^(?P<corp_id>(\d)+)/update/$', views.corpstats_update, name='update'),
|
||||||
|
url(r'^search/$', views.corpstats_search, name='search'),
|
||||||
|
]
|
@ -1,16 +1,17 @@
|
|||||||
from __future__ import unicode_literals
|
import os
|
||||||
from django.contrib.auth.decorators import login_required, permission_required, user_passes_test
|
|
||||||
from django.shortcuts import render, redirect, get_object_or_404
|
from bravado.exception import HTTPError
|
||||||
from django.contrib import messages
|
from django.contrib import messages
|
||||||
|
from django.contrib.auth.decorators import login_required, permission_required, user_passes_test
|
||||||
from django.core.exceptions import PermissionDenied
|
from django.core.exceptions import PermissionDenied
|
||||||
from django.db import IntegrityError
|
from django.db import IntegrityError
|
||||||
|
from django.shortcuts import render, redirect, get_object_or_404
|
||||||
from django.utils.translation import ugettext_lazy as _
|
from django.utils.translation import ugettext_lazy as _
|
||||||
from eveonline.models import EveCharacter, EveCorporationInfo
|
|
||||||
from eveonline.managers import EveManager
|
|
||||||
from corputils.models import CorpStats
|
|
||||||
from esi.decorators import token_required
|
from esi.decorators import token_required
|
||||||
from bravado.exception import HTTPError
|
from allianceauth.eveonline.managers import EveManager
|
||||||
import os
|
from allianceauth.eveonline.models import EveCharacter, EveCorporationInfo
|
||||||
|
|
||||||
|
from .models import CorpStats
|
||||||
|
|
||||||
SWAGGER_SPEC_PATH = os.path.join(os.path.dirname(os.path.abspath(__file__)), 'swagger.json')
|
SWAGGER_SPEC_PATH = os.path.join(os.path.dirname(os.path.abspath(__file__)), 'swagger.json')
|
||||||
|
|
1
allianceauth/eveonline/__init__.py
Normal file
1
allianceauth/eveonline/__init__.py
Normal file
@ -0,0 +1 @@
|
|||||||
|
default_app_config = 'allianceauth.eveonline.apps.EveonlineConfig'
|
@ -1,12 +1,12 @@
|
|||||||
from __future__ import unicode_literals
|
|
||||||
from django.contrib import admin
|
|
||||||
from django import forms
|
from django import forms
|
||||||
|
from django.contrib import admin
|
||||||
from django.core.exceptions import ObjectDoesNotExist
|
from django.core.exceptions import ObjectDoesNotExist
|
||||||
from eveonline.models import EveCharacter
|
from .managers import EveManager
|
||||||
from eveonline.models import EveAllianceInfo
|
from .providers import ObjectNotFound
|
||||||
from eveonline.models import EveCorporationInfo
|
|
||||||
from eveonline.managers import EveManager
|
from .models import EveAllianceInfo
|
||||||
from eveonline.providers import ObjectNotFound
|
from .models import EveCharacter
|
||||||
|
from .models import EveCorporationInfo
|
||||||
|
|
||||||
|
|
||||||
class EveEntityForm(forms.ModelForm):
|
class EveEntityForm(forms.ModelForm):
|
@ -1,7 +1,6 @@
|
|||||||
from __future__ import unicode_literals
|
|
||||||
|
|
||||||
from django.apps import AppConfig
|
from django.apps import AppConfig
|
||||||
|
|
||||||
|
|
||||||
class EveonlineConfig(AppConfig):
|
class EveonlineConfig(AppConfig):
|
||||||
name = 'eveonline'
|
name = 'allianceauth.eveonline'
|
||||||
|
label = 'eveonline'
|
@ -1,10 +1,11 @@
|
|||||||
from __future__ import unicode_literals
|
|
||||||
from eveonline.models import EveCharacter
|
|
||||||
from eveonline.models import EveAllianceInfo
|
|
||||||
from eveonline.models import EveCorporationInfo
|
|
||||||
from eveonline.providers import eve_adapter_factory
|
|
||||||
import logging
|
import logging
|
||||||
|
|
||||||
|
from .providers import eve_adapter_factory
|
||||||
|
|
||||||
|
from .models import EveAllianceInfo
|
||||||
|
from .models import EveCharacter
|
||||||
|
from .models import EveCorporationInfo
|
||||||
|
|
||||||
logger = logging.getLogger(__name__)
|
logger = logging.getLogger(__name__)
|
||||||
|
|
||||||
|
|
@ -1,9 +1,6 @@
|
|||||||
from __future__ import unicode_literals
|
|
||||||
from django.utils.encoding import python_2_unicode_compatible
|
|
||||||
from django.db import models
|
from django.db import models
|
||||||
|
|
||||||
|
|
||||||
@python_2_unicode_compatible
|
|
||||||
class EveCharacter(models.Model):
|
class EveCharacter(models.Model):
|
||||||
character_id = models.CharField(max_length=254, unique=True)
|
character_id = models.CharField(max_length=254, unique=True)
|
||||||
character_name = models.CharField(max_length=254, unique=True)
|
character_name = models.CharField(max_length=254, unique=True)
|
||||||
@ -17,7 +14,6 @@ class EveCharacter(models.Model):
|
|||||||
return self.character_name
|
return self.character_name
|
||||||
|
|
||||||
|
|
||||||
@python_2_unicode_compatible
|
|
||||||
class EveAllianceInfo(models.Model):
|
class EveAllianceInfo(models.Model):
|
||||||
alliance_id = models.CharField(max_length=254, unique=True)
|
alliance_id = models.CharField(max_length=254, unique=True)
|
||||||
alliance_name = models.CharField(max_length=254, unique=True)
|
alliance_name = models.CharField(max_length=254, unique=True)
|
||||||
@ -28,7 +24,6 @@ class EveAllianceInfo(models.Model):
|
|||||||
return self.alliance_name
|
return self.alliance_name
|
||||||
|
|
||||||
|
|
||||||
@python_2_unicode_compatible
|
|
||||||
class EveCorporationInfo(models.Model):
|
class EveCorporationInfo(models.Model):
|
||||||
corporation_id = models.CharField(max_length=254, unique=True)
|
corporation_id = models.CharField(max_length=254, unique=True)
|
||||||
corporation_name = models.CharField(max_length=254, unique=True)
|
corporation_name = models.CharField(max_length=254, unique=True)
|
@ -1,4 +1,3 @@
|
|||||||
from django.utils.encoding import python_2_unicode_compatible
|
|
||||||
from esi.clients import esi_client_factory
|
from esi.clients import esi_client_factory
|
||||||
from django.conf import settings
|
from django.conf import settings
|
||||||
from django.core.cache import cache
|
from django.core.cache import cache
|
||||||
@ -16,7 +15,6 @@ logger = logging.getLogger(__name__)
|
|||||||
OBJ_CACHE_DURATION = int(getattr(settings, 'EVEONLINE_OBJ_CACHE_DURATION', 300))
|
OBJ_CACHE_DURATION = int(getattr(settings, 'EVEONLINE_OBJ_CACHE_DURATION', 300))
|
||||||
|
|
||||||
|
|
||||||
@python_2_unicode_compatible
|
|
||||||
class ObjectNotFound(Exception):
|
class ObjectNotFound(Exception):
|
||||||
def __init__(self, obj_id, type_name):
|
def __init__(self, obj_id, type_name):
|
||||||
self.id = obj_id
|
self.id = obj_id
|
||||||
@ -26,7 +24,6 @@ class ObjectNotFound(Exception):
|
|||||||
return '%s with ID %s not found.' % (self.type, self.id)
|
return '%s with ID %s not found.' % (self.type, self.id)
|
||||||
|
|
||||||
|
|
||||||
@python_2_unicode_compatible
|
|
||||||
class Entity(object):
|
class Entity(object):
|
||||||
def __init__(self, id, name):
|
def __init__(self, id, name):
|
||||||
self.id = id
|
self.id = id
|
||||||
@ -228,7 +225,6 @@ class EveProvider(object):
|
|||||||
raise NotImplemented()
|
raise NotImplemented()
|
||||||
|
|
||||||
|
|
||||||
@python_2_unicode_compatible
|
|
||||||
class EveSwaggerProvider(EveProvider):
|
class EveSwaggerProvider(EveProvider):
|
||||||
def __init__(self, token=None, adapter=None):
|
def __init__(self, token=None, adapter=None):
|
||||||
self.client = esi_client_factory(token=token, spec_file=SWAGGER_SPEC_PATH)
|
self.client = esi_client_factory(token=token, spec_file=SWAGGER_SPEC_PATH)
|
||||||
@ -292,7 +288,6 @@ class EveSwaggerProvider(EveProvider):
|
|||||||
raise ObjectNotFound(type_id, 'type')
|
raise ObjectNotFound(type_id, 'type')
|
||||||
|
|
||||||
|
|
||||||
@python_2_unicode_compatible
|
|
||||||
class EveXmlProvider(EveProvider):
|
class EveXmlProvider(EveProvider):
|
||||||
def __init__(self, api_key=None, adapter=None):
|
def __init__(self, api_key=None, adapter=None):
|
||||||
"""
|
"""
|
@ -1,11 +1,11 @@
|
|||||||
from __future__ import unicode_literals
|
|
||||||
from eveonline.managers import EveManager
|
|
||||||
from eveonline.models import EveCorporationInfo
|
|
||||||
from eveonline.models import EveAllianceInfo
|
|
||||||
from eveonline.models import EveCharacter
|
|
||||||
import logging
|
import logging
|
||||||
|
|
||||||
from alliance_auth.celeryapp import app
|
from .managers import EveManager
|
||||||
|
|
||||||
|
from allianceauth.celeryapp import app
|
||||||
|
from .models import EveAllianceInfo
|
||||||
|
from .models import EveCharacter
|
||||||
|
from .models import EveCorporationInfo
|
||||||
|
|
||||||
logger = logging.getLogger(__name__)
|
logger = logging.getLogger(__name__)
|
||||||
|
|
2
allianceauth/eveonline/views.py
Executable file
2
allianceauth/eveonline/views.py
Executable file
@ -0,0 +1,2 @@
|
|||||||
|
|
||||||
|
|
1
allianceauth/fleetactivitytracking/__init__.py
Normal file
1
allianceauth/fleetactivitytracking/__init__.py
Normal file
@ -0,0 +1 @@
|
|||||||
|
default_app_config = 'allianceauth.fleetactivitytracking.apps.FatConfig'
|
7
allianceauth/fleetactivitytracking/admin.py
Normal file
7
allianceauth/fleetactivitytracking/admin.py
Normal file
@ -0,0 +1,7 @@
|
|||||||
|
|
||||||
|
from django.contrib import admin
|
||||||
|
|
||||||
|
from allianceauth.fleetactivitytracking.models import Fatlink, Fat
|
||||||
|
|
||||||
|
admin.site.register(Fatlink)
|
||||||
|
admin.site.register(Fat)
|
7
allianceauth/fleetactivitytracking/apps.py
Normal file
7
allianceauth/fleetactivitytracking/apps.py
Normal file
@ -0,0 +1,7 @@
|
|||||||
|
|
||||||
|
from django.apps import AppConfig
|
||||||
|
|
||||||
|
|
||||||
|
class FatConfig(AppConfig):
|
||||||
|
name = 'allianceauth.fleetactivitytracking'
|
||||||
|
label = 'fleetactivitytracking'
|
@ -1,6 +1,7 @@
|
|||||||
from services.hooks import MenuItemHook, UrlHook
|
from . import urls
|
||||||
from alliance_auth import hooks
|
|
||||||
from fleetactivitytracking import urls
|
from allianceauth import hooks
|
||||||
|
from allianceauth.services.hooks import MenuItemHook, UrlHook
|
||||||
|
|
||||||
|
|
||||||
@hooks.register('menu_item_hook')
|
@hooks.register('menu_item_hook')
|
@ -1,8 +1,9 @@
|
|||||||
from __future__ import unicode_literals
|
|
||||||
from django import forms
|
from django import forms
|
||||||
from optimer.models import OpTimer
|
|
||||||
from django.utils.translation import ugettext_lazy as _
|
from django.utils.translation import ugettext_lazy as _
|
||||||
|
|
||||||
|
from allianceauth.optimer.models import OpTimer
|
||||||
|
|
||||||
|
|
||||||
class FatlinkForm(forms.Form):
|
class FatlinkForm(forms.Form):
|
||||||
fatname = forms.CharField(label=_('Name of fat-link'), required=True)
|
fatname = forms.CharField(label=_('Name of fat-link'), required=True)
|
@ -3,11 +3,13 @@
|
|||||||
from __future__ import unicode_literals
|
from __future__ import unicode_literals
|
||||||
|
|
||||||
import datetime
|
import datetime
|
||||||
|
|
||||||
|
import django.db.models.deletion
|
||||||
from django.conf import settings
|
from django.conf import settings
|
||||||
from django.db import migrations, models
|
from django.db import migrations, models
|
||||||
import django.db.models.deletion
|
|
||||||
from django.utils.timezone import utc
|
from django.utils.timezone import utc
|
||||||
import fleetactivitytracking.models
|
|
||||||
|
import allianceauth.fleetactivitytracking.models
|
||||||
|
|
||||||
|
|
||||||
class Migration(migrations.Migration):
|
class Migration(migrations.Migration):
|
||||||
@ -39,7 +41,8 @@ class Migration(migrations.Migration):
|
|||||||
('fleet', models.CharField(default=b'', max_length=254)),
|
('fleet', models.CharField(default=b'', max_length=254)),
|
||||||
('name', models.CharField(max_length=254)),
|
('name', models.CharField(max_length=254)),
|
||||||
('hash', models.CharField(max_length=254, unique=True)),
|
('hash', models.CharField(max_length=254, unique=True)),
|
||||||
('creator', models.ForeignKey(on_delete=models.SET(fleetactivitytracking.models.get_sentinel_user), to=settings.AUTH_USER_MODEL)),
|
('creator', models.ForeignKey(on_delete=models.SET(
|
||||||
|
allianceauth.fleetactivitytracking.models.get_sentinel_user), to=settings.AUTH_USER_MODEL)),
|
||||||
],
|
],
|
||||||
),
|
),
|
||||||
migrations.AddField(
|
migrations.AddField(
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
x
Reference in New Issue
Block a user