fix integration into admin interface
This commit is contained in:
parent
0e444f0502
commit
a3c21c64ed
|
@ -120,6 +120,10 @@ class BasePage(Renderable, models.Model):
|
|||
class Meta:
|
||||
abstract = True
|
||||
|
||||
@property
|
||||
def cover_url(self):
|
||||
return self.cover_id and self.cover.url
|
||||
|
||||
def __str__(self):
|
||||
return "{}".format(self.title or self.pk)
|
||||
|
||||
|
@ -153,7 +157,7 @@ class BasePage(Renderable, models.Model):
|
|||
def display_title(self):
|
||||
if self.is_published:
|
||||
return self.title
|
||||
return self.parent and self.parent.display_title or ""
|
||||
return self.parent and self.parent.title or ""
|
||||
|
||||
@cached_property
|
||||
def display_headline(self):
|
||||
|
|
|
@ -12,9 +12,11 @@
|
|||
<span>{% translate "Today" %}</span>
|
||||
</h1>
|
||||
{% if diffusions %}
|
||||
<div class="card-grid">
|
||||
{% for obj in diffusions %}
|
||||
{% page_widget "item" obj.episode diffusion=obj timetable=True admin=True tag_class="tiny" %}
|
||||
{% page_widget "card" obj.episode diffusion=obj timetable=True admin=True tag_class="small" %}
|
||||
{% endfor %}
|
||||
</div>
|
||||
{% else %}
|
||||
<div class="block has-text-centered">
|
||||
{% trans "No diffusion is scheduled for today." %}
|
||||
|
@ -28,8 +30,8 @@
|
|||
<span>{% translate "Latest comments" %}</span>
|
||||
</h1>
|
||||
{% if comments %}
|
||||
{% for object in comments %}
|
||||
{% page_widget "preview" object with_title=True %}
|
||||
{% for object in comments|slice:":5" %}
|
||||
{% page_widget "item" object with_title=True %}
|
||||
{% endfor %}
|
||||
<div class="has-text-centered">
|
||||
<a href="{% url "admin:aircox_comment_changelist" %}" class="float-center">{% translate "All comments" %}</a>
|
||||
|
|
|
@ -5,11 +5,13 @@
|
|||
|
||||
{% block outer %}
|
||||
{% if with_title %}
|
||||
{% with url=object.parent.get_absolute_url %}
|
||||
{% with url=object.get_absolute_url %}
|
||||
{{ block.super }}
|
||||
{{ block.super }}
|
||||
{% endwith %}
|
||||
{% else %}
|
||||
{{ block.super }}
|
||||
{{ block.super }}
|
||||
{% endif %}
|
||||
{% endblock %}
|
||||
|
||||
|
|
|
@ -1,12 +1,18 @@
|
|||
{% extends widget_template %}
|
||||
{% load i18n %}
|
||||
{% load i18n aircox %}
|
||||
|
||||
|
||||
{% block outer %}
|
||||
{% with url|default:object.get_absolute_url as url %}
|
||||
{% with cover|default:object.cover.url as cover %}
|
||||
{{ block.super }}
|
||||
{% endwith %}
|
||||
{% with cover|default:object.cover_url as cover %}
|
||||
{% if admin %}
|
||||
{% with object|admin_url:"change" as url %}
|
||||
{{ block.super }}
|
||||
{% endwith %}
|
||||
{% else %}
|
||||
{% with url|default:object.get_absolute_url as url %}
|
||||
{{ block.super }}
|
||||
{% endwith %}
|
||||
{% endif %}
|
||||
{% endwith %}
|
||||
{% endblock %}
|
||||
|
||||
|
|
Loading…
Reference in New Issue
Block a user