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