diff --git a/apps/gooyal_oauth2/models.py b/apps/gooyal_oauth2/models.py index deed4a4..9ccf728 100644 --- a/apps/gooyal_oauth2/models.py +++ b/apps/gooyal_oauth2/models.py @@ -54,8 +54,10 @@ class Application(AbstractApplication): app_scopes = set(self.allowed_scope.split()) return app_scopes.intersection(all_scopes) - # @property - # def available_scopes(self): + @property + def allowed_scopes_queryset(self): + allowed_scopes = self.allowed_scopes + return Scope.objects.filter(name__in=allowed_scopes).order_by('name') diff --git a/templates/gooyal_oauth2/application_detail.html b/templates/gooyal_oauth2/application_detail.html index 0835c07..1c15954 100644 --- a/templates/gooyal_oauth2/application_detail.html +++ b/templates/gooyal_oauth2/application_detail.html @@ -47,14 +47,15 @@ - {# actions#} + application - {% for scope in object.scopes.all %} + {% for scope in object.allowed_scopes_queryset %} {{ scope.name }} {{ scope.description }} + {{ scope.application }} {% endfor %}