-
Notifications
You must be signed in to change notification settings - Fork 39
S08 judging #103
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
stefdworschak
merged 27 commits into
Code-Institute-Community:master
from
Sarosim:S08-Judging
Oct 29, 2020
Merged
S08 judging #103
Changes from all commits
Commits
Show all changes
27 commits
Select commit
Hold shift + click to select a range
280c26d
Initial commit for S08-Judging
Sarosim 2d5539b
Add highest_score field to HPScoreCategory model
Sarosim 5edd8ca
In order to used the updated model, Merge branch 'S08-adjust-model' o…
Sarosim 6df7c73
Set up basic urls - views - template for Judging landing page
Sarosim fd26d6b
prepare context for judging landing page
Sarosim b33fce1
add min_score field, rename max_score and test both
Sarosim fde4081
Add score button for judges to the event they can judge
Sarosim 6e0b069
Pulling from upstream to update my dev branch
Sarosim 70a6d33
Add verifications to judging view
Sarosim 27b6db5
Pulling 20-Oct
Sarosim 7c7f0f9
Build the base for the template
Sarosim 4e150fb
Add custom tag for creating score dropdowns
Sarosim b816e10
Add my notes to .gitignore to avoid littering the repo
Sarosim ebad685
Fix merge conflicts after pulling from upstream
Sarosim b1863b6
Fix merge conflicts, delete sqlite and create a new, migrate
Sarosim b6f3a23
Finalise page layout for scoring
Sarosim b666642
Handle score submssion and save to model
Sarosim 972e718
Refactor code and finalise for PR
Sarosim e86250b
Pull changes from upstream and update
Sarosim 43fe928
Pull the latest PRs from upsteram and fix merge conflicts
Sarosim b95be71
Pull upstream 28/10 and fix merge conflicts
Sarosim 005fa9b
Fix PR change requests, migrations not made...
Sarosim 2b31055
Delete commented out code
Sarosim 0b8fc80
Solve the remaining two minor change requests for PR
Sarosim eb09710
Fix merge conflicts and migrations for PR
Sarosim c4a3ccf
Remove the admin from profiles.json and add accounts back to seed
Sarosim 98206df
Add blank line between 3rd party and local modules
Sarosim File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or 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 |
|---|---|---|
|
|
@@ -11,4 +11,4 @@ settings.json | |
| .gitpod.yml | ||
| venv/ | ||
| .idea/ | ||
| MYNOTES.md | ||
| MYNOTES.md | ||
This file contains hidden or 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 hidden or 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 @@ | ||
| # Generated by Django 3.1.1 on 2020-10-25 12:11 | ||
|
|
||
| from django.conf import settings | ||
| from django.db import migrations, models | ||
| import django.db.models.deletion | ||
|
|
||
|
|
||
| class Migration(migrations.Migration): | ||
|
|
||
| dependencies = [ | ||
| migrations.swappable_dependency(settings.AUTH_USER_MODEL), | ||
| ('hackathon', '0016_merge_20201024_1240'), | ||
| ] | ||
|
|
||
| operations = [ | ||
| migrations.AlterField( | ||
| model_name='hackproject', | ||
| name='created_by', | ||
| field=models.ForeignKey(blank=True, null=True, on_delete=django.db.models.deletion.SET_NULL, related_name='hackproject', to=settings.AUTH_USER_MODEL), | ||
| ), | ||
| migrations.AlterField( | ||
| model_name='hackprojectscore', | ||
| name='created_by', | ||
| field=models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, related_name='hackprojectscores', to=settings.AUTH_USER_MODEL), | ||
| ), | ||
| ] |
This file contains hidden or 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 @@ | ||
| # Generated by Django 3.1.1 on 2020-10-25 19:33 | ||
|
|
||
| from django.conf import settings | ||
| from django.db import migrations, models | ||
| import django.db.models.deletion | ||
|
|
||
|
|
||
| class Migration(migrations.Migration): | ||
|
|
||
| dependencies = [ | ||
| migrations.swappable_dependency(settings.AUTH_USER_MODEL), | ||
| ('hackathon', '0017_auto_20201025_1211'), | ||
| ] | ||
|
|
||
| operations = [ | ||
| migrations.AlterField( | ||
| model_name='hackprojectscore', | ||
| name='judge', | ||
| field=models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to=settings.AUTH_USER_MODEL), | ||
| ), | ||
| ] |
This file contains hidden or 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,14 @@ | ||
| # Generated by Django 3.1.1 on 2020-10-29 14:07 | ||
|
|
||
| from django.db import migrations | ||
|
|
||
|
|
||
| class Migration(migrations.Migration): | ||
|
|
||
| dependencies = [ | ||
| ('hackathon', '0020_merge_20201026_2056'), | ||
| ('hackathon', '0018_auto_20201025_1933'), | ||
| ] | ||
|
|
||
| operations = [ | ||
| ] |
This file contains hidden or 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,18 @@ | ||
| # Generated by Django 3.1.1 on 2020-10-29 14:20 | ||
|
|
||
| from django.db import migrations, models | ||
|
|
||
|
|
||
| class Migration(migrations.Migration): | ||
|
|
||
| dependencies = [ | ||
| ('hackathon', '0021_merge_20201029_1407'), | ||
| ] | ||
|
|
||
| operations = [ | ||
| migrations.AddField( | ||
| model_name='hackathon', | ||
| name='judging_status', | ||
| field=models.CharField(choices=[('not_yet_started', "Hasn't started"), ('open', 'Open'), ('closed', 'Closed')], default='not_yet_started', max_length=16), | ||
| ), | ||
| ] |
This file contains hidden or 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 hidden or 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,20 @@ | ||
| .hack-score-form { | ||
| width: 100%; | ||
| margin-right: 0px; | ||
| margin-left: 0px; | ||
| } | ||
|
|
||
| .hack-score-cat-name { | ||
| min-height: 60px; | ||
| margin-bottom: 0; | ||
| } | ||
|
|
||
| @media screen and (max-width: 720px) { | ||
| .hack-score-cat-name { | ||
| min-height: 30px; | ||
| } | ||
| /* .hack-score-cat-name, h5 { | ||
| font-size: 1rem; | ||
| } */ | ||
|
|
||
| } |
This file contains hidden or 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,74 @@ | ||
| {% extends 'base.html' %} | ||
|
|
||
| {% load my_tags %}<!-- for the usage of custom get_range tag --> | ||
| {% load static %} | ||
| {% block css %} | ||
| <link rel="stylesheet" href="{% static 'hackathon/css/hackathon.css' %}" type="text/css"> | ||
| {% endblock %} | ||
|
|
||
| {% block content %} | ||
| <div class="container text-center"> | ||
| <section> | ||
| <h2>Judging Team {{ team }}</h2> | ||
| <div class="d-flex flex-wrap justify-content-around my-2 my-md-4"> | ||
| <div> | ||
| <a href="{{ project.github_url }}" class="btn btn-outline-info mb-3 mb-md-0" target="_blank">View Project Repo</a> | ||
| </div> | ||
| <div> | ||
| <a href="{{ project.deployed_url }}" class="btn btn-outline-info mb-3 mb-md-0" target="_blank">View Deployed Site</a> | ||
| </div> | ||
| </div> | ||
| </section> | ||
|
|
||
| <section class="container"> | ||
| <!-- judging form --> | ||
| <form class="hack-score-form tex-center" action="{% url 'hackathon:judging' hackathon.id team.id %}" method="post"> | ||
| {% csrf_token %} | ||
| <div class=" row justify-content-around" > | ||
| {% for category in score_categories %} | ||
| <div class="col-12 col-md-6 mb-3 mb-md-4 p-0 p-md-2"> | ||
| <div class="shadow p-3 bg-white rounded mx-3"> | ||
| <div class="row"> | ||
| <div class="col-32 order-12 col-md-3 order-md-1 mt-2 input-group"> | ||
| <select required class="custom-select" name="score_{{ category.id }}"> | ||
| <option selected disabled value="">Score</option> | ||
| <!-- using custom get_range tag --> | ||
| {% for i in category.max_score|get_range:category.min_score %} | ||
|
|
||
| <option value="{{ i }}">{{ i }}</option> | ||
| {% endfor %} | ||
|
|
||
| </select> | ||
| </div> | ||
| <div class="col-12 order-1 col-md-9 order-md-12 text-left"> | ||
| <h5 class="hack-score-cat-name"><strong>{{ category }}</strong></h5> | ||
| </div> | ||
| </div> | ||
| <div class="row"> | ||
| <div class="col-12 my-2 text-left"> | ||
| <p class="mb-0">some description here... probably something one liner or max two</p> | ||
| <p class="mb-0"> | ||
| <em><small> descr. field needed in ScoreCat model</small></em> | ||
| </p> | ||
| </div> | ||
| </div> | ||
|
|
||
|
|
||
|
|
||
| </div> | ||
| </div> | ||
| {% endfor %} | ||
| </div> | ||
| <div class="row d-flex justify-content-center"> | ||
| <div class="mt-1 mb-5"> | ||
| <button class="btn-lg btn-ci mt-1" type="submit" value="Submit">Submit scores</button> | ||
| </div> | ||
| </div> | ||
|
|
||
| </form> | ||
|
|
||
| </section> | ||
|
|
||
|
|
||
| </div> | ||
| {% endblock %} |
Empty file.
This file contains hidden or 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,27 @@ | ||
|
|
||
| # range snippet from: https://www.djangosnippets.org/snippets/1357/ | ||
| # adjusted to current project needs based on https://docs.djangoproject.com/en/3.1/howto/custom-template-tags/ | ||
| from django.template import Library | ||
|
|
||
| register = Library() | ||
|
|
||
| @register.filter | ||
| def get_range(value, start): | ||
| """ | ||
| Filter - returns a list containing range made from given value | ||
| Usage (in template): | ||
|
|
||
| <ul>{% for i in 3|get_range %} | ||
| <li>{{ i }}. Do something</li> | ||
| {% endfor %}</ul> | ||
|
|
||
| Results with the HTML: | ||
| <ul> | ||
| <li>0. Do something</li> | ||
| <li>1. Do something</li> | ||
| <li>2. Do something</li> | ||
| </ul> | ||
|
|
||
| Instead of 3 one may use the variable set in the views | ||
| """ | ||
| return range(start, value+1, 1) |
This file contains hidden or 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 |
|---|---|---|
| @@ -1,12 +1,13 @@ | ||
| from django.urls import path | ||
|
|
||
| from .views import ( | ||
| HackathonListView, create_hackathon, update_hackathon, delete_hackathon | ||
| HackathonListView, create_hackathon, update_hackathon, delete_hackathon, judging | ||
| ) | ||
|
|
||
| urlpatterns = [ | ||
| path('', HackathonListView.as_view(), name='hackathon-list'), | ||
| path('', HackathonListView.as_view(), name="hackathon-list"), | ||
| path("<int:hack_id>/team/<int:team_id>/judging/", judging, name="judging"), | ||
| path("create_hackathon", create_hackathon, name='create_hackathon'), | ||
| path("<int:hackathon_id>/update_hackathon", update_hackathon, name="update_hackathon"), | ||
| path("<int:hackathon_id>/delete_hackathon", delete_hackathon, name="delete_hackathon"), | ||
| ] | ||
|
|
This file contains hidden or 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
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.