Various changes and formatting updates, making the app easier to use.

This commit is contained in:
2012-04-29 16:12:55 +01:00
parent f849b79df2
commit 477f51aed2
9 changed files with 34 additions and 17 deletions

View File

@@ -17,6 +17,6 @@ class CorporationContactForm(forms.ModelForm):
class ManualAdjustmentForm(forms.Form):
corporation = forms.ModelChoiceField(queryset=Corporation.objects.all(), empty_label=None)
amount = forms.DecimalField(max_digits=20, decimal_places=2)
comment = forms.CharField(max_length=255)
corporation = forms.ModelChoiceField(queryset=Corporation.objects.all(), empty_label=None, help_text="Corporation you wish to apply the adjustment to")
amount = forms.DecimalField(max_digits=20, decimal_places=2, help_text="The amount in ISK you wish to adjust the corporation's account by")
comment = forms.CharField(max_length=255, help_text="Free-form comment to describe this transaction")

View File

@@ -85,8 +85,8 @@ class Transaction(models.Model):
)
corporation = models.ForeignKey(Corporation, related_name='transactions')
type = models.PositiveIntegerField(choices=TRANSACTION_TYPE_CHOICES)
date = models.DateTimeField('Transaction Date', auto_now_add=True)
type = models.PositiveIntegerField(choices=TRANSACTION_TYPE_CHOICES, help_text="The type of transaction")
date = models.DateTimeField('Transaction Date', auto_now_add=True, help_text="The date/time the transaction was processed")
value = models.DecimalField('Transaction Value', max_digits=25, decimal_places=2)
comment = models.CharField(max_length=255)
@@ -97,8 +97,8 @@ class Key(models.Model):
"""EVE API Key"""
corporation = models.ForeignKey(Corporation, related_name='keys', blank=False, null=False)
keyid = models.BigIntegerField('Key ID', primary_key=True)
vcode = models.CharField('vCode', max_length=64)
keyid = models.BigIntegerField('Key ID', primary_key=True, help_text="Your EVE API key ID")
vcode = models.CharField('vCode', max_length=64, help_text="Your EVE API key vCode")
mask = models.BigIntegerField('Access Mask')
active = models.BooleanField('Active', default=True)
@@ -111,7 +111,6 @@ class Key(models.Model):
mask = 1 << bit
return (accessmask & mask) > 0
def save(self, *args, **kwargs):
self.update_api()
return super(Key, self).save(*args, **kwargs)

View File

@@ -2,9 +2,7 @@
{% block content %}
<h1>Assign Corporation Contact</h1>
<p>Select the username of the contact you wish to assign to {{ object.name }}.</p>
<p>Select the username of the contact you wish to assign to {{ object.name }}.</p>
<p>
<form action="{% url corporation-updatecontact object.pk %}" method="post" class="well">
<fieldset>

View File

@@ -24,8 +24,11 @@
{% for obj in object_list %}
<tr><td><a href="{% url corporation-detail obj.pk %}">{{ obj.name }}</a></td><td>{% if obj.contact %}{{ obj.contact.username }}{% else %}<a href="{% url corporation-updatecontact obj.pk %}">Assign Contact</a>{% endif %}</td><td>{{ obj.ceo }}</td><td>{{ obj.tax_rate }}%</td><td><span class="{% if obj.balance >= 0 %}positive{% else %}negative{% endif %}">{{ obj.balance|intcomma }} ISK</span></td></tr>
{% endfor %}
<tr><th colspan="4">Total Outstanding</th><th><span class="{% if total >= 0 %}positive{% else %}negative{% endif %}"><b>{{ total|intcomma }} ISK</b></span></th></tr>
</tbody>
</table>
</p>
{% else %}
<p><small>No corporations are currently available, consider <a href="{% url key-create %}">adding a API key</a>.</small></p>
{% endif %}
{% endblock %}

View File

@@ -1,16 +1,21 @@
{% extends "base.html" %}
{% block content %}
<h1>{% if object %}Update{% else %}Add{% endif %} Key</h1>
<h1>{% if object %}Update{% else %}Add{% endif %} EVE API Key</h1>
<p>
<form action="{% if object %}{% url key-update object.id %}{% else %}{% url key-create %}{% endif %}" method="post" class="form-horizontal">
<form action="{% if object %}{% url key-update object.id %}{% else %}{% url key-create %}{% endif %}" method="post" class="well">
{% if not object %}
<p>Please fill in your EVE API key detail below, you can create a key by using the <a href="https://support.eveonline.com/api/" target="_blank">EVE API support portal</a>.</p>
{% endif %}
<fieldset>
{% include "formtools/formerror.html" %}
{% include "formtools/formfield.html" with field=form.keyid %}
{% include "formtools/formfield.html" with field=form.vcode %}
{% csrf_token %}
<input type="submit" value="{% if object %}Update Key{% else %}Create Key{% endif %}" class="btn btn-inverse"/>
<input type="submit" value="{% if object %}Update Key{% else %}Add Key{% endif %}" class="btn btn-inverse"/>
</fieldset>
</form>
<p>

View File

@@ -19,6 +19,8 @@
</tbody>
</table>
</p>
{% else %}
<p><small>No keys are currently stored.</small></p>
{% endif %}
<p><a href="{% url key-create %}" class="btn"><i class="icon-plus"></i> Add Key</a></p>

View File

@@ -8,6 +8,7 @@ from django.views.generic import ListView, DetailView, CreateView, DeleteView, U
from django.views.generic.detail import SingleObjectMixin
from django.utils import simplejson as json
from django.contrib import messages
from django.db.models import Sum
from eveapi import EVEAPIConnection, Error
from braces.views import LoginRequiredMixin, PermissionRequiredMixin
@@ -84,6 +85,13 @@ class CorporationListView(LoginRequiredMixin, ListView):
model = Corporation
paginate_by = 25
def get_context_data(self, **kwargs):
ctx = super(CorporationListView, self).get_context_data(**kwargs)
ctx.update({
'total': self.get_queryset().filter(balance__lt=0).aggregate(Sum('balance'))['balance__sum'] or Decimal('0')
})
return ctx
def get_queryset(self):
if self.request.user.has_perm('core.view_all_corporation'):
return self.model.objects.all()

View File

@@ -7,7 +7,7 @@
{{ field.label_tag|add_class:"control-label" }}
<div class="controls">
{% if class %}{{ field|add_class:class }}{% else %}{{ field }}{% endif %}
{% if field.help_text %}<span class="help-block">{{ field.help_text }}</span>{% endif %}
{% if field.help_text %}<p class="help-block"><small>{{ field.help_text }}</small></p>{% endif %}
{% if field.errors %}<span class="help-inline">{% for error in field.errors %}{{ error }}{% endfor %}</span>{% endif %}
</div>
</div>

View File

@@ -9,8 +9,10 @@
<meta name="author" content="">
<link href="{{ STATIC_URL }}css/bootstrap.css" rel="stylesheet">
<style>
body {
padding-top: 60px; /* 60px to make the container go all the way to the bottom of the topbar */
body { padding-top: 60px; }
div.navbar-inner {
background-color: #204066;
background-image: url(https://forum.pleaseignore.com/public/style_images/master/branding_bg.png);
}
</style>
<link href="{{ STATIC_URL }}css/bootstrap-responsive.css" rel="stylesheet">