proj/
└── templates
├── base.html
└── news.html
{% load staticfiles %}
<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<title></title>
<link rel="stylesheet" href="{% static main.css %}">
{% block additional_media1 %}{% endblock %}
{% block additional_media2 %}
<link rel="stylesheet" href="{% static else.css %}">
{% endblock %}
</head>
<body>
{% block body1 %}{% endblock %}
{% block body2 %}{% endblock %}
</body>
</html>
{% extends "base.html" %}
{% load staticfiles %}
{% block additional_media1 %}
<link rel="stylesheet" href="{% static news.css %}">
{% endblock %}
{% block additional_media2 %}
{{ block.super }}
<link rel="stylesheet" href="{% static else2.css %}">
{% endblock %}
{% block body1 %}lorem{% endblock %}
{% block body2 %}ipsum{% endblock %}
....
class Media:
js = ('js/my.js', )
css = {'all': ('css/settings_styles.css', )}
import embedded_media as emb
@admin.register(MyModel)
class MyModelAdmin(ReadOnlyAdmin):
...
@property
def media(self):
media = super(MyModelAdmin, self).media
js = (
'/admin/jsi18n/',
'/static/admin/js/calendar.js',
'/static/admin/js/admin/DateTimeShortcuts.js' )
if self.read_only:
css = { 'all': (emb.CSS('.save-box { display: none; }'),) }
media.add_css(css)
media.add_js(js)
return media
<link rel="stylesheet" href="{% static "news/css/styles.css" %}" type="text/css">
не забывайте собрать статику.