mirror of
https://github.com/nikdoof/test-auth.git
synced 2025-12-14 06:42:16 +00:00
Fix the exception path, also move app specific templates into the app folder
This commit is contained in:
19
eve_api/templates/eve_api/add.html
Normal file
19
eve_api/templates/eve_api/add.html
Normal file
@@ -0,0 +1,19 @@
|
||||
{% extends "base.html" %}
|
||||
|
||||
{% block title %}Add EVE API Key{% endblock %}
|
||||
|
||||
{% block content %}
|
||||
<p>Please fill in 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 eve_api.views.eveapi_add %}" method="post">
|
||||
<table>
|
||||
{{ form.as_table }}
|
||||
</table>
|
||||
<br />
|
||||
{% csrf_token %}
|
||||
<input type="submit" value="Add Key" />
|
||||
</form>
|
||||
|
||||
{% endblock %}
|
||||
100
eve_api/templates/eve_api/character.html
Normal file
100
eve_api/templates/eve_api/character.html
Normal file
@@ -0,0 +1,100 @@
|
||||
{% extends "base.html" %}
|
||||
|
||||
{% load humanize %}
|
||||
{% load naturaltimediff %}
|
||||
{% block content %}
|
||||
|
||||
<div class="character_info">
|
||||
<h1>{{ character.name }}</h1>
|
||||
|
||||
<div class="character_portrait">
|
||||
<img src="http://image.eveonline.com/Character/{{ character.id }}_256.jpg" />
|
||||
</div>
|
||||
|
||||
<div class="character_corporation">
|
||||
<span><a href="http://evemaps.dotlan.net/corp/{{ character.corporation.name }}">{{ character.corporation.ticker }}</a></span>
|
||||
<img src="http://image.eveonline.com/Corporation/{{ character.corporation.id }}_64.png" />
|
||||
</div>
|
||||
|
||||
{% if character.corporation.alliance %}
|
||||
<div class="character_alliance">
|
||||
<span><a href="http://evemaps.dotlan.net/alliance/{{ character.corporation.alliance.name }}">{{ character.corporation.alliance.ticker }}</a></span>
|
||||
<img src="http://image.eveonline.com/Alliance/{{ character.corporation.alliance.id }}_64.png" />
|
||||
</div>
|
||||
{% endif %}
|
||||
|
||||
<div class="character_attributes">
|
||||
<h2>Attributes</h2>
|
||||
|
||||
<ul>
|
||||
<li><span class="stat">Race:</span> <span class="value">{{ character.get_race_display }}</span></li>
|
||||
<li><span class="stat">Gender:</span> <span class="value">{{ character.get_gender_display }}</span></li>
|
||||
<li><span class="stat">Corporation:</span> <a href="http://evemaps.dotlan.net/corp/{{ character.corporation.name }}">{{ character.corporation.name }}</a></span></li>
|
||||
<li><span class="stat">Joined Corporation:</span> <span class="value">{{ character.corporation_date|date:"Y/m/d H:i:s" }} ({{ character.corporation_date|naturaltimediff }})</span></li>
|
||||
<li><span class="stat">Alliance:</span> <span class="value"><a href="http://evemaps.dotlan.net/alliance/{{ character.corporation.alliance.name }}">{{ character.corporation.alliance.name }}</a></span></li>
|
||||
<li><span class="stat">Security Status:</span> {{ character.security_status }}</span></li>
|
||||
<li><span class="stat">Director:</span> <span class="value">{{ character.director }}</span></li>
|
||||
</ul>
|
||||
</div>
|
||||
|
||||
<div class="character_stats">
|
||||
<h2>Stats</h2>
|
||||
|
||||
<table>
|
||||
<tr><th>Stat</th><th>Value</th></tr>
|
||||
<tr><td class="stat">Intelligence</td><td> {{ character.attrib_intelligence }}</td></tr>
|
||||
<tr><td class="stat">Memory</td><td>{{ character.attrib_memory }}</td></tr>
|
||||
<tr><td class="stat">Charisma</td><td>{{ character.attrib_charisma }}</td></tr>
|
||||
<tr><td class="stat">Perception</td><td>{{ character.attrib_perception }}</td></tr>
|
||||
<tr><td class="stat">Willpower</td><td>{{ character.attrib_willpower }}</td></tr>
|
||||
</table>
|
||||
</div>
|
||||
|
||||
<div class="character_skills">
|
||||
<h2>Skills</h2>
|
||||
|
||||
<div class="skill_controls">
|
||||
<a href=#" id="openAll">Open All</a>
|
||||
<a href=#" id="collapseAll">Collapse All</a>
|
||||
</div>
|
||||
<table>
|
||||
|
||||
{% regroup skills by skill.group as skill_group %}
|
||||
{% for group in skill_group %}
|
||||
<tr class="skill_heading"><th colspan=3>{{ group.grouper }}</th</tr>
|
||||
{% for skill in group.list %}
|
||||
<tr style="display:none;"><td>{{ skill.skill.name }} </td><td><img src="/static/img/skills/level{{ skill.level }}.gif" alt="Level {{ skill.level }}" /></td><td>{{ skill.skillpoints|intcomma }} SP</td></tr>
|
||||
{% endfor %}
|
||||
{% endfor %}
|
||||
<tr><th colspan=2>Total SP</th><th>{{ character.total_sp|intcomma }} SP</th></tr>
|
||||
</table>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<script src="http://ajax.googleapis.com/ajax/libs/jquery/1.4.4/jquery.min.js" type="text/javascript"></script>
|
||||
<script type="text/javascript">
|
||||
$(function(){
|
||||
$(".skill_heading").bind("click", function(){
|
||||
$this = $(this);
|
||||
$this.nextUntil(".skill_heading").toggle('fast');
|
||||
|
||||
if($this.hasClass("toggle_off")){
|
||||
$this.removeClass("toggle_off").removeClass("toggle_on");
|
||||
}else{
|
||||
$this.removeClass("toggle_on").removeClass("toggle_off");
|
||||
}
|
||||
});
|
||||
|
||||
$("#openAll").bind("click", function(e){
|
||||
e.preventDefault();
|
||||
$(".character_skills tr").css({ display: "table-row" });
|
||||
});
|
||||
|
||||
$("#collapseAll").bind("click", function(e){
|
||||
e.preventDefault();
|
||||
$(".character_skills tr:not(.skill_heading)").css({ display: "none" });
|
||||
});
|
||||
});
|
||||
</script>
|
||||
|
||||
{% endblock %}
|
||||
19
eve_api/templates/eve_api/character_list.html
Normal file
19
eve_api/templates/eve_api/character_list.html
Normal file
@@ -0,0 +1,19 @@
|
||||
{% extends "base.html" %}
|
||||
|
||||
{% block content %}
|
||||
|
||||
<h1>Character List</h1>
|
||||
|
||||
{% if characters %}
|
||||
<table>
|
||||
<tr><th>Character Name</th><th>Corporation</th><th>Alliance</th></tr>
|
||||
{% for char in characters %}
|
||||
<tr><td><a href="{% url eveapi-character char.id %}">{{ char.name }}</a></td>
|
||||
<td>{{ char.corporation }}</td>
|
||||
<td>{% if char.corporation.alliance %}{{ char.corporation.alliance }}{% endif %}</td>
|
||||
</tr>
|
||||
{% endfor %}
|
||||
</table>
|
||||
{% endif %}
|
||||
|
||||
{% endblock %}
|
||||
30
eve_api/templates/eve_api/corporation.html
Normal file
30
eve_api/templates/eve_api/corporation.html
Normal file
@@ -0,0 +1,30 @@
|
||||
{% extends "base.html" %}
|
||||
|
||||
{% load humanize %}
|
||||
{% load naturaltimediff %}
|
||||
{% load pagination_tags %}
|
||||
|
||||
{% block content %}
|
||||
|
||||
<div class="corporation_info">
|
||||
<h1>{{ corporation.name }}</h1>
|
||||
|
||||
<ul>
|
||||
<li><b>Member Count:</b> {{ corporation.member_count }}</li>
|
||||
<li><b>Known Members:</b> {{ corporation.eveplayercharacter_set.all.count }}</li>
|
||||
</ul>
|
||||
|
||||
{% if view_members %}
|
||||
<table>
|
||||
<tr><th>Name</th><th>Join Date</th></tr>
|
||||
{% autopaginate members 10 %}
|
||||
{% for char in members %}
|
||||
<tr><td><a href="{% url eveapi-character char.id %}">{{ char.name }}</a></td><td>{{ char.corporation_date }}</td></tr>
|
||||
{% endfor %}
|
||||
</table>
|
||||
{% paginate %}
|
||||
{% endif %}
|
||||
|
||||
</div>
|
||||
|
||||
{% endblock %}
|
||||
22
eve_api/templates/eve_api/log.html
Normal file
22
eve_api/templates/eve_api/log.html
Normal file
@@ -0,0 +1,22 @@
|
||||
{% extends "base.html" %}
|
||||
|
||||
{% block title %}EVE API Access Logs{% endblock %}
|
||||
{% load pagination_tags %}
|
||||
{% block content %}
|
||||
|
||||
<h1>Access Logs for API Key {{ userid }}</h1>
|
||||
|
||||
<table>
|
||||
<tr><th>Service ID</th><th>Date / Time</th><th>API</th></tr>
|
||||
{% autopaginate logs 20 %}
|
||||
{% for log in logs %}
|
||||
<tr><td>{{ log.service }}</td>
|
||||
<td>{{ log.time_access }}</td>
|
||||
<td>{{ log.document }}</td>
|
||||
</tr>
|
||||
{% endfor %}
|
||||
</table>
|
||||
{% paginate %}
|
||||
|
||||
|
||||
{% endblock %}
|
||||
0
eve_api/templatetags/__init__.py
Normal file
0
eve_api/templatetags/__init__.py
Normal file
33
eve_api/templatetags/naturaltimediff.py
Normal file
33
eve_api/templatetags/naturaltimediff.py
Normal file
@@ -0,0 +1,33 @@
|
||||
from django import template
|
||||
|
||||
register = template.Library()
|
||||
|
||||
MOMENT = 120 # duration in seconds within which the time difference
|
||||
# will be rendered as 'a moment ago'
|
||||
|
||||
@register.filter
|
||||
def naturaltimediff(value):
|
||||
"""
|
||||
Finds the difference between the datetime value given and now()
|
||||
and returns appropriate humanize form
|
||||
"""
|
||||
|
||||
from datetime import datetime
|
||||
|
||||
if isinstance(value, datetime):
|
||||
delta = datetime.now() - value
|
||||
if delta.days > 6:
|
||||
return value.strftime("%b %d") # May 15
|
||||
if delta.days > 1:
|
||||
return value.strftime("%A") # Wednesday
|
||||
elif delta.days == 1:
|
||||
return 'yesterday' # yesterday
|
||||
elif delta.seconds > 3600:
|
||||
return str(delta.seconds / 3600 ) + ' hours ago' # 3 hours ago
|
||||
elif delta.seconds > MOMENT:
|
||||
return str(delta.seconds/60) + ' minutes ago' # 29 minutes ago
|
||||
else:
|
||||
return 'a moment ago' # a moment ago
|
||||
return defaultfilters.date(value)
|
||||
else:
|
||||
return str(value)
|
||||
@@ -10,7 +10,7 @@ from django.http import Http404
|
||||
from django.core import serializers
|
||||
|
||||
from eve_proxy.models import ApiAccessLog
|
||||
from eve_api.api_exceptions import DocumentRetrievalError
|
||||
from eve_proxy.exceptions import DocumentRetrievalError
|
||||
from eve_api.forms import EveAPIForm
|
||||
from eve_api.models import EVEAccount, EVEPlayerCharacter, EVEPlayerCorporation
|
||||
from eve_api.tasks import import_apikey_result
|
||||
|
||||
Reference in New Issue
Block a user