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()) app_scopes = set(self.allowed_scope.split())
return app_scopes.intersection(all_scopes) return app_scopes.intersection(all_scopes)
# @property @property
# def available_scopes(self): 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>
</div> </div>
</th> </th>
{# <th>actions</th>#} <th>application</th>
</tr> </tr>
</thead> </thead>
<tbody> <tbody>
{% for scope in object.scopes.all %} {% for scope in object.allowed_scopes_queryset %}
<tr> <tr>
<td>{{ scope.name }}</td> <td>{{ scope.name }}</td>
<td>{{ scope.description }}</td> <td>{{ scope.description }}</td>
<td>{{ scope.application }}</td>
</tr> </tr>
{% endfor %} {% endfor %}
</tbody> </tbody>