zkt26/z1/diary_app/templates/diary/entry_form.html
2026-04-01 06:53:48 +02:00

40 lines
1.4 KiB
HTML

{% extends 'diary/base.html' %}
{% block title %}{{ action }} Entry{% endblock %}
{% block content %}
<div class="form-page">
<h1>{{ action }} Entry</h1>
<form method="post" class="diary-form">
{% csrf_token %}
<div class="form-group">
<label for="title">Title</label>
<input type="text" id="title" name="title"
value="{{ entry.title|default:'' }}"
placeholder="Give your entry a title…"
class="input" required>
</div>
<div class="form-group">
<label for="mood">Mood</label>
<select id="mood" name="mood" class="input">
{% for val, label in mood_choices %}
<option value="{{ val }}"
{% if entry.mood == val or not entry and val == 'calm' %}selected{% endif %}>
{{ label }}
</option>
{% endfor %}
</select>
</div>
<div class="form-group">
<label for="content">Write your thoughts…</label>
<textarea id="content" name="content" rows="12"
placeholder="What's on your mind today?"
class="input textarea" required>{{ entry.content|default:'' }}</textarea>
</div>
<div class="form-actions">
<button type="submit" class="btn btn-primary">{{ action }} Entry</button>
<a href="{% if entry %}{% url 'entry_detail' entry.pk %}{% else %}{% url 'entry_list' %}{% endif %}"
class="btn btn-ghost">Cancel</a>
</div>
</form>
</div>
{% endblock %}