Skip to content

Commit

Permalink
update bounty expiry date to hackthon end date (#8698)
Browse files Browse the repository at this point in the history
* update bounty expiry date to hackthon end date

* Update change_form.html

* Update admin.py
  • Loading branch information
thelostone-mc authored Apr 1, 2021
1 parent 64f3b0b commit f087098
Show file tree
Hide file tree
Showing 5 changed files with 20 additions and 3 deletions.
3 changes: 2 additions & 1 deletion app/app/db.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import random

from django.conf import settings

import random

class PrimaryDBRouter:
def db_for_read(self, model, **hints):
Expand Down
14 changes: 14 additions & 0 deletions app/dashboard/admin.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@
from __future__ import unicode_literals

from django.contrib import admin
from django.shortcuts import redirect
from django.utils import timezone
from django.utils.html import format_html
from django.utils.safestring import mark_safe
Expand Down Expand Up @@ -486,6 +487,19 @@ def explorer_link(self, instance):
return mark_safe(f'<a href="{url}">Explorer Link</a>')


def response_change(self, request, obj):
if "_bulk_update_expiry" in request.POST:
try:
bounties_to_extend = Bounty.objects.filter(event=obj)
for bounty in bounties_to_extend:
bounty.expires_date=obj.end_date
bounty.save()
self.message_user(request, "updated hackthon bounties expiry dates")
except Exception as e:
print(e)
self.message_user(request, "unable to update bounty expiry dates")
return redirect(obj.admin_url)

class CouponAdmin(admin.ModelAdmin):
"""The admin object to maintain discount coupons for bounty"""

Expand Down
3 changes: 2 additions & 1 deletion app/grants/management/commands/update_contributor_address.py
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@
"""

from django.core.management.base import BaseCommand

import requests
from dashboard.utils import get_web3
from grants.models import Subscription
Expand Down Expand Up @@ -89,4 +90,4 @@ def handle(self, *args, **options):
except Exception as e:
print(f'Skipping: Error when fetching from_address for transaction hash {subscription.split_tx_id}')
print(e)
print("\n")
print("\n")
1 change: 0 additions & 1 deletion app/grants/tasks.py
Original file line number Diff line number Diff line change
Expand Up @@ -390,4 +390,3 @@ def save_contribution(self, contrib_id):
from grants.models import Contribution
contrib = Contribution.objects.get(pk=contrib_id)
contrib.save()

2 changes: 2 additions & 0 deletions app/retail/templates/admin/change_form.html
Original file line number Diff line number Diff line change
Expand Up @@ -89,6 +89,8 @@
<input type="submit" value="Change Owner to Gitcoin" name="_change_owner" value="1">
{% elif 'quests/quest' in request.build_absolute_uri %}
<input type="submit" value="Approve Request" name="_approve_quest" value="1">
{% elif 'dashboard/hackathonevent/' in request.build_absolute_uri %}
<input type="submit" value="Update Related Bounties Expiry Date" name="_bulk_update_expiry" value="1">
{% endif %}
</div>
{% endblock %}

0 comments on commit f087098

Please sign in to comment.