Kaynağa Gözat

working backend for hashchain and txhash list

control 3 yıl önce
ebeveyn
işleme
5fbaab5b79

+ 5 - 3
app/dashboards.py

@@ -1,7 +1,7 @@
 from flask import Blueprint, render_template, request, flash, redirect, url_for
 from flask_login import login_required, current_user
 from werkzeug.security import generate_password_hash, check_password_hash
-from .models import User, Art, List, Bids, Wallet, Stripe
+from .models import User, Art, List, Bids, Wallet, Stripe, TX, Hashchain
 from . import db
 
 from . import dispatch
@@ -56,7 +56,6 @@ def profile():
 
 
     # Wallet Top Up Form
-    ##:
     if form3.validate_on_submit():
         amount = form3.amount.data
         raw_amount = int(amount*100) # converting to cents int for Stripe
@@ -246,4 +245,7 @@ def charge():
 
 @dashboards.route('/hashchain', methods=['GET'])
 def hashchain():
-    return render_template('hash.html', user = current_user)
+    hashchain = Hashchain.query.all()
+    txlist = TX.query.all()
+
+    return render_template('hash.html', user = current_user, hashchain = hashchain, txlist = txlist)

BIN
app/database.db


+ 1 - 0
app/models.py

@@ -25,6 +25,7 @@ class TX(db.Model):
 class Hashchain(db.Model):
     id = db.Column(db.Integer, primary_key=True)
     blockhash = db.Column(db.String(64))
+    mint_date = db.Column(db.DateTime(timezone=True), default=func.now()) 
 
 class Art(db.Model):
     id = db.Column(db.Integer, primary_key=True)

BIN
app/static/incoming/JI5I0xuTc4tKHQ19.jpeg


BIN
app/static/incoming/qdZMSHlBpx9PtNFX.jpeg


BIN
app/static/repository/aX8P2sE4J27J8KPm.jpeg


+ 0 - 0
app/static/incoming/VwpVttZR5uZDm7BS.jpg → app/static/repository/qoMyozKNS15XWDfb.jpg


+ 46 - 42
app/templates/hash.html

@@ -3,47 +3,51 @@
 {% block content %}
 
 <div class="col">
-    <div class="card">
-        <div class="container">
-            <ul class="nav nav-pills mb-3 nav-tabs" id="pills-tab" role="tablist">
-                <li class="nav-item">
-                    <a class="nav-link active" id="block-hash-tab" data-toggle="tab" href="#block-hash" role="tab" aria-controls="block-hash" aria-selected="true">Block Hash</a>
-                </li>
-                <li class="nav-item">
-                    <a class="nav-link" id="file-hash-tab" data-toggle="tab" href="#file-hash" role="tab" aria-controls="file-hash" aria-selected="false">File Hash</a>
-                </li>
-            </ul>
-            <div class="tab-content" id="myTabContent">
-                <div class="tab-pane fade show active" id="block-hash" role="tabpanel" aria-labelledby="block-hash-tab">   
-                    <table class="table">
-                        <thead class="thead-colour">
-                            <tr>
-                            <th>Date Time</th>
-                            <th>Hash</th>
-                            </tr>
-                        </thead>
-                        <tr>
-                            <td>(Date Time)</td>
-                            <td>(Hash)</td>
-                        </tr>
-                    </table>
-                </div>
-                <div class="tab-pane fade" id="file-hash" role="tabpanel" aria-labelledby="file-hash-tab">
-                    <table class="table">
-                        <thead class="thead-colour">
-                            <tr>
-                            <th>Date Time</th>
-                            <th>Hash</th>
-                            </tr>
-                        </thead>
-                        <tr>
-                            <td>(Date Time)</td>
-                            <td>(Hash)</td>
-                        </tr>
-                    </table>
-                </div>
-            </div>
-        </div>
-    </div>
+<div class="card">
+<div class="container">
+<ul class="nav nav-pills mb-3 nav-tabs" id="pills-tab" role="tablist">
+<li class="nav-item">
+<a class="nav-link active" id="block-hash-tab" data-toggle="tab" href="#block-hash" role="tab" aria-controls="block-hash" aria-selected="true">Block Hashlist</a>
+</li>
+<li class="nav-item">
+<a class="nav-link" id="file-hash-tab" data-toggle="tab" href="#file-hash" role="tab" aria-controls="file-hash" aria-selected="false">Transaction Hashlist</a>
+</li>
+</ul>
+<div class="tab-content" id="myTabContent">
+<div class="tab-pane fade show active" id="block-hash" role="tabpanel" aria-labelledby="block-hash-tab">   
+<table class="table">
+<thead class="thead-colour">
+<tr>
+<th>Block Mint Date</th>
+<th>Blockhash</th>
+</tr>
+</thead>
+{% for hash in hashchain %}
+<tr>
+    <td>{{ hash.mint_date }}</td>
+    <td>{{ hash.blockhash }}</td>
+</tr>
+{% endfor %}
+</table>
+</div>
+<div class="tab-pane fade" id="file-hash" role="tabpanel" aria-labelledby="file-hash-tab">
+<table class="table">
+<thead class="thead-colour">
+<tr>
+<th>Transaction Date</th>
+<th>Transaction Hash</th>
+</tr>
+</thead>
+{% for tx in txlist %}
+<tr>
+    <td>{{ tx.datetime }}</td>
+    <td>{{ tx.txhash }}</td>
+</tr>
+{% endfor %}
+</table>
+</div>
+</div>
+</div>
+</div>
 </div>
 {% endblock %}