Switch Add/Update to use CBV, combine templates into one.

This commit is contained in:
2012-06-06 20:59:29 +01:00
parent a39fe76e47
commit f4e08ca8ad
7 changed files with 85 additions and 117 deletions

View File

@@ -1,23 +0,0 @@
{% extends "base.html" %}
{% block title %}Add EVE API Key{% endblock %}
{% block content %}
<div class="page-header">
<h1>Add EVE API Key</h1>
</div>
<p>Please fill in your API key details and a optional description. You can create a API key on the <a href="https://support.eveonline.com/api/Key/CreatePredefined/59638024/0/false">API support site</a></p>
<form action="{% url eve_api.views.eveapi_add %}" method="post">
<fieldset>
{% include "formtools/formerror.html" %}
{% include "formtools/formfield.html" with field=form.api_user_id %}
{% include "formtools/formfield.html" with field=form.api_key class="xxlarge"%}
{% csrf_token %}
<input type="submit" value="Add API Key" class="btn primary"/>
</fieldset>
</form>
{% endblock %}

View File

@@ -0,0 +1,24 @@
{% extends "base.html" %}
{% block title %}{% if object %}Update EVE API Key{% else %}Add EVE API Key{% endif %}{% endblock %}
{% block content %}
<div class="page-header">
<h1>{% if object %}Update EVE API Key{% else %}Add EVE API Key{% endif %}</h1>
</div>
<p>Please fill in your API key details and a optional description. You can create a API key on the <a href="https://support.eveonline.com/api/Key/CreatePredefined/59638024/0/false">API support site</a></p>
<form action="{% if object %}{% url eveapi-update object.api_user_id %}{% else %}{% url eveapi-add %}{% endif %}" method="post">
<fieldset>
{% include "formtools/formerror.html" %}
{% include "formtools/formfield.html" with field=form.api_user_id %}
{% include "formtools/formfield.html" with field=form.api_key class="xxlarge" %}
{% include "formtools/formfield.html" with field=form.description class="xxlarge" %}
{% include "formtools/formfield.html" with field=form.user %}
{% csrf_token %}
<input type="submit" value="{% if object %}Update API Key{% else %}Add API Key{% endif %}" class="btn primary"/>
</fieldset>
</form>
{% endblock %}

View File

@@ -1,24 +0,0 @@
{% extends "base.html" %}
{% block title %}Update EVE API Key{% endblock %}
{% block content %}
<div class="page-header">
<h1>Update EVE API Key</h1>
</div>
<p>Please update your API key as provided on the <a href="http://eve-online.com/api">EVE Online API page</a> and a optional description.</p>
<form action="{% url eveapi-update acc.api_user_id %}" method="post">
<fieldset>
{% include "formtools/formerror.html" %}
{% include "formtools/formfield.html" with field=form.user %}
{% include "formtools/formfield.html" with field=form.api_user_id %}
{% include "formtools/formfield.html" with field=form.api_key class="xxlarge" %}
{% include "formtools/formfield.html" with field=form.description class="xxlarge" %}
{% csrf_token %}
<input type="submit" value="Add API Key" class="btn primary"/>
</fieldset>
</form>
{% endblock %}