Skip to content

Commit f4d7ffe

Browse files
authored
Merge pull request #9305 from gitcoinco/GITC-212--refresh-hacks
GITC-212: Adds button to admin to refresh hackathon events cache
2 parents 622c3ac + 0ebac7a commit f4d7ffe

File tree

2 files changed

+11
-1
lines changed

2 files changed

+11
-1
lines changed

app/dashboard/admin.py

+9
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,7 @@
3535
TransactionHistory, TribeMember, TribesSubscription, UserAction, UserVerificationModel,
3636
)
3737

38+
from perftools.management.commands import create_page_cache
3839

3940
class BountyEventAdmin(admin.ModelAdmin):
4041
list_display = ['created_on', '__str__', 'event_type']
@@ -501,6 +502,14 @@ def response_change(self, request, obj):
501502
except Exception as e:
502503
print(e)
503504
self.message_user(request, "unable to update bounty expiry dates")
505+
elif "_update_hackathon_events_cache" in request.POST:
506+
try:
507+
create_page_cache.create_hackathon_list_page_cache()
508+
self.message_user(request, "updated hackthon events cache")
509+
except Exception as e:
510+
print(e)
511+
self.message_user(request, "unable to update hackathon events cache")
512+
504513
return redirect(obj.admin_url)
505514

506515
class CouponAdmin(admin.ModelAdmin):

app/retail/templates/admin/change_form.html

+2-1
Original file line numberDiff line numberDiff line change
@@ -62,7 +62,7 @@
6262
{% if not original.active %}
6363
<textarea name="more_info" style="background-color:white; color: black; border: 1px solid;">Can you prove your ownership of this brand?</textarea>
6464
<input type="submit" value="Request More Info" name="_request_more_info" value="1">
65-
|
65+
|
6666
<input type="submit" value="Approve Grant" name="_approve_grant" value="1">
6767
{% else %}
6868
N/A
@@ -106,6 +106,7 @@ <h4>Sync'er</h4>
106106
<input type="submit" value="Approve Request" name="_approve_quest" value="1">
107107
{% elif 'dashboard/hackathonevent/' in request.build_absolute_uri %}
108108
<input type="submit" value="Update Related Bounties Expiry Date" name="_bulk_update_expiry" value="1">
109+
<input type="submit" value="Update Hackathon Events Cache" name="_update_hackathon_events_cache" value="1">
109110
{% endif %}
110111
</div>
111112
{% endblock %}

0 commit comments

Comments
 (0)