Files
Flask_CRUD_example/templates/form.html
2025-11-27 16:25:46 +01:00

26 lines
1.2 KiB
HTML

{% extends 'base.html' %}
{% block title %}{{ 'Edycja' if contact and (contact.id if contact is not mapping else contact.get('id')) else 'Nowy' }} kontakt{% endblock %}
{% block content %}
{% set cid = (contact.id if contact and contact is not mapping else (contact.get('id') if contact else None)) %}
<form method="post" action="{{ url_for('update' if cid else 'create') }}">
{% if cid %}
<input type="hidden" name="id" value="{{ cid }}">
{% endif %}
<div class="row">
<label>Imię i nazwisko</label>
<input type="text" name="name" value="{{ (contact.name if contact and contact is not mapping else (contact['name'] if contact else ''))|e }}" required>
</div>
<div class="row">
<label>Email</label>
<input type="email" name="email" value="{{ (contact.email if contact and contact is not mapping else (contact['email'] if contact else ''))|e }}">
</div>
<div class="row">
<label>Telefon</label>
<input type="text" name="phone" value="{{ (contact.phone if contact and contact is not mapping else (contact['phone'] if contact else ''))|e }}">
</div>
<p>
<button class="btn primary" type="submit">Zapisz</button>
<a class="btn" href="{{ url_for('index') }}">Anuluj</a>
</p>
</form>
{% endblock %}