Use templates for rendering
This commit is contained in:
parent
ac01862a17
commit
603090205a
6 changed files with 248 additions and 72 deletions
34
templates/feeds/entry_detail.html
Normal file
34
templates/feeds/entry_detail.html
Normal file
|
|
@ -0,0 +1,34 @@
|
|||
{% extends "base.html" %}
|
||||
{% block content %}
|
||||
<h1>Entry Detail</h1>
|
||||
<p>
|
||||
<b>Feed:</b> <a href="{% url 'details' feed.pk %}">{{ feed.url }}</a>
|
||||
</p>
|
||||
<p>
|
||||
<b>Entry ID:</b> {{ entry.entry_id }}
|
||||
</p>
|
||||
<p>
|
||||
<b>Published:</b> {{ entry.published_at }}
|
||||
</p>
|
||||
<p>
|
||||
<b>Fetched:</b> {{ entry.fetched_at }}
|
||||
</p>
|
||||
<p>
|
||||
<b>Content Hash:</b> {{ entry.content_hash }}
|
||||
</p>
|
||||
<p>
|
||||
<b>Error Message:</b> {{ entry.error_message|default:"[none]" }}
|
||||
</p>
|
||||
<h2>Entry Data</h2>
|
||||
{% if escaped_json %}
|
||||
<div style="font-size:small;color:#666;margin-bottom:4px;">
|
||||
Note: HTML in the JSON is escaped for display and will not be rendered as HTML.
|
||||
</div>
|
||||
<pre>{{ escaped_json|safe }}</pre>
|
||||
{% else %}
|
||||
<p>[No data]</p>
|
||||
{% endif %}
|
||||
<p>
|
||||
<a href="{% url 'details' feed.pk %}">Back to feed</a>
|
||||
</p>
|
||||
{% endblock content %}
|
||||
49
templates/feeds/feed_detail.html
Normal file
49
templates/feeds/feed_detail.html
Normal file
|
|
@ -0,0 +1,49 @@
|
|||
{% extends "base.html" %}
|
||||
{% block content %}
|
||||
<h1>Feed Detail</h1>
|
||||
<p>
|
||||
<b>URL:</b> {{ feed.url }}
|
||||
</p>
|
||||
<p>
|
||||
<b>Domain:</b> {{ feed.domain }}
|
||||
</p>
|
||||
<p>
|
||||
<b>Active:</b> {{ feed.is_active|yesno:"yes,no" }}
|
||||
</p>
|
||||
<p>
|
||||
<b>Created:</b> {{ feed.created_at }}
|
||||
</p>
|
||||
<p>
|
||||
<b>Last fetched:</b> {{ feed.last_fetched_at }}
|
||||
</p>
|
||||
<h2>Entries (latest 50)</h2>
|
||||
<table>
|
||||
<thead>
|
||||
<tr>
|
||||
<th>Title/Description</th>
|
||||
<th>Entry ID</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
{% for entry in entries %}
|
||||
<tr>
|
||||
<td>
|
||||
<a href="{% url 'entry-detail' feed.pk entry.pk %}">
|
||||
{{ entry.data.title|default:entry.data.description|default:"[no title]" }}
|
||||
</a>
|
||||
<br />
|
||||
<small>{{ entry.published_at|default:entry.fetched_at }}</small>
|
||||
</td>
|
||||
<td>
|
||||
<small>
|
||||
<a href="{{ entry.entry_id }}">{{ entry.entry_id|cut:'https://'|truncatechars:50 }}</a>
|
||||
</small>
|
||||
</td>
|
||||
</tr>
|
||||
{% endfor %}
|
||||
</tbody>
|
||||
</table>
|
||||
<p>
|
||||
<a href="{% url 'feeds' %}">Back to list</a>
|
||||
</p>
|
||||
{% endblock content %}
|
||||
|
|
@ -4,7 +4,7 @@
|
|||
<ul>
|
||||
{% for feed in feeds %}
|
||||
<li>
|
||||
<a href="{% url 'feed-detail' feed.pk %}">{{ feed.url }}</a>
|
||||
<a href="{% url 'details' feed.pk %}">{{ feed.url }}</a>
|
||||
</li>
|
||||
{% endfor %}
|
||||
</ul>
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue