mark winner
-
+
+
winner
diff --git a/app/dashboard/admin.py b/app/dashboard/admin.py
index 8520b8961ed..83b2187d5b6 100644
--- a/app/dashboard/admin.py
+++ b/app/dashboard/admin.py
@@ -454,7 +454,7 @@ class HackathonRegistrationAdmin(admin.ModelAdmin):
class HackathonProjectAdmin(admin.ModelAdmin):
- list_display = ['pk', 'img', 'name', 'bounty', 'hackathon_link', 'usernames', 'status', 'sponsor']
+ list_display = ['pk', 'img', 'name', 'bounty', 'hackathon_link', 'grant_obj', 'usernames', 'status', 'sponsor']
raw_id_fields = ['profiles', 'bounty', 'hackathon']
search_fields = ['name', 'summary', 'status']
diff --git a/app/dashboard/migrations/0154_hackathonproject_grant_obj.py b/app/dashboard/migrations/0154_hackathonproject_grant_obj.py
new file mode 100644
index 00000000000..836c697e995
--- /dev/null
+++ b/app/dashboard/migrations/0154_hackathonproject_grant_obj.py
@@ -0,0 +1,20 @@
+# Generated by Django 2.2.4 on 2020-10-07 13:20
+
+from django.db import migrations, models
+import django.db.models.deletion
+
+
+class Migration(migrations.Migration):
+
+ dependencies = [
+ ('grants', '0088_auto_20200924_1536'),
+ ('dashboard', '0153_hackathonevent_use_circle'),
+ ]
+
+ operations = [
+ migrations.AddField(
+ model_name='hackathonproject',
+ name='grant_obj',
+ field=models.ForeignKey(blank=True, help_text='Link to grant if project is converted to grant', null=True, on_delete=django.db.models.deletion.SET_NULL, to='grants.Grant'),
+ ),
+ ]
diff --git a/app/dashboard/models.py b/app/dashboard/models.py
index 82f55b5d218..683881534cc 100644
--- a/app/dashboard/models.py
+++ b/app/dashboard/models.py
@@ -5120,6 +5120,13 @@ class HackathonProject(SuperModel):
chat_channel_id = models.CharField(max_length=255, blank=True, null=True)
winner = models.BooleanField(default=False)
extra = JSONField(default=dict, blank=True, null=True)
+ grant_obj = models.ForeignKey(
+ 'grants.Grant',
+ null=True,
+ blank=True,
+ on_delete=models.SET_NULL,
+ help_text=_('Link to grant if project is converted to grant')
+ )
class Meta:
ordering = ['-name']
@@ -5177,6 +5184,7 @@ def to_json(self):
'paid': paid,
'payment_date': date(submission.accepted_on, 'Y-m-d H:i') if paid else '',
'winner': self.winner,
+ 'grant_obj': self.grant_obj,
'extra': self.extra,
'timestamp': submission.created_on.timestamp() if submission else 0
}
diff --git a/app/dashboard/router.py b/app/dashboard/router.py
index 074382c15cb..563ef57970e 100644
--- a/app/dashboard/router.py
+++ b/app/dashboard/router.py
@@ -212,7 +212,7 @@ class HackathonProjectSerializer(serializers.ModelSerializer):
class Meta:
model = HackathonProject
- fields = ('pk', 'chat_channel_id', 'status', 'badge', 'bounty', 'name', 'summary', 'work_url', 'profiles', 'hackathon', 'summary', 'logo', 'message', 'looking_members', 'winner', 'admin_url')
+ fields = ('pk', 'chat_channel_id', 'status', 'badge', 'bounty', 'name', 'summary', 'work_url', 'profiles', 'hackathon', 'summary', 'logo', 'message', 'looking_members', 'winner', 'grant_obj', 'admin_url')
depth = 1
@@ -252,7 +252,7 @@ def get_queryset(self):
hackathon_event = HackathonEvent.objects.last()
queryset = HackathonProject.objects.filter(hackathon=hackathon_event).exclude(
- status='invalid').prefetch_related('profiles', 'bounty').order_by('-winner', order_by, 'id')
+ status='invalid').prefetch_related('profiles', 'bounty').order_by('-winner', 'grant_obj', order_by, 'id')
if sponsor:
queryset = queryset.filter(
@@ -261,7 +261,7 @@ def get_queryset(self):
elif sponsor:
queryset = HackathonProject.objects.filter(Q(hackathon__sponsor_profiles__handle__iexact=sponsor) | Q(
bounty__bounty_owner_github_username=sponsor)).exclude(
- status='invalid').prefetch_related('profiles', 'bounty').order_by('-winner', order_by, 'id')
+ status='invalid').prefetch_related('profiles', 'bounty').order_by('-winner', 'grant_obj', order_by, 'id')
projects = []
for project in queryset:
@@ -283,7 +283,6 @@ def get_queryset(self):
queryset = queryset.filter(
Q(profiles__keywords__icontains=skills)
)
-
if rating:
queryset = queryset.filter(
Q(rating__gte=rating)
@@ -293,6 +292,10 @@ def get_queryset(self):
queryset = queryset.filter(
Q(winner=True)
)
+ if 'grants' in filters:
+ queryset = queryset.filter(
+ Q(grant_obj__isnull=False)
+ )
if 'lfm' in filters:
queryset = queryset.filter(
Q(looking_members=True)
diff --git a/app/dashboard/templates/dashboard/hackathon/project_page.html b/app/dashboard/templates/dashboard/hackathon/project_page.html
index 64d7915f4b0..18efce8a9b4 100644
--- a/app/dashboard/templates/dashboard/hackathon/project_page.html
+++ b/app/dashboard/templates/dashboard/hackathon/project_page.html
@@ -64,20 +64,26 @@
{% trans "View Admin" %}
{% endif %}
-
-
-
- {% if is_member %}
-
- {% endif %}
-
-
- {% include 'project/detail/info.html' %}
-
+
+
+
+ {% if project_obj.grant_url %}
+
+ {% endif %}
+
+ {% if is_member %}
+ {% if not project_obj.grant_url %}
+
+ {% endif %}
+
+ {% endif %}
+
+
+
+ {% include 'project/detail/info.html' %}
-
{% include 'shared/bottom_notification.html' %}
{% include 'shared/analytics.html' %}
{% include 'shared/footer_scripts.html' with ignore_inject_web3=1 vue=True %}
diff --git a/app/dashboard/templates/dashboard/index-vue.html b/app/dashboard/templates/dashboard/index-vue.html
index 9e505c70808..3401ea9a220 100644
--- a/app/dashboard/templates/dashboard/index-vue.html
+++ b/app/dashboard/templates/dashboard/index-vue.html
@@ -279,6 +279,9 @@
Hackathon Coming Soon!
Looking for Members
+
+ Grants
+
@@ -299,8 +302,6 @@
Hackathon Coming Soon!
-
-
[[ numProjects ]] projects found
diff --git a/app/dashboard/templates/profiles/tribes-vue.html b/app/dashboard/templates/profiles/tribes-vue.html
index 29d32d62014..1c692a2ed4e 100644
--- a/app/dashboard/templates/profiles/tribes-vue.html
+++ b/app/dashboard/templates/profiles/tribes-vue.html
@@ -518,6 +518,14 @@
[[ numProjects ]] projects found
+
+
+ Winners
+
+
+ Grants
+
+
diff --git a/app/dashboard/views.py b/app/dashboard/views.py
index b47ef1a176b..eafa295ef73 100644
--- a/app/dashboard/views.py
+++ b/app/dashboard/views.py
@@ -86,6 +86,7 @@
from git.utils import (
get_auth_url, get_gh_issue_details, get_github_user_data, get_url_dict, is_github_token_valid, search_users,
)
+from grants.models import Grant
from kudos.models import KudosTransfer, Token, Wallet
from kudos.utils import humanize_name
from mailchimp3 import MailChimp
@@ -4317,6 +4318,12 @@ def hackathon_projects(request, hackathon='', specify_project=''):
projects = projects.filter(
Q(badge__isnull=False)
)
+
+ if filters == 'grants':
+ projects = projects.filter(
+ Q(grant_obj__isnull=False)
+ )
+
if specify_project:
projects = projects.filter(name__iexact=specify_project.replace('-', ' '))
if projects.exists():
@@ -4486,10 +4493,17 @@ def hackathon_save_project(request):
def get_project(request, project_id):
profile = request.user.profile if request.user.is_authenticated and hasattr(request.user, 'profile') else None
- project = HackathonProject.objects.filter(pk=project_id).nocache().first()
- if not project:
+ params = project_data(project_id)
+ if not params:
raise Http404("The project doesnt exists.")
+ return JsonResponse(params)
+
+def project_data(project_id):
+ project = HackathonProject.objects.filter(pk=project_id).nocache().first()
+ if not project:
+ return None
+
hackathon_obj = HackathonEventSerializer(project.hackathon).data,
params = {
'project': {
@@ -4515,18 +4529,19 @@ def get_project(request, project_id):
'url': member_profile.url,
'handle': member_profile.handle,
'avatar': member_profile.avatar_url
- } for member_profile in project.profiles.all()]
+ } for member_profile in project.profiles.all()],
+ 'team_members_profile': project.profiles.all()
},
'hackathon': hackathon_obj[0],
}
+ return params
- return JsonResponse(params)
-
-
+
def hackathon_project_page(request, hackathon, project_id, project_name, tab=''):
profile = request.user.profile if request.user.is_authenticated and hasattr(request.user, 'profile') else None
project = HackathonProject.objects.filter(pk=project_id).nocache().first()
+
if not project:
raise Http404("No Hackathon Project matches the given query.")
@@ -4573,7 +4588,8 @@ def hackathon_project_page(request, hackathon, project_id, project_name, tab='')
'url': member_profile.url,
'handle': member_profile.handle,
'avatar': member_profile.avatar_url
- } for member_profile in project.profiles.all()]
+ } for member_profile in project.profiles.all()],
+ 'grant_url': project.grant_obj.url if project.grant_obj else False
},
'hackathon_obj': hackathon_obj[0],
'hackathon': hackathon,
diff --git a/app/grants/templates/grants/new.html b/app/grants/templates/grants/new.html
index c45f5883a71..f4117f2825c 100644
--- a/app/grants/templates/grants/new.html
+++ b/app/grants/templates/grants/new.html
@@ -77,24 +77,28 @@
Project Information
-
+
-
+
@@ -111,7 +115,7 @@
Project Information
-
+
Categorization Information
@@ -163,6 +167,7 @@
Funding Information