Browse Source

make overview link list include all domains, not just current one

main
xenua 2 years ago
parent
commit
d12a18d89c
Signed by: xenua
GPG Key ID: 8F93B68BD37255B8
  1. 18
      leftists/views.py

18
leftists/views.py

@ -3,6 +3,7 @@ from django.contrib.auth.views import LoginView
from django.shortcuts import get_object_or_404 from django.shortcuts import get_object_or_404
from django.urls import reverse_lazy from django.urls import reverse_lazy
from django.views.generic import RedirectView, TemplateView, CreateView, UpdateView, DeleteView from django.views.generic import RedirectView, TemplateView, CreateView, UpdateView, DeleteView
from django_scopes import scopes_disabled
from scopedsites.models import Domain from scopedsites.models import Domain
from leftists.forms import LinkForm from leftists.forms import LinkForm
@ -25,14 +26,15 @@ class OverView(LoginRequiredMixin, TemplateView):
template_name = 'interface/overview.html' template_name = 'interface/overview.html'
def get_context_data(self, **kwargs): def get_context_data(self, **kwargs):
ctx = super().get_context_data(**kwargs) with scopes_disabled():
ds = Domain.objects.all() ctx = super().get_context_data(**kwargs)
ctx.setdefault('domains', ds) ds = Domain.objects.all()
links = [] ctx.setdefault('domains', ds)
for d in ds: links = []
[links.append(l) for l in d.links.all()] for d in ds:
ctx.setdefault('links', links) [links.append(l) for l in d.links.all()]
return ctx ctx.setdefault('links', links)
return ctx
class LinkCreateView(LoginRequiredMixin, CreateView): class LinkCreateView(LoginRequiredMixin, CreateView):

Loading…
Cancel
Save