Remove Tx model
There was a split between a transaction request and an actual transaction. This was kind of annoying because transactions were one-way only, while transaction requests were two-way - which is what I believe most transactions will be using. Tx model has been removed and the responsibilities of it are covered by TxRequest. It simplifies everything surrounding transactions, since we have only one model to deal with instead of two. Signed-off-by: Alek Ratzloff <alekratz@gmail.com>
This commit is contained in:
@@ -14,19 +14,14 @@
|
||||
<table class="table">
|
||||
<thead>
|
||||
<tr>
|
||||
<th>Commodity</th>
|
||||
<th>Delta</th>
|
||||
<th>Transaction ID</th>
|
||||
<th>Commodity sent</th>
|
||||
<th>Commodity received</th>
|
||||
<th>Status</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
<tr>
|
||||
<td><a href="{% url "trading:commodity_detail" object.commodity.pk %}">{{ object.commodity.name }}</a></td>
|
||||
<td>
|
||||
<span class="{% if object.source == request.user %}debit{% else %}credit{% endif %}">
|
||||
{{object.amount|intcomma}}
|
||||
</span>
|
||||
</td>
|
||||
</tr>
|
||||
{% include "trading/t/detail_row.html" %}
|
||||
</tbody>
|
||||
</table>
|
||||
</div>
|
||||
|
||||
12
trading/templates/trading/t/detail_row.html
Normal file
12
trading/templates/trading/t/detail_row.html
Normal file
@@ -0,0 +1,12 @@
|
||||
<tr>
|
||||
<td><a href="{% url "trading:tx_detail" object.id %}">{{object.id}}</a></td>
|
||||
{% if object.source == request.user %}
|
||||
<td>{{object.source_amount}}x {{object.source_sends.name}}</td>
|
||||
<td>{{object.dest_amount}}x {{object.dest_sends.name}}</td>
|
||||
{% else %}
|
||||
<td>{{object.dest_amount}}x {{object.dest_sends.name}}</td>
|
||||
<td>{{object.source_amount}}x {{object.source_sends.name}}</td>
|
||||
{% endif %}
|
||||
<td>{{object.status | title}}</td>
|
||||
</tr>
|
||||
|
||||
@@ -14,26 +14,15 @@
|
||||
<table class="table">
|
||||
<thead>
|
||||
<tr>
|
||||
<th>Commodity</th>
|
||||
<th>Delta</th>
|
||||
<th>Transaction ID</th>
|
||||
<th>Commodity sent</th>
|
||||
<th>Commodity received</th>
|
||||
<th>Status</th>
|
||||
<th>Source</th>
|
||||
<th>Destination</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
{% for object in object_list %}
|
||||
<tr>
|
||||
<td><a href="{% url "trading:commodity_detail" object.commodity.pk %}">{{ object.commodity.name }}</a></td>
|
||||
<td>
|
||||
<span class="{% if object.source == request.user %}debit{% else %}credit{% endif %}">
|
||||
{{object.amount|intcomma}}
|
||||
</span>
|
||||
</td>
|
||||
<td>{{object.status}}</td>
|
||||
<td>{{object.source.username}}</td>
|
||||
<td>{{object.dest.username}}</td>
|
||||
</tr>
|
||||
{% include "trading/t/detail_row.html" %}
|
||||
{% endfor %}
|
||||
</tbody>
|
||||
</table>
|
||||
|
||||
Reference in New Issue
Block a user