Default to only available corpstats if no corp_id

This commit is contained in:
Adarnof 2016-12-13 17:45:42 -05:00
parent 6ba084c710
commit 02bd4570b0

View File

@ -61,10 +61,14 @@ def corpstats_view(request, corp_id=None):
# get available models
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:
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 = {
'available': available,
}