Permalink
Browse files

Fleshing out account details page for #6

We need the details page to facilitate editing and deleting an account.
  • Loading branch information...
1 parent b556130 commit ba14ffc987b490a2f81e0dadfd0481b1eac969af @Dylnuge Dylnuge committed Apr 12, 2012
Showing with 22 additions and 4 deletions.
  1. +13 −3 treasureapp/templates/accounts/detail.html
  2. +9 −1 treasureapp/views.py
@@ -4,14 +4,24 @@
{% block content %}
-<h1>Accounts</h1>
+<h1>{{ account.name }}</h1>
+<h2>Balance: {{ account.balance }}</h2>
+
+{% if account.description %}
+<h2>Description:</h2>
+
+<p>
+{{ account.description }}
+</p>
+
+{% endif %}
<!-- Controls to make a new account -->
<p>
-<a href="{% url account_create %}" class="btn btn-primary btn-large">
- Make new account
+<a href="{% url account_update account.pk %}" class="btn btn-primary btn-large">
+ Update this account
</a>
</p>
View
@@ -50,7 +50,15 @@ def account_detail(request, account_id):
On GET, it will return details on the account numbered account_id.
"""
- context = RequestContext(request, {"section":"accounts"})
+ # Grab the account (or 404, of course)
+ account = get_object_or_404(Account, pk=account_id)
+
+ # TODO: Signal logic, people
+ account.update_balance()
+
+ # Pass it back out to the renderer
+ context = RequestContext(request, {"section":"accounts",
+ "account":account})
return render_to_response("accounts/detail.html", context)
def account_create(request, *args, **kargs):

0 comments on commit ba14ffc

Please sign in to comment.