{% extends "base.html" %}

{% load i18n %}

{% block title %}{% if object %}{% blocktrans with object.title as news_title %}Edit '{{ news_title }}'{% endblocktrans %}{% else %}{% trans "New News Article" %}{% endif %}{% endblock %}
{% block body-pageid %}news-edit{% endblock %}

{% block content %}

<form method="post" action=".">
{% csrf_token %}

{% if form.errors %}
<p class="error">{% trans "Please correct the errors below" %}: {{ form.errors }}</p>
{% endif %}

  {% if object %}
  <h2>{% trans "Edit English News Article" %}</h2>
  {% else %}
  <h2>{% trans "New English News Article" %}</h2>
  {% endif %}

    <table>
      <tr><th scope="row">{% trans "Title" %}:</th><td>{{ form.title }}</td>
      {% if form.title.errors %}<tr class="error"><td colspan="2">{{ form.title.errors|join:", " }}</td></tr>{% endif %}
      <tr><th scope="row">{% trans "Excerpt" %}:</th><td>{{ form.excerpt }}</td>
      {% if form.excerpt.errors %}<tr class="error"><td colspan="2">{{ form.except.errors|join:", " }}</td></tr>{% endif %}
      <tr><th scope="row">{% trans "Content" %}:</th><td>{{ form.content }}</td>
      {% if form.content.errors %}<tr class="error"><td colspan="2">{{ form.content.errors|join:", " }}</td></tr>{% endif %}
      <tr><th scope="row">{% trans "Publish Date" %}:</th><td>{{ form.pub_date }}</td>
      {% if form.pub_date.errors %}<tr class="error"><td colspan="2">{{ form.pub_date.errors|join:", " }}</td></tr>{% endif %}
    </table>

  <input type="submit" value="{% trans "Save" %}"/>
  {% if not object or not object.is_published %}
     <input type="submit" name="publish" value="{% trans "Publish" %}"/>
  {% endif %}

</form>

{% endblock %}

