mirror of
https://gitlab.com/allianceauth/allianceauth.git
synced 2025-07-11 21:40:17 +02:00
Add sorting to characters and groups and remove auto groups
This commit is contained in:
parent
efd2a5e8c5
commit
81af610c11
@ -94,12 +94,12 @@
|
|||||||
<div class="col-sm-6 text-center">
|
<div class="col-sm-6 text-center">
|
||||||
<div class="panel panel-success" style="height:100%">
|
<div class="panel panel-success" style="height:100%">
|
||||||
<div class="panel-heading">
|
<div class="panel-heading">
|
||||||
<h3 class="panel-title">{% trans "Groups" %}</h3>
|
<h3 class="panel-title">{% trans "Group Memberships" %}</h3>
|
||||||
</div>
|
</div>
|
||||||
<div class="panel-body">
|
<div class="panel-body">
|
||||||
<div style="height: 240px;overflow:-moz-scrollbars-vertical;overflow-y:auto;">
|
<div style="height: 240px;overflow:-moz-scrollbars-vertical;overflow-y:auto;">
|
||||||
<table class="table table-aa">
|
<table class="table table-aa">
|
||||||
{% for group in user.groups.all %}
|
{% for group in groups %}
|
||||||
<tr>
|
<tr>
|
||||||
<td>{{ group.name }}</td>
|
<td>{{ group.name }}</td>
|
||||||
</tr>
|
</tr>
|
||||||
@ -128,16 +128,14 @@
|
|||||||
</tr>
|
</tr>
|
||||||
</thead>
|
</thead>
|
||||||
<tbody>
|
<tbody>
|
||||||
{% for ownership in request.user.character_ownerships.all %}
|
{% for char in characters %}
|
||||||
{% with ownership.character as char %}
|
<tr>
|
||||||
<tr>
|
<td class="text-center"><img class="ra-avatar img-circle" src="{{ char.portrait_url_32 }}">
|
||||||
<td class="text-center"><img class="ra-avatar img-circle" src="{{ char.portrait_url_32 }}">
|
</td>
|
||||||
</td>
|
<td class="text-center">{{ char.character_name }}</td>
|
||||||
<td class="text-center">{{ char.character_name }}</td>
|
<td class="text-center">{{ char.corporation_name }}</td>
|
||||||
<td class="text-center">{{ char.corporation_name }}</td>
|
<td class="text-center">{{ char.alliance_name }}</td>
|
||||||
<td class="text-center">{{ char.alliance_name }}</td>
|
</tr>
|
||||||
</tr>
|
|
||||||
{% endwith %}
|
|
||||||
{% endfor %}
|
{% endfor %}
|
||||||
</tbody>
|
</tbody>
|
||||||
</table>
|
</table>
|
||||||
|
@ -7,11 +7,28 @@ from . import views
|
|||||||
app_name = 'authentication'
|
app_name = 'authentication'
|
||||||
|
|
||||||
urlpatterns = [
|
urlpatterns = [
|
||||||
url(r'^$', login_required(TemplateView.as_view(template_name='authentication/dashboard.html')),),
|
url(r'^$', views.index, name='index'),
|
||||||
url(r'^account/login/$', TemplateView.as_view(template_name='public/login.html'), name='login'),
|
url(
|
||||||
url(r'^account/characters/main/$', views.main_character_change, name='change_main_character'),
|
r'^account/login/$',
|
||||||
url(r'^account/characters/add/$', views.add_character, name='add_character'),
|
TemplateView.as_view(template_name='public/login.html'),
|
||||||
url(r'^help/$', login_required(TemplateView.as_view(template_name='allianceauth/help.html')), name='help'),
|
name='login'
|
||||||
url(r'^dashboard/$',
|
),
|
||||||
login_required(TemplateView.as_view(template_name='authentication/dashboard.html')), name='dashboard'),
|
url(
|
||||||
|
r'^account/characters/main/$',
|
||||||
|
views.main_character_change,
|
||||||
|
name='change_main_character'
|
||||||
|
),
|
||||||
|
url(
|
||||||
|
r'^account/characters/add/$',
|
||||||
|
views.add_character,
|
||||||
|
name='add_character'
|
||||||
|
),
|
||||||
|
url(
|
||||||
|
r'^help/$',
|
||||||
|
login_required(
|
||||||
|
TemplateView.as_view(template_name='allianceauth/help.html')
|
||||||
|
),
|
||||||
|
name='help'
|
||||||
|
),
|
||||||
|
url(r'^dashboard/$', views.dashboard, name='dashboard'),
|
||||||
]
|
]
|
||||||
|
@ -7,20 +7,58 @@ from django.contrib.auth.decorators import login_required
|
|||||||
from django.contrib.auth.models import User
|
from django.contrib.auth.models import User
|
||||||
from django.core import signing
|
from django.core import signing
|
||||||
from django.urls import reverse
|
from django.urls import reverse
|
||||||
from django.shortcuts import redirect
|
from django.shortcuts import redirect, render
|
||||||
from django.utils.translation import ugettext_lazy as _
|
from django.utils.translation import ugettext_lazy as _
|
||||||
|
|
||||||
|
from allianceauth.eveonline.models import EveCharacter
|
||||||
from esi.decorators import token_required
|
from esi.decorators import token_required
|
||||||
from esi.models import Token
|
from esi.models import Token
|
||||||
from registration.backends.hmac.views import RegistrationView as BaseRegistrationView, \
|
|
||||||
ActivationView as BaseActivationView, REGISTRATION_SALT
|
from registration.backends.hmac.views import (
|
||||||
|
RegistrationView as BaseRegistrationView,
|
||||||
|
ActivationView as BaseActivationView,
|
||||||
|
REGISTRATION_SALT
|
||||||
|
)
|
||||||
from registration.signals import user_registered
|
from registration.signals import user_registered
|
||||||
|
|
||||||
from .models import CharacterOwnership
|
from .models import CharacterOwnership
|
||||||
from .forms import RegistrationForm
|
from .forms import RegistrationForm
|
||||||
|
|
||||||
|
if 'allianceauth.eveonline.autogroups' in settings.INSTALLED_APPS:
|
||||||
|
_has_auto_groups = True
|
||||||
|
from allianceauth.eveonline.autogroups.models import *
|
||||||
|
else:
|
||||||
|
_has_auto_groups = False
|
||||||
|
|
||||||
|
|
||||||
logger = logging.getLogger(__name__)
|
logger = logging.getLogger(__name__)
|
||||||
|
|
||||||
|
|
||||||
|
@login_required
|
||||||
|
def index(request):
|
||||||
|
return redirect('authentication:dashboard')
|
||||||
|
|
||||||
|
|
||||||
|
@login_required
|
||||||
|
def dashboard(request):
|
||||||
|
groups = request.user.groups.all()
|
||||||
|
if _has_auto_groups:
|
||||||
|
groups = groups\
|
||||||
|
.filter(managedalliancegroup__isnull=True)\
|
||||||
|
.filter(managedcorpgroup__isnull=True)
|
||||||
|
groups = groups.order_by('name')
|
||||||
|
characters = EveCharacter.objects\
|
||||||
|
.filter(character_ownership__user=request.user)\
|
||||||
|
.select_related()\
|
||||||
|
.order_by('character_name')
|
||||||
|
|
||||||
|
context = {
|
||||||
|
'groups': groups,
|
||||||
|
'characters': characters
|
||||||
|
}
|
||||||
|
return render(request, 'authentication/dashboard.html', context)
|
||||||
|
|
||||||
|
|
||||||
@login_required
|
@login_required
|
||||||
@token_required(scopes=settings.LOGIN_TOKEN_SCOPES)
|
@token_required(scopes=settings.LOGIN_TOKEN_SCOPES)
|
||||||
def main_character_change(request, token):
|
def main_character_change(request, token):
|
||||||
|
Loading…
x
Reference in New Issue
Block a user