update
parent
7893cbcb6f
commit
3387056120
@ -0,0 +1,25 @@
|
|||||||
|
# Generated by Django 4.1.4 on 2023-01-06 00:06
|
||||||
|
|
||||||
|
from django.db import migrations, models
|
||||||
|
|
||||||
|
|
||||||
|
class Migration(migrations.Migration):
|
||||||
|
|
||||||
|
dependencies = [
|
||||||
|
('mensaviewer', '0015_comment_timestamp'),
|
||||||
|
]
|
||||||
|
|
||||||
|
operations = [
|
||||||
|
migrations.RemoveField(
|
||||||
|
model_name='menu',
|
||||||
|
name='days',
|
||||||
|
),
|
||||||
|
migrations.DeleteModel(
|
||||||
|
name='Day',
|
||||||
|
),
|
||||||
|
migrations.AddField(
|
||||||
|
model_name='menu',
|
||||||
|
name='days',
|
||||||
|
field=models.JSONField(blank=True, null=True),
|
||||||
|
),
|
||||||
|
]
|
@ -0,0 +1,37 @@
|
|||||||
|
# Generated by Django 4.1.4 on 2023-01-06 22:11
|
||||||
|
|
||||||
|
from django.db import migrations, models
|
||||||
|
import django.db.models.deletion
|
||||||
|
|
||||||
|
|
||||||
|
class Migration(migrations.Migration):
|
||||||
|
|
||||||
|
dependencies = [
|
||||||
|
('mensaviewer', '0016_remove_menu_days_delete_day_menu_days'),
|
||||||
|
]
|
||||||
|
|
||||||
|
operations = [
|
||||||
|
migrations.RemoveField(
|
||||||
|
model_name='menu',
|
||||||
|
name='days',
|
||||||
|
),
|
||||||
|
migrations.RemoveField(
|
||||||
|
model_name='menu',
|
||||||
|
name='locations',
|
||||||
|
),
|
||||||
|
migrations.AddField(
|
||||||
|
model_name='location',
|
||||||
|
name='city',
|
||||||
|
field=models.CharField(blank=True, max_length=144, null=True),
|
||||||
|
),
|
||||||
|
migrations.AddField(
|
||||||
|
model_name='menu',
|
||||||
|
name='day',
|
||||||
|
field=models.DateField(blank=True, null=True),
|
||||||
|
),
|
||||||
|
migrations.AddField(
|
||||||
|
model_name='menu',
|
||||||
|
name='location',
|
||||||
|
field=models.ForeignKey(blank=True, null=True, on_delete=django.db.models.deletion.CASCADE, to='mensaviewer.location'),
|
||||||
|
),
|
||||||
|
]
|
@ -0,0 +1,42 @@
|
|||||||
|
# Generated by Django 4.1.4 on 2023-01-06 22:32
|
||||||
|
|
||||||
|
from django.db import migrations, models
|
||||||
|
import django.db.models.deletion
|
||||||
|
|
||||||
|
|
||||||
|
class Migration(migrations.Migration):
|
||||||
|
|
||||||
|
dependencies = [
|
||||||
|
('mensaviewer', '0017_remove_menu_days_remove_menu_locations_location_city_and_more'),
|
||||||
|
]
|
||||||
|
|
||||||
|
operations = [
|
||||||
|
migrations.RenameField(
|
||||||
|
model_name='comment',
|
||||||
|
old_name='username',
|
||||||
|
new_name='author',
|
||||||
|
),
|
||||||
|
migrations.RenameField(
|
||||||
|
model_name='comment',
|
||||||
|
old_name='related_menu',
|
||||||
|
new_name='menu',
|
||||||
|
),
|
||||||
|
migrations.RemoveField(
|
||||||
|
model_name='comment',
|
||||||
|
name='comment',
|
||||||
|
),
|
||||||
|
migrations.AddField(
|
||||||
|
model_name='comment',
|
||||||
|
name='text',
|
||||||
|
field=models.CharField(blank=True, max_length=512, null=True),
|
||||||
|
),
|
||||||
|
migrations.CreateModel(
|
||||||
|
name='NewsArticle',
|
||||||
|
fields=[
|
||||||
|
('id', models.BigAutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
|
||||||
|
('author', models.CharField(default='anon', max_length=144)),
|
||||||
|
('text', models.CharField(blank=True, max_length=8192, null=True)),
|
||||||
|
('location', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to='mensaviewer.location')),
|
||||||
|
],
|
||||||
|
),
|
||||||
|
]
|
@ -0,0 +1,23 @@
|
|||||||
|
# Generated by Django 4.1.4 on 2023-01-06 22:39
|
||||||
|
|
||||||
|
from django.db import migrations, models
|
||||||
|
|
||||||
|
|
||||||
|
class Migration(migrations.Migration):
|
||||||
|
|
||||||
|
dependencies = [
|
||||||
|
('mensaviewer', '0018_rename_username_comment_author_and_more'),
|
||||||
|
]
|
||||||
|
|
||||||
|
operations = [
|
||||||
|
migrations.AlterField(
|
||||||
|
model_name='comment',
|
||||||
|
name='text',
|
||||||
|
field=models.TextField(blank=True, null=True),
|
||||||
|
),
|
||||||
|
migrations.AlterField(
|
||||||
|
model_name='newsarticle',
|
||||||
|
name='text',
|
||||||
|
field=models.TextField(blank=True, null=True),
|
||||||
|
),
|
||||||
|
]
|
@ -0,0 +1,19 @@
|
|||||||
|
# Generated by Django 4.1.4 on 2023-01-08 01:01
|
||||||
|
|
||||||
|
from django.db import migrations, models
|
||||||
|
import django.utils.timezone
|
||||||
|
|
||||||
|
|
||||||
|
class Migration(migrations.Migration):
|
||||||
|
|
||||||
|
dependencies = [
|
||||||
|
('mensaviewer', '0019_alter_comment_text_alter_newsarticle_text'),
|
||||||
|
]
|
||||||
|
|
||||||
|
operations = [
|
||||||
|
migrations.AddField(
|
||||||
|
model_name='newsarticle',
|
||||||
|
name='timestamp',
|
||||||
|
field=models.DateTimeField(blank=True, default=django.utils.timezone.now),
|
||||||
|
),
|
||||||
|
]
|
@ -0,0 +1,18 @@
|
|||||||
|
# Generated by Django 4.1.4 on 2023-01-08 02:10
|
||||||
|
|
||||||
|
from django.db import migrations, models
|
||||||
|
|
||||||
|
|
||||||
|
class Migration(migrations.Migration):
|
||||||
|
|
||||||
|
dependencies = [
|
||||||
|
('mensaviewer', '0020_newsarticle_timestamp'),
|
||||||
|
]
|
||||||
|
|
||||||
|
operations = [
|
||||||
|
migrations.AddField(
|
||||||
|
model_name='newsarticle',
|
||||||
|
name='title',
|
||||||
|
field=models.CharField(blank=True, max_length=144),
|
||||||
|
),
|
||||||
|
]
|
@ -0,0 +1,38 @@
|
|||||||
|
# Generated by Django 4.1.4 on 2023-01-08 03:00
|
||||||
|
|
||||||
|
from django.db import migrations, models
|
||||||
|
|
||||||
|
|
||||||
|
class Migration(migrations.Migration):
|
||||||
|
|
||||||
|
dependencies = [
|
||||||
|
('mensaviewer', '0021_newsarticle_title'),
|
||||||
|
]
|
||||||
|
|
||||||
|
operations = [
|
||||||
|
migrations.AlterField(
|
||||||
|
model_name='menu',
|
||||||
|
name='allergens',
|
||||||
|
field=models.JSONField(blank=True, default=[]),
|
||||||
|
),
|
||||||
|
migrations.AlterField(
|
||||||
|
model_name='menu',
|
||||||
|
name='art',
|
||||||
|
field=models.CharField(choices=[('M', 'Mensa'), ('C', 'Cafeteria')], default='M', max_length=1),
|
||||||
|
),
|
||||||
|
migrations.AlterField(
|
||||||
|
model_name='menu',
|
||||||
|
name='name',
|
||||||
|
field=models.CharField(blank=True, default='', max_length=144),
|
||||||
|
),
|
||||||
|
migrations.AlterField(
|
||||||
|
model_name='menu',
|
||||||
|
name='price',
|
||||||
|
field=models.CharField(blank=True, default='', max_length=144),
|
||||||
|
),
|
||||||
|
migrations.AlterField(
|
||||||
|
model_name='menu',
|
||||||
|
name='types',
|
||||||
|
field=models.JSONField(blank=True, default=[]),
|
||||||
|
),
|
||||||
|
]
|
@ -0,0 +1,38 @@
|
|||||||
|
# Generated by Django 4.1.4 on 2023-01-08 18:03
|
||||||
|
|
||||||
|
from django.db import migrations, models
|
||||||
|
|
||||||
|
|
||||||
|
class Migration(migrations.Migration):
|
||||||
|
|
||||||
|
dependencies = [
|
||||||
|
('mensaviewer', '0022_alter_menu_allergens_alter_menu_art_alter_menu_name_and_more'),
|
||||||
|
]
|
||||||
|
|
||||||
|
operations = [
|
||||||
|
migrations.AlterField(
|
||||||
|
model_name='menu',
|
||||||
|
name='allergens',
|
||||||
|
field=models.JSONField(blank=True, default=list),
|
||||||
|
),
|
||||||
|
migrations.AlterField(
|
||||||
|
model_name='menu',
|
||||||
|
name='art',
|
||||||
|
field=models.CharField(choices=[('Mensa', 'Mensa'), ('Cafeteria', 'Cafeteria')], default='M', max_length=24),
|
||||||
|
),
|
||||||
|
migrations.AlterField(
|
||||||
|
model_name='menu',
|
||||||
|
name='name',
|
||||||
|
field=models.CharField(blank=True, default='---', max_length=144),
|
||||||
|
),
|
||||||
|
migrations.AlterField(
|
||||||
|
model_name='menu',
|
||||||
|
name='price',
|
||||||
|
field=models.CharField(blank=True, default='---', max_length=144),
|
||||||
|
),
|
||||||
|
migrations.AlterField(
|
||||||
|
model_name='menu',
|
||||||
|
name='types',
|
||||||
|
field=models.JSONField(blank=True, default=list),
|
||||||
|
),
|
||||||
|
]
|
@ -0,0 +1,12 @@
|
|||||||
|
{% extends 'base.html' %}
|
||||||
|
|
||||||
|
{% block content %}
|
||||||
|
|
||||||
|
<form class="model-form" method="post">
|
||||||
|
{% csrf_token %}
|
||||||
|
<p>Are you sure you want to delete "{{ object }}"?</p>
|
||||||
|
{{ form }}
|
||||||
|
<input type="submit" value="Confirm">
|
||||||
|
</form>
|
||||||
|
|
||||||
|
{% endblock %}
|
@ -0,0 +1,12 @@
|
|||||||
|
{% extends 'base.html' %}
|
||||||
|
|
||||||
|
{% block content %}
|
||||||
|
|
||||||
|
<div class="detail-container">
|
||||||
|
<h1>By {{ comment.author }}</h1>
|
||||||
|
<h3>Timestamp: {{ comment.timestamp }}</h3>
|
||||||
|
<h3>Menu: <a href="{% url 'mensaviewer:menu_detail' comment.menu.pk %}">{{ comment.menu.name }}</a></h3>
|
||||||
|
<h3>Text: {{ comment.text }}</h3>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
{% endblock %}
|
@ -0,0 +1,11 @@
|
|||||||
|
{% extends 'base.html' %}
|
||||||
|
|
||||||
|
{% block content %}
|
||||||
|
|
||||||
|
<form class="model-form" method="post">
|
||||||
|
{% csrf_token %}
|
||||||
|
{{ form }}
|
||||||
|
<input type="submit" value="Save">
|
||||||
|
</form>
|
||||||
|
|
||||||
|
{% endblock %}
|
@ -0,0 +1,31 @@
|
|||||||
|
{% extends 'base.html' %}
|
||||||
|
|
||||||
|
{% block content %}
|
||||||
|
|
||||||
|
<h1>Comments</h1>
|
||||||
|
|
||||||
|
<table class="comment-list">
|
||||||
|
<tr>
|
||||||
|
<td colspan="99" class="centered-td">
|
||||||
|
<a class="btn" href="{% url 'mensaviewer:comment_create' %}">Add Comment</a>
|
||||||
|
</td>
|
||||||
|
</tr>
|
||||||
|
<tr>
|
||||||
|
<th>Author</th>
|
||||||
|
<th>Timestamp</th>
|
||||||
|
<th>Menu</th>
|
||||||
|
<th></th>
|
||||||
|
<th></th>
|
||||||
|
</tr>
|
||||||
|
{% for comment in object_list %}
|
||||||
|
<tr>
|
||||||
|
<td>{{ comment.author }}</td>
|
||||||
|
<td>{{ comment.timestamp }}</td>
|
||||||
|
<td><a href="{% url 'mensaviewer:menu_detail' comment.menu.pk %}">{{ comment.menu }}</a></td>
|
||||||
|
<td class="fit-width"><a href="{% url 'mensaviewer:comment_update' comment.pk %}">Edit</a></td>
|
||||||
|
<td class="fit-width"><a href="{% url 'mensaviewer:comment_delete' comment.pk %}">Delete</a></td>
|
||||||
|
</tr>
|
||||||
|
{% endfor %}
|
||||||
|
</table>
|
||||||
|
|
||||||
|
{% endblock %}
|
@ -0,0 +1,60 @@
|
|||||||
|
{% extends 'base.html' %}
|
||||||
|
|
||||||
|
{% block title %}Custom Locations{% endblock %}
|
||||||
|
|
||||||
|
{% block header %}<h1>Show menus for custom location selection</h1>{% endblock %}
|
||||||
|
|
||||||
|
{% block content %}
|
||||||
|
|
||||||
|
<form class="filter-form" action="{% url 'mensaviewer:custom' %}" method="get">
|
||||||
|
<input type="hidden" name="filterform" value="filter">
|
||||||
|
<div class="type-filter">
|
||||||
|
{% for name, id in types %}
|
||||||
|
<label>
|
||||||
|
{{ name }}
|
||||||
|
<input type="checkbox" name="type" value={{ id }} {% if id in checked_types %} checked{% endif %}>
|
||||||
|
</label>
|
||||||
|
{% endfor %}
|
||||||
|
</div>
|
||||||
|
<div class="status-filter">
|
||||||
|
{% for status_value in status_values %}
|
||||||
|
<label>
|
||||||
|
{{ status_value }}
|
||||||
|
<input type="radio" name="status" value="{{ status_value }}" {% if status == status_value %} checked{% endif %}>
|
||||||
|
</label>
|
||||||
|
{% endfor %}
|
||||||
|
</div>
|
||||||
|
<div class="location-filter">
|
||||||
|
{% for location in locations %}
|
||||||
|
<label>
|
||||||
|
{{ location.name }}
|
||||||
|
<input type="checkbox" name="location" value="{{ location.mensa_id }}" {% if location.mensa_id in selected_locations %} checked{% endif %}>
|
||||||
|
</label>
|
||||||
|
{% endfor %}
|
||||||
|
</div>
|
||||||
|
<button type="submit">Filter</button>
|
||||||
|
</form>
|
||||||
|
|
||||||
|
<div class="container">
|
||||||
|
{% for day, menus in menu_data.items %}
|
||||||
|
<div class="column">
|
||||||
|
<h2>{{ day }}</h2>
|
||||||
|
|
||||||
|
{% for menu in menus %}
|
||||||
|
<div class="menu {% if menu.mensa_id == 1 %}a-mensa{% elif menu.mensa_id == 6 %}b-mensa{% endif %}">
|
||||||
|
<a href="{% url 'mensaviewer:menu_detail' menu.pk %}">{{ menu.name }}</a>
|
||||||
|
<p>{{ menu.art }}</p>
|
||||||
|
<p>{{ menu.price }}</p>
|
||||||
|
<p>{{ menu.types }}</p>
|
||||||
|
<p>{{ menu.allergens }}</p>
|
||||||
|
<p>{{ menu.likes }}</p>
|
||||||
|
<a href="{% url 'mensaviewer:like' menu.pk %}?next={{ request.path }}">Like</a>
|
||||||
|
<a href="{% url 'mensaviewer:dislike' menu.pk %}?next={{ request.path }}">Dislike</a>
|
||||||
|
</div>
|
||||||
|
{% endfor %}
|
||||||
|
|
||||||
|
</div>
|
||||||
|
{% endfor %}
|
||||||
|
</div>
|
||||||
|
|
||||||
|
{% endblock %}
|
@ -0,0 +1,12 @@
|
|||||||
|
{% extends 'base.html' %}
|
||||||
|
|
||||||
|
{% block content %}
|
||||||
|
|
||||||
|
<form class="model-form" method="post">
|
||||||
|
{% csrf_token %}
|
||||||
|
<p>Are you sure you want to delete "{{ object }}"?</p>
|
||||||
|
{{ form }}
|
||||||
|
<input type="submit" value="Confirm">
|
||||||
|
</form>
|
||||||
|
|
||||||
|
{% endblock %}
|
@ -0,0 +1,29 @@
|
|||||||
|
{% extends 'base.html' %}
|
||||||
|
|
||||||
|
{% block content %}
|
||||||
|
|
||||||
|
<div class="detail-container">
|
||||||
|
<h1>{{ location.name }}</h1>
|
||||||
|
<h3>City: {{ location.city }}</h3>
|
||||||
|
<h3>ID: {{ location.mensa_id }}</h3>
|
||||||
|
<a href="{% url 'mensaviewer:news_add' location.pk %}">Add News</a>
|
||||||
|
<a href="{% url 'mensaviewer:menu_add' location.pk %}">Add Menu</a>
|
||||||
|
<div class="related-items">
|
||||||
|
<h2>News</h2>
|
||||||
|
{% for news_article in location.news_articles %}
|
||||||
|
<div class="news-article">
|
||||||
|
<h3><a href="{% url 'mensaviewer:news_detail' news_article.pk %}">{{ news_article.title }}</a></h3>
|
||||||
|
</div>
|
||||||
|
{% endfor %}
|
||||||
|
</div>
|
||||||
|
<div class="related-items">
|
||||||
|
<h2>Menus</h2>
|
||||||
|
{% for menu in location.menus %}
|
||||||
|
<div class="menu">
|
||||||
|
<h3><a href="{% url 'mensaviewer:menu_detail' menu.pk %}">{{ menu.name }}</a></h3>
|
||||||
|
</div>
|
||||||
|
{% endfor %}
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
{% endblock %}
|
@ -0,0 +1,11 @@
|
|||||||
|
{% extends 'base.html' %}
|
||||||
|
|
||||||
|
{% block content %}
|
||||||
|
|
||||||
|
<form class="model-form" method="post">
|
||||||
|
{% csrf_token %}
|
||||||
|
{{ form }}
|
||||||
|
<input type="submit" value="Save">
|
||||||
|
</form>
|
||||||
|
|
||||||
|
{% endblock %}
|
@ -0,0 +1,31 @@
|
|||||||
|
{% extends 'base.html' %}
|
||||||
|
|
||||||
|
{% block content %}
|
||||||
|
|
||||||
|
<h1>Locations</h1>
|
||||||
|
|
||||||
|
<table class="location-list">
|
||||||
|
<tr>
|
||||||
|
<td colspan="99" class="centered-td">
|
||||||
|
<a class="btn" href="{% url 'mensaviewer:location_create' %}">New Location</a>
|
||||||
|
</td>
|
||||||
|
</tr>
|
||||||
|
<tr>
|
||||||
|
<th>Name</th>
|
||||||
|
<th>City</th>
|
||||||
|
<th>ID</th>
|
||||||
|
<th></th>
|
||||||
|
<th></th>
|
||||||
|
</tr>
|
||||||
|
{% for location in object_list %}
|
||||||
|
<tr>
|
||||||
|
<td><a href="{% url 'mensaviewer:location_detail' location.pk %}">{{ location.name }}</a></td>
|
||||||
|
<td>{{ location.city }}</td>
|
||||||
|
<td class="fit-width">{{ location.mensa_id }}</td>
|
||||||
|
<td class="fit-width"><a href="{% url 'mensaviewer:location_update' location.pk %}">Edit</a></td>
|
||||||
|
<td class="fit-width"><a href="{% url 'mensaviewer:location_delete' location.pk %}">Delete</a></td>
|
||||||
|
</tr>
|
||||||
|
{% endfor %}
|
||||||
|
</table>
|
||||||
|
|
||||||
|
{% endblock %}
|
@ -0,0 +1,12 @@
|
|||||||
|
{% extends 'base.html' %}
|
||||||
|
|
||||||
|
{% block content %}
|
||||||
|
|
||||||
|
<form class="model-form" method="post">
|
||||||
|
{% csrf_token %}
|
||||||
|
<p>Are you sure you want to delete "{{ object }}"?</p>
|
||||||
|
{{ form }}
|
||||||
|
<input type="submit" value="Confirm">
|
||||||
|
</form>
|
||||||
|
|
||||||
|
{% endblock %}
|
@ -0,0 +1,28 @@
|
|||||||
|
{% extends 'base.html' %}
|
||||||
|
|
||||||
|
{% block content %}
|
||||||
|
|
||||||
|
<div class="detail-container">
|
||||||
|
<h1>{{ menu.name }}</h1>
|
||||||
|
<p>Art: {{ menu.art }}</p>
|
||||||
|
<p>Price for Students: {{ menu.get_price.Student }}</p>
|
||||||
|
<p>Price for Employees: {{ menu.get_price.Employee }}</p>
|
||||||
|
<p>Price for Guests: {{ menu.get_price.Guest }}</p>
|
||||||
|
<p>Allergens: {{ menu.get_allergens }}</p>
|
||||||
|
<p>Types: {{ menu.get_types }}</p>
|
||||||
|
<p>Rating: {{ menu.likes }}</p>
|
||||||
|
<p>Location and Date: {{ menu.location.city }} {{ menu.location.name }} | {{ menu.day }}</p>
|
||||||
|
<a href="{% url 'mensaviewer:like' menu.id %}?next={{ request.path }}">Like</a>
|
||||||
|
<a href="{% url 'mensaviewer:dislike' menu.id %}?next={{ request.path }}">Dislike</a>
|
||||||
|
<a href="{% url 'mensaviewer:comment_add' menu.id %}">Comment</a>
|
||||||
|
<div class="related-items">
|
||||||
|
{% for comment in menu.comments %}
|
||||||
|
<div class="comment">
|
||||||
|
<h3>{{ comment.author }}</h3>
|
||||||
|
<p>{{ comment.text }}</p>
|
||||||
|
</div>
|
||||||
|
{% endfor %}
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
{% endblock %}
|
@ -0,0 +1,11 @@
|
|||||||
|
{% extends 'base.html' %}
|
||||||
|
|
||||||
|
{% block content %}
|
||||||
|
|
||||||
|
<form class="model-form" method="post">
|
||||||
|
{% csrf_token %}
|
||||||
|
{{ form }}
|
||||||
|
<input type="submit" value="Save">
|
||||||
|
</form>
|
||||||
|
|
||||||
|
{% endblock %}
|
@ -0,0 +1,31 @@
|
|||||||
|
{% extends 'base.html' %}
|
||||||
|
|
||||||
|
{% block content %}
|
||||||
|
|
||||||
|
<h1>Menus</h1>
|
||||||
|
|
||||||
|
<table class="menu-list">
|
||||||
|
<tr>
|
||||||
|
<td colspan="99" class="centered-td">
|
||||||
|
<a class="btn" href="{% url 'mensaviewer:menu_create' %}">Add Menu</a>
|
||||||
|
</td>
|
||||||
|
</tr>
|
||||||
|
<tr>
|
||||||
|
<th>Name</th>
|
||||||
|
<th>Location</th>
|
||||||
|
<th>Day</th>
|
||||||
|
<th>Edit</th>
|
||||||
|
<th>Delete</th>
|
||||||
|
</tr>
|
||||||
|
{% for menu in object_list %}
|
||||||
|
<tr>
|
||||||
|
<td><a href="{% url 'mensaviewer:menu_detail' menu.pk %}">{{ menu.name }}</a></td>
|
||||||
|
<td><a href="{% url 'mensaviewer:location_detail' menu.location.pk %}">{{ menu.location.name }}</a></td>
|
||||||
|
<td>{{ menu.day }}</td>
|
||||||
|
<td class="fit-width"><a href="{% url 'mensaviewer:menu_update' menu.pk %}">Edit</a></td>
|
||||||
|
<td class="fit-width"><a href="{% url 'mensaviewer:menu_delete' menu.pk %}">Delete</a></td>
|
||||||
|
</tr>
|
||||||
|
{% endfor %}
|
||||||
|
</table>
|
||||||
|
|
||||||
|
{% endblock %}
|
@ -0,0 +1,12 @@
|
|||||||
|
{% extends 'base.html' %}
|
||||||
|
|
||||||
|
{% block content %}
|
||||||
|
|
||||||
|
<form class="model-form" method="post">
|
||||||
|
{% csrf_token %}
|
||||||
|
<p>Are you sure you want to delete "{{ object }}"?</p>
|
||||||
|
{{ form }}
|
||||||
|
<input type="submit" value="Confirm">
|
||||||
|
</form>
|
||||||
|
|
||||||
|
{% endblock %}
|
@ -0,0 +1,12 @@
|
|||||||
|
{% extends 'base.html' %}
|
||||||
|
|
||||||
|
{% block content %}
|
||||||
|
|
||||||
|
<div class="detail-container">
|
||||||
|
<h1>By {{ newsarticle.author }}</h1>
|
||||||
|
<h3>Timestamp: {{ newsarticle.timestamp }}</h3>
|
||||||
|
<h3>Location: <a href="{% url 'mensaviewer:location_detail' newsarticle.location.pk %}">{{ newsarticle.location.name }}</a></h3>
|
||||||
|
<h3>Text: {{ newsarticle.text }}</h3>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
{% endblock %}
|
@ -0,0 +1,11 @@
|
|||||||
|
{% extends 'base.html' %}
|
||||||
|
|
||||||
|
{% block content %}
|
||||||
|
|
||||||
|
<form class="model-form" method="post">
|
||||||
|
{% csrf_token %}
|
||||||
|
{{ form }}
|
||||||
|
<input type="submit" value="Save">
|
||||||
|
</form>
|
||||||
|
|
||||||
|
{% endblock %}
|
@ -0,0 +1,33 @@
|
|||||||
|
{% extends 'base.html' %}
|
||||||
|
|
||||||
|
{% block content %}
|
||||||
|
|
||||||
|
<h1>News Articles</h1>
|
||||||
|
|
||||||
|
<table class="news-list">
|
||||||
|
<tr>
|
||||||
|
<td colspan="99" class="centered-td">
|
||||||
|
<a class="btn" href="{% url 'mensaviewer:news_create' %}">Add News Article</a>
|
||||||
|
</td>
|
||||||
|
</tr>
|
||||||
|
<tr>
|
||||||
|
<th>Title</th>
|
||||||
|
<th>Author</th>
|
||||||
|
<th>Timestamp</th>
|
||||||
|
<th>Menu</th>
|
||||||
|
<th></th>
|
||||||
|
<th></th>
|
||||||
|
</tr>
|
||||||
|
{% for newsarticle in object_list %}
|
||||||
|
<tr>
|
||||||
|
<td><a href="{% url 'mensaviewer:news_detail' newsarticle.pk %}">{{ newsarticle.title }}</a></td>
|
||||||
|
<td>{{ newsarticle.author }}</td>
|
||||||
|
<td>{{ newsarticle.timestamp }}</td>
|
||||||
|
<td><a href="{% url 'mensaviewer:location_detail' newsarticle.location.pk %}">{{ newsarticle.location.city }} - {{ newsarticle.location.name }}</a></td>
|
||||||
|
<td class="fit-width"><a href="{% url 'mensaviewer:news_update' newsarticle.pk %}">Edit</a></td>
|
||||||
|
<td class="fit-width"><a href="{% url 'mensaviewer:news_delete' newsarticle.pk %}">Delete</a></td>
|
||||||
|
</tr>
|
||||||
|
{% endfor %}
|
||||||
|
</table>
|
||||||
|
|
||||||
|
{% endblock %}
|
Loading…
Reference in New Issue