We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent 3559814 commit 504637dCopy full SHA for 504637d
datashow/views.py
@@ -9,11 +9,15 @@
9
from .table import RowQueryset, get_facets, get_row
10
11
12
-def get_dataset(request, slug: str) -> Dataset:
13
- qs = Dataset.objects.all()
+def get_viewable_datasets(request, queryset):
14
if not request.user.has_perm("datashow.view_dataset"):
15
- qs = qs.filter(public=True)
16
- return get_object_or_404(qs.select_related("default_table"), slug=slug)
+ queryset = queryset.filter(public=True)
+ return queryset
+
17
18
+def get_dataset(request, slug: str) -> Dataset:
19
+ queryset = get_viewable_datasets(request, Dataset.objects.all())
20
+ return get_object_or_404(queryset.select_related("default_table"), slug=slug)
21
22
23
def get_table(dataset: Dataset, table_slug: str) -> Table:
0 commit comments