Commit 6624138a authored by Guilhem Saurel's avatar Guilhem Saurel
Browse files

style

parent 337bbb4c
Pipeline #2122 passed with stages
in 42 seconds
from django.utils.safestring import mark_safe
from django.urls import reverse
from django.utils.safestring import mark_safe
import django_tables2 as tables
......@@ -33,7 +33,8 @@ class ProjectTable(StrippedTable):
class Meta:
model = models.Project
fields = ('main_namespace', 'name', 'public', 'from_gepetto', 'archived', 'license', 'homepage', 'updated', 'version')
fields = ('main_namespace', 'name', 'public', 'from_gepetto', 'archived', 'license', 'homepage', 'updated',
'version')
def render_name(self, record):
return record.get_link()
......@@ -87,7 +88,7 @@ class BranchTable(StrippedTable):
# TODO: this works, but we have to hide the pinned from the main dataset
# def get_top_pinned_data(self):
# return self.data.data.filter(name__in=models.MAIN_BRANCHES)
# return self.data.data.filter(name__in=models.MAIN_BRANCHES)
class ImageTable(StrippedTable):
......
......@@ -99,8 +99,10 @@ def json_doc(request):
"""
Get the list of project / namespace / branch of which we want to keep the doc
"""
return JsonResponse({'ret': [(b.project.slug, b.repo.namespace.slug, b.name.split('/', maxsplit=2)[2])
for b in models.Branch.objects.filter(keep_doc=True)]})
return JsonResponse({
'ret': [(b.project.slug, b.repo.namespace.slug, b.name.split('/', maxsplit=2)[2])
for b in models.Branch.objects.filter(keep_doc=True)]
})
def docker(request):
......@@ -117,8 +119,9 @@ def graph_svg(request):
print('digraph { rankdir=LR;', file=f)
for project in models.Project.objects.filter(from_gepetto=True, archived=False):
print(f'{{I{project.pk} [label="{project}" URL="{project.get_absolute_url()}"];}}', file=f)
for dep in models.Dependency.objects.filter(project__from_gepetto=True, library__from_gepetto=True,
project__archived=False, library__archived=False):
for dep in models.Dependency.objects.filter(
project__from_gepetto=True, library__from_gepetto=True, project__archived=False,
library__archived=False):
print(f'I{dep.library.pk} -> I{dep.project.pk};', file=f)
print('}', file=f)
svg = run(['dot', '/tmp/graph', '-Tsvg'], stdout=PIPE).stdout.decode()
......@@ -126,7 +129,7 @@ def graph_svg(request):
class AuthenticatedOrReadOnlyModelViewSet(viewsets.ModelViewSet):
permission_classes = (permissions.IsAuthenticatedOrReadOnly,)
permission_classes = (permissions.IsAuthenticatedOrReadOnly, )
class NamespaceViewSet(AuthenticatedOrReadOnlyModelViewSet):
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment