87 lines
2.4 KiB
HTML
87 lines
2.4 KiB
HTML
{% extends "admin/base_site.html" %}
|
|
{% block content %}
|
|
<div class="container p-4">
|
|
<!-- Add News/Event Button -->
|
|
<div class="mb-4">
|
|
<a href="{% url 'admin:app_newsevent_add' %}" class="btn btn-primary">Add New News/Event</a>
|
|
</div>
|
|
|
|
<!-- News/Event List Table -->
|
|
<table class="table table-striped text-center">
|
|
<thead class="thead-dark">
|
|
<tr>
|
|
<th>S.N</th>
|
|
<th>Title</th>
|
|
<th>Summary</th>
|
|
<th>Type</th>
|
|
<th>Created At</th>
|
|
<th>Actions</th>
|
|
</tr>
|
|
</thead>
|
|
<tbody>
|
|
{% for item in news_events %}
|
|
<tr>
|
|
<td>{{ forloop.counter }}</td>
|
|
<td>{{ item.title }}</td>
|
|
<td>{{ item.summary|truncatewords:20 }}</td>
|
|
<td>{{ item.get_type_display }}</td>
|
|
<td>{{ item.created_at|date:"Y-m-d H:i" }}</td>
|
|
<td>
|
|
<!-- Edit and Delete Actions -->
|
|
<a href="{% url 'admin:app_newsevent_change' item.id %}" class="btn btn-warning btn-sm">Edit</a>
|
|
<a href="{% url 'admin:app_newsevent_delete' item.id %}" class="btn btn-danger btn-sm">Delete</a>
|
|
</td>
|
|
</tr>
|
|
{% empty %}
|
|
<tr>
|
|
<td colspan="6" class="text-center">No news or events found.</td>
|
|
</tr>
|
|
{% endfor %}
|
|
</tbody>
|
|
</table>
|
|
</div>
|
|
|
|
<style>
|
|
.btn {
|
|
padding: 6px 12px;
|
|
margin: 0 4px;
|
|
border: none;
|
|
border-radius: 4px;
|
|
cursor: pointer;
|
|
}
|
|
.btn-primary {
|
|
background-color: #007bff;
|
|
color: white;
|
|
}
|
|
.btn-warning {
|
|
background-color: #ffc107;
|
|
color: black;
|
|
}
|
|
.btn-danger {
|
|
background-color: #dc3545;
|
|
color: white;
|
|
}
|
|
.btn:hover {
|
|
opacity: 0.8;
|
|
}
|
|
.table {
|
|
width: 100%;
|
|
border-collapse: collapse;
|
|
margin-bottom: 1rem;
|
|
background-color: white;
|
|
}
|
|
.table th,
|
|
.table td {
|
|
padding: 12px;
|
|
border: 1px solid #dee2e6;
|
|
}
|
|
.table thead th {
|
|
background-color: #f8f9fa;
|
|
border-bottom: 2px solid #dee2e6;
|
|
}
|
|
.container {
|
|
padding: 20px;
|
|
}
|
|
</style>
|
|
{% endblock %}
|