allowed_scopes_queryset

This commit is contained in:
sahama 2024-08-08 00:28:01 +03:30
parent c32d9b75c2
commit 125c123010
2 changed files with 7 additions and 4 deletions

View file

@ -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')

View file

@ -47,14 +47,15 @@
</div>
</div>
</th>
{# <th>actions</th>#}
<th>application</th>
</tr>
</thead>
<tbody>
{% for scope in object.scopes.all %}
{% for scope in object.allowed_scopes_queryset %}
<tr>
<td>{{ scope.name }}</td>
<td>{{ scope.description }}</td>
<td>{{ scope.application }}</td>
</tr>
{% endfor %}
</tbody>