mirror of
https://gitlab.com/allianceauth/allianceauth.git
synced 2026-02-06 15:16:20 +01:00
Bulk of the profile work is done.
This commit is contained in:
@@ -1,11 +1,11 @@
|
||||
from __future__ import unicode_literals
|
||||
from django import forms
|
||||
from optimer.models import optimer
|
||||
from optimer.models import OpTimer
|
||||
from django.utils.translation import ugettext_lazy as _
|
||||
|
||||
|
||||
def get_fleet_list():
|
||||
fleets = optimer.objects.all()
|
||||
fleets = OpTimer.objects.all()
|
||||
fleetlist = [("None", "None")]
|
||||
for fleet in fleets:
|
||||
fleetlist.append((fleet.operation_name, fleet.operation_name))
|
||||
@@ -17,4 +17,4 @@ class FatlinkForm(forms.Form):
|
||||
fatname = forms.CharField(label=_('Name of fat-link'), required=True)
|
||||
duration = forms.IntegerField(label=_("Duration of fat-link"), required=True, initial=30, min_value=1,
|
||||
max_value=2147483647)
|
||||
fleet = forms.ModelChoiceField(label=_("Fleet"), queryset=optimer.objects.all().order_by('operation_name'))
|
||||
fleet = forms.ModelChoiceField(label=_("Fleet"), queryset=OpTimer.objects.all().order_by('operation_name'))
|
||||
|
||||
20
fleetactivitytracking/migrations/0004_auto_20170322_2335.py
Normal file
20
fleetactivitytracking/migrations/0004_auto_20170322_2335.py
Normal file
@@ -0,0 +1,20 @@
|
||||
# -*- coding: utf-8 -*-
|
||||
# Generated by Django 1.10.5 on 2017-03-22 23:35
|
||||
from __future__ import unicode_literals
|
||||
|
||||
from django.db import migrations, models
|
||||
|
||||
|
||||
class Migration(migrations.Migration):
|
||||
|
||||
dependencies = [
|
||||
('fleetactivitytracking', '0003_auto_20160906_2354'),
|
||||
]
|
||||
|
||||
operations = [
|
||||
migrations.AlterField(
|
||||
model_name='fatlink',
|
||||
name='fleet',
|
||||
field=models.CharField(default='', max_length=254),
|
||||
),
|
||||
]
|
||||
@@ -1,4 +1,4 @@
|
||||
{% extends 'public/base.html' %}
|
||||
{% extends 'registered/base.html' %}
|
||||
{% load i18n %}
|
||||
{% block title %}Fleet Participation{% endblock %}
|
||||
{% block page_title %}{% trans "Fleet Participation" %}{% endblock %}
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
{% extends "public/base.html" %}
|
||||
{% extends "registered/base.html" %}
|
||||
{% load bootstrap %}
|
||||
{% load staticfiles %}
|
||||
{% load i18n %}
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
{% extends "public/base.html" %}
|
||||
{% extends "registered/base.html" %}
|
||||
{% load bootstrap %}
|
||||
{% load staticfiles %}
|
||||
{% load i18n %}
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
{% extends "public/base.html" %}
|
||||
{% extends "registered/base.html" %}
|
||||
{% load bootstrap %}
|
||||
{% load staticfiles %}
|
||||
{% load i18n %}
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
{% extends "public/base.html" %}
|
||||
{% extends "registered/base.html" %}
|
||||
{% load bootstrap %}
|
||||
{% load staticfiles %}
|
||||
{% load i18n %}
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
{% extends "public/base.html" %}
|
||||
{% extends "registered/base.html" %}
|
||||
{% load bootstrap %}
|
||||
{% load staticfiles %}
|
||||
{% load i18n %}
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
{% extends "public/base.html" %}
|
||||
{% extends "registered/base.html" %}
|
||||
{% load bootstrap %}
|
||||
{% load staticfiles %}
|
||||
{% load i18n %}
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
from __future__ import unicode_literals
|
||||
from django.conf import settings
|
||||
from django.shortcuts import render, redirect
|
||||
from django.shortcuts import render, redirect, get_object_or_404
|
||||
from django.core.exceptions import ObjectDoesNotExist
|
||||
from django.contrib.auth.decorators import login_required
|
||||
from django.contrib.auth.decorators import permission_required
|
||||
@@ -197,58 +197,53 @@ def fatlink_monthly_personal_statistics_view(request, year, month, char_id=None)
|
||||
@token_required(
|
||||
scopes=['esi-location.read_location.v1', 'esi-location.read_ship_type.v1', 'esi-universe.read_structures.v1'])
|
||||
def click_fatlink_view(request, token, hash, fatname):
|
||||
try:
|
||||
fatlink = Fatlink.objects.filter(hash=hash)[0]
|
||||
fatlink = get_object_or_404(Fatlink, hash=hash, name=fatname)
|
||||
|
||||
if (timezone.now() - fatlink.fatdatetime) < datetime.timedelta(seconds=(fatlink.duration * 60)):
|
||||
if (timezone.now() - fatlink.fatdatetime) < datetime.timedelta(seconds=(fatlink.duration * 60)):
|
||||
|
||||
character = EveManager.get_character_by_id(token.character_id)
|
||||
character = EveManager.get_character_by_id(token.character_id)
|
||||
|
||||
if character:
|
||||
# get data
|
||||
c = token.get_esi_client(Location='v1', Universe='v2')
|
||||
location = c.Location.get_characters_character_id_location(character_id=token.character_id).result()
|
||||
ship = c.Location.get_characters_character_id_ship(character_id=token.character_id).result()
|
||||
location['solar_system_name'] = \
|
||||
c.Universe.get_universe_systems_system_id(system_id=location['solar_system_id']).result()[
|
||||
if character:
|
||||
# get data
|
||||
c = token.get_esi_client(Location='v1', Universe='v2')
|
||||
location = c.Location.get_characters_character_id_location(character_id=token.character_id).result()
|
||||
ship = c.Location.get_characters_character_id_ship(character_id=token.character_id).result()
|
||||
location['solar_system_name'] = \
|
||||
c.Universe.get_universe_systems_system_id(system_id=location['solar_system_id']).result()[
|
||||
'name']
|
||||
if location['structure_id']:
|
||||
location['station_name'] = \
|
||||
c.Universe.get_universe_structures_structure_id(structure_id=location['structure_id']).result()[
|
||||
'name']
|
||||
if location['structure_id']:
|
||||
location['station_name'] = \
|
||||
c.Universe.get_universe_structures_structure_id(structure_id=location['structure_id']).result()[
|
||||
'name']
|
||||
elif location['station_id']:
|
||||
location['station_name'] = \
|
||||
c.Universe.get_universe_stations_station_id(station_id=location['station_id']).result()['name']
|
||||
else:
|
||||
location['station_name'] = "No Station"
|
||||
ship['ship_type_name'] = EveManager.get_itemtype(ship['ship_type_id']).name
|
||||
|
||||
fat = Fat()
|
||||
fat.system = location['solar_system_name']
|
||||
fat.station = location['station_name']
|
||||
fat.shiptype = ship['ship_type_name']
|
||||
fat.fatlink = fatlink
|
||||
fat.character = character
|
||||
fat.user = character.user
|
||||
try:
|
||||
fat.full_clean()
|
||||
fat.save()
|
||||
messages.success(request, _('Fleet participation registered.'))
|
||||
except ValidationError as e:
|
||||
err_messages = []
|
||||
for errorname, message in e.message_dict.items():
|
||||
err_messages.append(message[0].decode())
|
||||
messages.error(request, ' '.join(err_messages))
|
||||
elif location['station_id']:
|
||||
location['station_name'] = \
|
||||
c.Universe.get_universe_stations_station_id(station_id=location['station_id']).result()['name']
|
||||
else:
|
||||
context = {'character_id': token.character_id,
|
||||
'character_name': token.character_name}
|
||||
return render(request, 'fleetactivitytracking/characternotexisting.html', context=context)
|
||||
location['station_name'] = "No Station"
|
||||
ship['ship_type_name'] = EveManager.get_itemtype(ship['ship_type_id']).name
|
||||
|
||||
fat = Fat()
|
||||
fat.system = location['solar_system_name']
|
||||
fat.station = location['station_name']
|
||||
fat.shiptype = ship['ship_type_name']
|
||||
fat.fatlink = fatlink
|
||||
fat.character = character
|
||||
fat.user = character.user
|
||||
try:
|
||||
fat.full_clean()
|
||||
fat.save()
|
||||
messages.success(request, _('Fleet participation registered.'))
|
||||
except ValidationError as e:
|
||||
err_messages = []
|
||||
for errorname, message in e.message_dict.items():
|
||||
err_messages.append(message[0].decode())
|
||||
messages.error(request, ' '.join(err_messages))
|
||||
else:
|
||||
messages.error(request, _('FAT link has expired.'))
|
||||
except (ObjectDoesNotExist, KeyError):
|
||||
logger.exception("Failed to process FAT link.")
|
||||
messages.error(request, _('Invalid FAT link.'))
|
||||
return redirect('auth_fatlink_view')
|
||||
context = {'character_id': token.character_id,
|
||||
'character_name': token.character_name}
|
||||
return render(request, 'fleetactivitytracking/characternotexisting.html', context=context)
|
||||
else:
|
||||
messages.error(request, _('FAT link has expired.'))
|
||||
|
||||
|
||||
@login_required
|
||||
|
||||
Reference in New Issue
Block a user