-
Notifications
You must be signed in to change notification settings - Fork 803
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
45 changed files
with
1,704 additions
and
149 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,38 @@ | ||
from django.contrib.admin import SimpleListFilter | ||
from django.utils import timezone | ||
|
||
|
||
class ChallengeFilter(SimpleListFilter): | ||
|
||
title = "Challenges" | ||
parameter_name = "challenge" | ||
|
||
def lookups(self, request, model_admin): | ||
options = [ | ||
("past", "Past"), | ||
("present", "Ongoing"), | ||
("future", "Upcoming"), | ||
] | ||
return options | ||
|
||
def queryset(self, request, queryset): | ||
q_params = { | ||
"published": True, | ||
"approved_by_admin": True, | ||
"is_disabled": False, | ||
} | ||
if self.value() == "past": | ||
q_params["end_date__lt"] = timezone.now() | ||
challenges = queryset.filter(**q_params) | ||
return challenges | ||
|
||
elif self.value() == "present": | ||
q_params["start_date__lt"] = timezone.now() | ||
q_params["end_date__gt"] = timezone.now() | ||
challenges = queryset.filter(**q_params) | ||
return challenges | ||
|
||
elif self.value() == "future": | ||
q_params["start_date__gt"] = timezone.now() | ||
challenges = queryset.filter(**q_params) | ||
return challenges |
21 changes: 21 additions & 0 deletions
21
apps/challenges/migrations/0058_adding_environment_url_for_rl_challenges.py
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
# -*- coding: utf-8 -*- | ||
# Generated by Django 1.11.20 on 2019-07-17 09:25 | ||
from __future__ import unicode_literals | ||
|
||
import django.core.validators | ||
from django.db import migrations, models | ||
|
||
|
||
class Migration(migrations.Migration): | ||
|
||
dependencies = [ | ||
('challenges', '0058_add_show_leaderboard_by_latest_submission_field_in_challenge_phase_split_model'), | ||
] | ||
|
||
operations = [ | ||
migrations.AddField( | ||
model_name='challengephase', | ||
name='environment_url', | ||
field=models.CharField(max_length=2128, null=True, validators=[django.core.validators.URLValidator()]), | ||
), | ||
] |
26 changes: 26 additions & 0 deletions
26
apps/challenges/migrations/0059_add_blank_in_phase_environment_url.py
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
# -*- coding: utf-8 -*- | ||
# Generated by Django 1.11.23 on 2019-12-24 17:28 | ||
from __future__ import unicode_literals | ||
|
||
import django.core.validators | ||
from django.db import migrations, models | ||
|
||
|
||
class Migration(migrations.Migration): | ||
|
||
dependencies = [ | ||
("challenges", "0058_adding_environment_url_for_rl_challenges") | ||
] | ||
|
||
operations = [ | ||
migrations.AlterField( | ||
model_name="challengephase", | ||
name="environment_url", | ||
field=models.CharField( | ||
blank=True, | ||
max_length=2128, | ||
null=True, | ||
validators=[django.core.validators.URLValidator()], | ||
), | ||
) | ||
] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.