mirror of
https://gitlab.com/allianceauth/allianceauth.git
synced 2025-07-13 06:20:16 +02:00
Default to only available corpstats if no corp_id
This commit is contained in:
parent
6ba084c710
commit
02bd4570b0
@ -61,10 +61,14 @@ def corpstats_view(request, corp_id=None):
|
|||||||
# get available models
|
# get available models
|
||||||
available = CorpStats.objects.visible_to(request.user)
|
available = CorpStats.objects.visible_to(request.user)
|
||||||
|
|
||||||
# ensure we can see this one
|
# ensure we can see the requested model
|
||||||
if corpstats and not corpstats in available:
|
if corpstats and not corpstats in available:
|
||||||
raise PermissionDenied('You do not have permission to view the selected corporation statistics module.')
|
raise PermissionDenied('You do not have permission to view the selected corporation statistics module.')
|
||||||
|
|
||||||
|
# get default model if none requested
|
||||||
|
if not corp_id and available.count() == 1:
|
||||||
|
corpstats = available[0]
|
||||||
|
|
||||||
context = {
|
context = {
|
||||||
'available': available,
|
'available': available,
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user