from labirin.core import hooks
from django_efilling.models import Instrument
from django.template import loader


@hooks.register("auth_dashboard_sections")
def instrument_section(request):
    # TODO
    if request.user.is_staff or request.user.is_superuser:
        qs = Instrument.objects.all()[:6]
    else:
        qs = Instrument.objects.get_active()[:6]
    template_name = "efilling/blocks/sisterhub_section.html"
    context = {"request": request, "applications": qs}
    return loader.render_to_string(template_name, request=request, context=context)

from labirin.core import hooks
from django_efilling.models import Instrument
from django.template import loader


@hooks.register("auth_dashboard_sections")
def instrument_section(request):
    # TODO
    if request.user.is_staff or request.user.is_superuser:
        qs = Instrument.objects.all()[:6]
    else:
        qs = Instrument.objects.get_active()[:6]
    template_name = "efilling/blocks/sisterhub_section.html"
    context = {"request": request, "applications": qs}
    return loader.render_to_string(template_name, request=request, context=context)
