瀏覽代碼

bug fix: show default profile pic in markets page when no profile pic set for user

control 3 年之前
父節點
當前提交
93abd6ae2d
共有 6 個文件被更改,包括 71 次插入6 次删除
  1. 1 0
      Pipfile
  2. 48 1
      Pipfile.lock
  3. 12 0
      app/__init__.py
  4. 二進制
      app/database.db
  5. 二進制
      app/static/repository/jQ0pHk4RfCc8e7MC.jpeg
  6. 10 5
      app/templates/market.html

+ 1 - 0
Pipfile

@@ -12,6 +12,7 @@ flask-sqlalchemy = "*"
 flask-talisman = "*"
 flask-wtf = "*"
 apscheduler = "*"
+stripe = "*"
 
 [dev-packages]
 

+ 48 - 1
Pipfile.lock

@@ -1,7 +1,7 @@
 {
     "_meta": {
         "hash": {
-            "sha256": "8301bf8a94a694022c59821fe409ebeb52f5b6fe320da4fd597792d717319937"
+            "sha256": "1360cbb213fb2257619fc671fa456028c72f1ec9b4968a6086c7cc5691dff31c"
         },
         "pipfile-spec": 6,
         "requires": {
@@ -24,6 +24,21 @@
             "index": "pypi",
             "version": "==3.9.1"
         },
+        "certifi": {
+            "hashes": [
+                "sha256:78884e7c1d4b00ce3cea67b44566851c4343c120abd683433ce934a68ea58872",
+                "sha256:d62a0163eb4c2344ac042ab2bdf75399a71a2d8c7d47eac2e2ee91b9d6339569"
+            ],
+            "version": "==2021.10.8"
+        },
+        "charset-normalizer": {
+            "hashes": [
+                "sha256:2857e29ff0d34db842cd7ca3230549d1a697f96ee6d3fb071cfa6c7393832597",
+                "sha256:6881edbebdb17b39b4eaaa821b438bf6eddffb4468cf344f09f89def34a8b1df"
+            ],
+            "markers": "python_version >= '3'",
+            "version": "==2.0.12"
+        },
         "click": {
             "hashes": [
                 "sha256:24e1a4a9ec5bf6299411369b208c1df2188d9eb8d916302fe6bf03faed227f1e",
@@ -133,6 +148,14 @@
             "markers": "python_version >= '3' and platform_machine == 'aarch64' or (platform_machine == 'ppc64le' or (platform_machine == 'x86_64' or (platform_machine == 'amd64' or (platform_machine == 'AMD64' or (platform_machine == 'win32' or platform_machine == 'WIN32')))))",
             "version": "==1.1.2"
         },
+        "idna": {
+            "hashes": [
+                "sha256:84d9dd047ffa80596e0f246e2eab0b391788b0503584e8945f2368256d2735ff",
+                "sha256:9d643ff0a55b762d5cdb124b8eaa99c66322e2157b69160bc32796e824360e6d"
+            ],
+            "markers": "python_version >= '3'",
+            "version": "==3.3"
+        },
         "importlib-metadata": {
             "hashes": [
                 "sha256:1208431ca90a8cca1a6b8af391bb53c1a2db74e5d1cef6ddced95d4b2062edc6",
@@ -218,6 +241,14 @@
             "markers": "python_version >= '2.7' and python_version not in '3.0, 3.1, 3.2, 3.3, 3.4, 3.5'",
             "version": "==0.1.0.post0"
         },
+        "requests": {
+            "hashes": [
+                "sha256:68d7c56fd5a8999887728ef304a6d12edc7be74f1cfa47714fc8b414525c9a61",
+                "sha256:f22fa1e554c9ddfd16e6e41ac79759e17be9e492b3587efa038054674760e72d"
+            ],
+            "markers": "python_version >= '3'",
+            "version": "==2.27.1"
+        },
         "setuptools": {
             "hashes": [
                 "sha256:7999cbd87f1b6e1f33bf47efa368b224bed5e27b5ef2c4d46580186cbcb1a86a",
@@ -276,6 +307,14 @@
             "index": "pypi",
             "version": "==1.4.35"
         },
+        "stripe": {
+            "hashes": [
+                "sha256:7e3f50e844913e036f5419d73274315ae0d72315d36d3f791fdb572b1e84660c",
+                "sha256:ed8897f68e6bac3398cc998eb5634551840630d6504c0026fcfd0ad91c9a74a4"
+            ],
+            "index": "pypi",
+            "version": "==2.70.0"
+        },
         "tzdata": {
             "hashes": [
                 "sha256:238e70234214138ed7b4e8a0fab0e5e13872edab3be586ab8198c407620e2ab9",
@@ -292,6 +331,14 @@
             "markers": "python_version >= '3.6'",
             "version": "==4.2"
         },
+        "urllib3": {
+            "hashes": [
+                "sha256:44ece4d53fb1706f667c9bd1c648f5469a2ec925fcf3a776667042d645472c14",
+                "sha256:aabaf16477806a5e1dd19aa41f8c2b7950dd3c746362d7e3223dbe6de6ac448e"
+            ],
+            "markers": "python_version >= '2.7' and python_version not in '3.0, 3.1, 3.2, 3.3, 3.4' and python_version < '4'",
+            "version": "==1.26.9"
+        },
         "werkzeug": {
             "hashes": [
                 "sha256:3c5493ece8268fecdcdc9c0b112211acd006354723b280d643ec732b6d4063d6",

+ 12 - 0
app/__init__.py

@@ -6,6 +6,9 @@ from os import path
 # Talisman
 from flask_talisman import Talisman
 
+# Stripe
+import stripe
+
 db = SQLAlchemy()
 DB_NAME = "database.db"
 
@@ -48,6 +51,15 @@ def create_app():
     # Talisman
     Talisman(app)
 
+    # Stripe
+    stripe_keys = {
+            "secret_key" : "sk_test_51KmKkAF0esudExGd5hSSlMUzVEyxK49zfmSlhhU0rHsVCQoSTkIyXalqLe1pUgDmpbLVU4huIuDeDzPOCXp2gFJB00n7X7PMf9",
+        "publishable_key" : "pk_test_51KmKkAF0esudExGdIscDaqn3Q4Sr5YJAu8X1yhjFerNe90HYgyjkk0tzakICpWyV8jE78m43ME2gSp2CXKg2L14I00wFIb0tQW"
+        }
+
+    stripe.api_key = stripe_keys['secret_key']
+
+
     return app
 
 def create_database(app):

二進制
app/database.db


二進制
app/static/repository/jQ0pHk4RfCc8e7MC.jpeg


+ 10 - 5
app/templates/market.html

@@ -15,7 +15,6 @@
     <div class="row row-cols-4">
         {% for art in listings %}
         <div class="card col-md-3 grid-item shadow p-3 mb-5 bg-white rounded">
-            <!--<a href="detail"><img class="market_each_bid_image_size" src="static/repository/{{art[5]}}"></a>-->
             <form method="POST">
             <button name="focus_but" type="submit" class="btn btn-link" value="{{art[11]}}"><img class="market_each_bid_image_size" src="static/repository/{{art[5]}}"></button>
             </form>
@@ -23,12 +22,18 @@
                 <b>{{art[0]}}</b>
             </div>
             <div class="row">
-                <p id="market_item_text_left">Current Bid {{art[12]}}</p>
-                <p id="market_item_text_right">(Price) <span class="price-span">USD</span></p>
+                <p id="market_item_text_left">Last Bid: {{art[12]}}</p>
+                <p id="market_item_text_right"><span class="price-span">USD</span></p>
             </div>
             <div class="row">
-                <p id="market_item_text_left">Creator</p>
-            <p id="market_item_text_right"><img src="static/uploads/{{art[4]}}" height=25 width=25>{{art[3]}}</p>
+                <p id="market_item_text_left">Creator: {{art[3]}}</p>
+            <p id="market_item_text_right">
+            {% if art[4] %}
+                <img src="static/uploads/{{art[4]}}" height=25 width=25>
+            {% else %}
+                <img src="static/templates/defaultprofileimg.png" height=25 width=25>
+            {% endif %}
+            </p>
             </div>
         </div>
         {% endfor %}