Create tag for css imports

This commit is contained in:
Edgar P. Burkhart 2023-12-30 10:54:01 +01:00
parent 7f3b9c7b5c
commit 47d8ff0382
Signed by: edpibu
GPG key ID: 9833D3C5A25BD227
9 changed files with 24 additions and 41 deletions

View file

@ -1,5 +1,6 @@
{% load static %}
{% load i18n %}
{% load main_extras %}
<!DOCTYPE html>
<html lang="fr">
<head>
@ -10,8 +11,8 @@
</title>
{% block link %}
<link rel="icon" href="{% static "main/svg/logo.svg" %}" type="image/svg+xml">
<link rel="stylesheet" href="{% static "main/css/main.css" %}" type="text/css">
<link rel="stylesheet" href="{% static "main/remixicon/remixicon.css" %}" type="text/css">
{% css "main/css/main.css" %}
{% css "main/remixicon/remixicon.css" %}
{% endblock %}
</head>
<body>

View file

@ -4,12 +4,8 @@
{% load i18n %}
{% block link %}
{{ block.super }}
<link rel="stylesheet"
href="{% static 'main/css/form.css' %}"
type="text/css" />
<link rel="stylesheet"
href="{% static 'main/css/table.css' %}"
type="text/css" />
{% css "main/css/form.css" %}
{% css "main/css/table.css" %}
{% endblock %}
{% block body %}
{% spaceless %}

View file

@ -12,15 +12,9 @@
{% endblock %}
{% block link %}
{{ block.super }}
<link rel="stylesheet"
href="{% static 'main/css/form.css' %}"
type="text/css" />
<link rel="stylesheet"
href="{% static 'main/css/table.css' %}"
type="text/css" />
<link rel="stylesheet"
href="{% static 'main/css/plot.css' %}"
type="text/css" />
{% css "main/css/form.css" %}
{% css "main/css/table.css" %}
{% css "main/css/plot.css" %}
{% endblock %}
{% block body %}
{% with instance=form.instance %}

View file

@ -4,12 +4,8 @@
{% load i18n %}
{% block link %}
{{ block.super }}
<link rel="stylesheet"
href="{% static 'main/css/table.css' %}"
type="text/css">
<link rel="stylesheet"
href="{% static 'main/css/plot.css' %}"
type="text/css">
{% css "main/css/table.css" %}
{% css "main/css/plot.css" %}
{% endblock %}
{% block body %}
<section>

View file

@ -13,9 +13,7 @@
{% endblock %}
{% block link %}
{{ block.super }}
<link rel="stylesheet"
href="{% static 'main/css/table.css' %}"
type="text/css" />
{% css "main/css/table.css" %}
{% endblock %}
{% block body %}
<h2>

View file

@ -3,12 +3,8 @@
{% load i18n %}
{% block link %}
{{ block.super }}
<link rel="stylesheet"
href="{% static 'main/css/table.css' %}"
type="text/css" />
<link rel="stylesheet"
href="{% static 'main/css/form.css' %}"
type="text/css" />
{% css "main/css/table.css" %}
{% css "main/css/form.css" %}
{% endblock %}
{% block body %}
<h2>{% translate "Log in" %}</h2>

View file

@ -1,4 +1,5 @@
from django import template
from django.templatetags.static import static
from django.utils import formats
from django.utils.safestring import mark_safe
@ -59,3 +60,10 @@ def verbose_name(obj):
@register.filter
def adding(obj):
return obj._state.adding
@register.simple_tag
def css(href):
return mark_safe(
f"""<link rel="stylesheet" href="{static(href)}" type="text/css">"""
)

View file

@ -7,12 +7,8 @@
{% endblock %}
{% block link %}
{{ block.super }}
<link rel="stylesheet"
href="{% static 'main/css/form.css' %}"
type="text/css" />
<link rel="stylesheet"
href="{% static 'main/css/table.css' %}"
type="text/css" />
{% css "main/css/form.css" %}
{% css "main/css/table.css" %}
{% endblock %}
{% block body %}
<h2>{% translate "Search" %}</h2>

View file

@ -2,9 +2,7 @@
{% load i18n static category %}
{% block link %}
{{ block.super }}
<link rel="stylesheet"
href="{% static 'main/css/plot.css' %}"
type="text/css" />
{% css "main/css/plot.css" %}
{% endblock %}
{% block h2 %}{{ month|date:"F Y"|capfirst }}{% endblock %}
{% block table %}