pixabay https://cdn.pixabay.com/photo/2019/05/14/17/07/web-development-4202909_1280.png https://peakd.com/hive-105017/@june0620/python-12-django-5-template-tags-filters 在这个帖子的最后一个图片可以看出,7日前的收益都显示0了,当然这不是区块链的问题,是我的问题啦。 我在网页显示收益值是用 pending_payout_value 值,但帖子过7日这个值便会变成0。 再看了看 get_blog 函数,7日前的帖子可以用 total_payout_value 应该就OK👌了。 把`若 pending_payout_value 没有值改用 total_payout_value 值`这个放到 django 的 templatetags.py 文件里,注册过滤器应该没问题了。 ``` @register.filter def get_payout_value(post_data: dict): value = post_data['pending_payout_value'] if value.startswith("0.000"): value = post_data['total_payout_value'] return value ``` html 文件也改用上述过滤器,成功了~ 😄 ``` ... <small class="text-muted">보상 {{ post.comment | get_payout_value }} </small> ... ```  *** **[Cookie 😅]** Python 3.7.4 Django 2.2.4 steem-python 1.0.1 goorm IDE 1.3 参考文章: https://amoreopensource.wordpress.com/2019/04/23/access-jsonfield-in-django-templates-like-a-dictionary/
author | june0620 |
---|---|
permlink | python-16-django-9-7-0 |
category | hive-105017 |
json_metadata | {"app":"peakd/2020.08.3","format":"markdown","tags":["cn","dblog","dev","django","whalepower","palnet","python"],"users":["june0620","register.filter"],"links":["https://peakd.com/hive-105017/@june0620/python-12-django-5-template-tags-filters","https://amoreopensource.wordpress.com/2019/04/23/access-jsonfield-in-django-templates-like-a-dictionary/"],"image":["https://cdn.pixabay.com/photo/2019/05/14/17/07/web-development-4202909_1280.png","https://cdn.steemitimages.com/DQmaySZF3ebUuo67LKNzqFp2Z7PxULgjZgTUQtYXAbnbTAq/image.png"]} |
created | 2020-09-03 12:24:21 |
last_update | 2020-09-03 12:24:21 |
depth | 0 |
children | 2 |
last_payout | 2020-09-10 12:24:21 |
cashout_time | 1969-12-31 23:59:59 |
total_payout_value | 0.930 HBD |
curator_payout_value | 0.806 HBD |
pending_payout_value | 0.000 HBD |
promoted | 0.000 HBD |
body_length | 1,040 |
author_reputation | 118,592,211,436,406 |
root_title | "[Python #16] [Django #9] 修改漏洞,7日前的文章收益显示为0的问题。" |
beneficiaries | [] |
max_accepted_payout | 1,000,000.000 HBD |
percent_hbd | 0 |
post_id | 99,427,269 |
net_rshares | 7,412,052,783,483 |
author_curate_reward | "" |
voter | weight | wgt% | rshares | pct | time |
---|---|---|---|---|---|
slowwalker | 0 | 53,245,036,419 | 50% | ||
tumutanzi | 0 | 926,146,203 | 50% | ||
oldstone | 0 | 17,776,813,360 | 50% | ||
coldhair | 0 | 892,445,338 | 50% | ||
lotusofmymom | 0 | 466,813,165 | 50% | ||
shenchensucc | 0 | 16,854,929,551 | 30% | ||
tipu | 0 | 2,967,547,750,990 | 8% | ||
kimzwarch | 0 | 8,793,757,574 | 4% | ||
june0620 | 0 | 532,209,033,376 | 100% | ||
minloulou | 0 | 2,265,514,790 | 10% | ||
victory622 | 0 | 27,842,516,565 | 16% | ||
lindalex | 0 | 580,349,302 | 50% | ||
cnbuddy | 0 | 938,104,483,102 | 100% | ||
itchyfeetdonica | 0 | 51,262,053,386 | 50% | ||
nokodemion | 0 | 8,786,096,259 | 100% | ||
bartheek | 0 | 12,098,903,203 | 4% | ||
bji1203 | 0 | 94,830,495,455 | 100% | ||
suhunter | 0 | 961,902,227 | 50% | ||
udabeu | 0 | 9,807,020,701 | 30% | ||
jsj1215 | 0 | 3,760,271,394 | 100% | ||
yasu | 0 | 5,082,602,902 | 100% | ||
happy-soul | 0 | 23,187,439,622 | 4% | ||
realprince | 0 | 30,157,552,490 | 100% | ||
frassman | 0 | 2,069,767,898 | 12.5% | ||
gghite | 0 | 188,332,585,334 | 100% | ||
julialee66 | 0 | 1,110,573,478,812 | 8.5% | ||
andrewma | 0 | 11,381,825,643 | 50% | ||
jancharlest | 0 | 12,617,169,138 | 8% | ||
wisdomandjustice | 0 | 1,136,621,109 | 50% | ||
meins0815 | 0 | 11,258,066,766 | 23% | ||
crimo | 0 | 567,115,873 | 11.5% | ||
newsnownorthwest | 0 | 3,931,970,359 | 55% | ||
longer | 0 | 958,795,540 | 2% | ||
coder-bts | 0 | 4,641,132,042 | 50% | ||
donald.porter | 0 | 7,093,111,988 | 16% | ||
gerdtrudroepke | 0 | 7,610,131,948 | 15% | ||
daath | 0 | 612,501,608 | 100% | ||
smartvote | 0 | 132,647,286,020 | 6% | ||
veronicalee | 0 | 538,687,420 | 50% | ||
melaniewang | 0 | 8,181,740,507 | 50% | ||
changxiu | 0 | 5,053,333,843 | 50% | ||
bluengel | 0 | 15,395,306,855 | 100% | ||
laissez-faire | 0 | 60,455,665 | 100% | ||
cherryzz | 0 | 160,341,069,722 | 50% | ||
forecasteem | 0 | 72,249,409,263 | 100% | ||
moneytron | 0 | 5,629,616,396 | 100% | ||
mia-cc | 0 | 988,673,885 | 8% | ||
cpt-sparrow | 0 | 3,527,214,995 | 100% | ||
kryptogames | 0 | 39,186,682,503 | 8% | ||
tina3721 | 0 | 4,865,573,237 | 50% | ||
andyhsia | 0 | 7,813,031,255 | 100% | ||
minigame | 0 | 352,462,517,275 | 100% | ||
cryptogambit | 0 | 1,444,803,324 | 7.5% | ||
oldstone.sct | 0 | 566,337,213 | 50% | ||
tokenindustry | 0 | 3,176,123,577 | 80% | ||
bcm | 0 | 3,048,893,358 | 6% | ||
hongdangmu | 0 | 552,649,605 | 8.5% | ||
dappstats | 0 | 3,644,658,377 | 15% | ||
cnbuddy-reward | 0 | 73,953,636,152 | 100% | ||
roseofmylife | 0 | 2,690,951,727 | 50% | ||
real3earch | 0 | 9,365,603,542 | 100% | ||
steem-agora | 0 | 11,178,204,167 | 50% | ||
toni.pal | 0 | 0 | 0.62% | ||
kgsupport | 0 | 848,215,327 | 25% | ||
troll3838 | 0 | 530,052,534 | 100% | ||
lovequeen | 0 | 320,486,001,937 | 100% | ||
hydrodino | 0 | 532,273,300 | 100% | ||
godapp76 | 0 | 869,579,070 | 100% |
@tipu curate
author | annepink |
---|---|
permlink | qg31b7 |
category | hive-105017 |
json_metadata | {"users":["tipu"],"app":"hiveblog/0.1"} |
created | 2020-09-03 12:28:24 |
last_update | 2020-09-03 12:28:24 |
depth | 1 |
children | 1 |
last_payout | 2020-09-10 12:28:24 |
cashout_time | 1969-12-31 23:59:59 |
total_payout_value | 0.000 HBD |
curator_payout_value | 0.000 HBD |
pending_payout_value | 0.000 HBD |
promoted | 0.000 HBD |
body_length | 12 |
author_reputation | 1,032,326,288,444,586 |
root_title | "[Python #16] [Django #9] 修改漏洞,7日前的文章收益显示为0的问题。" |
beneficiaries | [] |
max_accepted_payout | 1,000,000.000 HBD |
percent_hbd | 10,000 |
post_id | 99,427,331 |
net_rshares | 0 |
<a href="https://tipu.online/hive_curator?annepink" target="_blank">Upvoted 👌</a> (Mana: 24/32)
author | tipu |
---|---|
permlink | re-qg31b7-20200903t122830 |
category | hive-105017 |
json_metadata | "" |
created | 2020-09-03 12:28:36 |
last_update | 2020-09-03 12:28:36 |
depth | 2 |
children | 0 |
last_payout | 2020-09-10 12:28:36 |
cashout_time | 1969-12-31 23:59:59 |
total_payout_value | 0.000 HBD |
curator_payout_value | 0.000 HBD |
pending_payout_value | 0.000 HBD |
promoted | 0.000 HBD |
body_length | 104 |
author_reputation | 55,937,652,527,393 |
root_title | "[Python #16] [Django #9] 修改漏洞,7日前的文章收益显示为0的问题。" |
beneficiaries | [] |
max_accepted_payout | 1,000,000.000 HBD |
percent_hbd | 10,000 |
post_id | 99,427,334 |
net_rshares | 0 |