-
Notifications
You must be signed in to change notification settings - Fork 39
#P04 As Participant, I would like to see a list of any upcoming Hackathons. #76
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
Merged
Changes from all commits
Commits
Show all changes
48 commits
Select commit
Hold shift + click to select a range
e6dd2fe
#P04 Started Hackathon app
Ri-Dearg ce1d431
Merge branch 'master' into p04
Ri-Dearg cb69915
Added URLs and Installed App.
Ri-Dearg 4f55cc6
Created "Hackathon" Model
Ri-Dearg 2949910
Created Hack Award Category Model
Ri-Dearg ce56f46
HackTeam model created
Ri-Dearg 5c004f0
Created HackProject model
Ri-Dearg 277d7c9
Created HackProjectScoreModel
Ri-Dearg 6ed572d
Created HackProjectScoreCategory Model
Ri-Dearg a2f75c1
Added Foreign Key Fields
Ri-Dearg 2015a80
Merge branch 'master' into m05
Ri-Dearg 2b741b2
Commented on ForeignKey fields
Ri-Dearg b7376ee
Added URLFields
Ri-Dearg 45a288b
Added URLFields
Ri-Dearg 46064fd
Merge branch 'm05' of https://github.com/Ri-Dearg/ci-hackathon-app in…
Ri-Dearg 591169f
Delete settings.json
Ri-Dearg 07afd39
Pull Request review changes made.
Ri-Dearg f210249
Merge branch 'm05' of https://github.com/Ri-Dearg/ci-hackathon-app in…
Ri-Dearg c85533b
Updated gitignore to ignore settings.json
Ri-Dearg 88c7540
Added last extra line on file
Ri-Dearg 8131a73
Removed unecessary import and quotes.
Ri-Dearg 352c80e
Corrected Typo and added migrations.
Ri-Dearg 1195184
Updated str method on HackProjectScoreCategory to remove "score"
Ri-Dearg bdefd17
Updated str method on HackProjectScoreCategory to remove "score"
Ri-Dearg 69603b2
Merge branch 'm05' of https://github.com/Ri-Dearg/ci-hackathon-app in…
Ri-Dearg 875cc06
Test setUp method added and functional
Ri-Dearg 9cdbfcf
Tests written for str method on models.
Ri-Dearg f09fae8
Updated Related names in models
Ri-Dearg b1f3100
Updated .gitignore.
Ri-Dearg 3899109
Merge branch 'master' into m05
Ri-Dearg f3ce532
Added migration file.
Ri-Dearg 26fa31b
Merge branch 'm05' of https://github.com/Ri-Dearg/ci-hackathon-app in…
Ri-Dearg 0bef661
Created HackathonListView
Ri-Dearg 377c4da
Tests for Hackathon app views added.
Ri-Dearg 9d9cbb8
Added templates for the Hackathon list.
Ri-Dearg 5461820
.card-title added to style.css
Ri-Dearg 4c51998
Added basic pagination.
Ri-Dearg bbee150
Paginator now an include for modularity
Ri-Dearg 0b015ac
Styled the Paginator and cards.
Ri-Dearg be2d121
Merge with master
Ri-Dearg 9152d93
Tests Added for queryset. Listview cleaned up.
Ri-Dearg 1d9c07c
Added "Hackathon" dropdown to navbar as draft.
Ri-Dearg 0478830
Format changes for HTML5 Verification.
Ri-Dearg 880a09d
Updated style changes for custom colors on text.
Ri-Dearg a965fbc
Fixed validation errors I introduced in navbar
Ri-Dearg 5d99ae7
Formatted spaces in style.css
Ri-Dearg 05241eb
Removed unnecessary ".save()" from tests.
Ri-Dearg 99bab42
Removed unnecessary indentation.
Ri-Dearg 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 |
|---|---|---|
| @@ -0,0 +1,19 @@ | ||
| {% extends "base.html" %} | ||
| {% load static %} | ||
| {% block content %} | ||
| <section class="h-100"> | ||
| {% if page_obj %} | ||
| <h2 class="p-orange text-center mb-4">Hackathons</h2> | ||
| {% for hackathon in page_obj %} | ||
| {% include 'hackathon/includes/hackathon_card.html' %} | ||
| <hr> | ||
| {% endfor %} | ||
| {% else %} | ||
| <h2 class="text-center">There aren't any Hackathons at the moment!</h2> | ||
| {% endif %} | ||
| <!-- Pagination using Django's paginator. Options are disabled or hidden if unavailable. --> | ||
| <nav aria-label="Hackathon Page Navigation"> | ||
| {% include 'hackathon/includes/paginator.html' %} | ||
| </nav> | ||
| </section> | ||
| {% endblock %} |
11 changes: 11 additions & 0 deletions
11
hackathon/templates/hackathon/includes/hackathon_card.html
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,11 @@ | ||
| <article class="card shadow"> | ||
| <div class="card-body"> | ||
| <h5 class="p-orange card-title">{{ hackathon.display_name }}</h5> | ||
| <h6 class="card-subtitle mb-2 text-muted">{{ hackathon.start_date }} - {{ hackathon.end_date }}</h6> | ||
| <p class="card-text">{{ hackathon.description }}</p> | ||
| {% if hackathon.organiser %} | ||
| <p>Organiser: <a href="#" class="p-blue card-link">{{ hackathon.organiser }}</a></p> | ||
| {% endif %} | ||
| <a href="#" class="btn btn-ci">Read More</a> | ||
| </div> | ||
| </article> | ||
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 @@ | ||
| <ul class="pagination justify-content-center"> | ||
| {% if page_obj.has_previous %} | ||
| <li class="page-item"><a class="page-link" href="?page=1" aria-label="First"> | ||
| <span aria-hidden="true">«</span></a> | ||
| </li> | ||
| <li class="page-item"><a class="page-link" href="?page={{ page_obj.previous_page_number }}">{{ page_obj.previous_page_number }}</a></li> | ||
| {% else %} | ||
| <li class="page-item disabled"><a class="page-link" href="#" tabindex="-1" aria-disabled="true">«</a></li> | ||
| {% endif %} | ||
| <li class="page-item active" aria-current="page"><a class="page-link" href="#">{{ page_obj.number }}<span class="sr-only">(current)</span></a></li> | ||
| {% if page_obj.has_next %} | ||
| <li class="page-item"><a class="page-link" href="?page={{ page_obj.next_page_number }}">{{ page_obj.next_page_number }}</a></li> | ||
| <li class="page-item"><a class="page-link" href="?page={{ page_obj.paginator.num_pages }}" aria-label="Last"> | ||
| <span aria-hidden="true">»</span></a></li> | ||
| {% else %} | ||
| <li class="page-item disabled"><a class="page-link" href="#" tabindex="-1" aria-disabled="true">»</a></li> | ||
| {% endif %} | ||
| </ul> |
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,36 @@ | ||
| from django.test import TestCase | ||
| from django.contrib.auth.models import User | ||
| from django.utils import timezone | ||
|
|
||
| from hackathon.models import Hackathon | ||
|
|
||
|
|
||
| class TestHackathonViews(TestCase): | ||
| """Tests views for the Hackathon app.""" | ||
|
|
||
| def setUp(self): | ||
| """Sets up the models for testing""" | ||
| user = User.objects.create(username="testuser") | ||
| Hackathon.objects.create( | ||
| created_by=user, | ||
| display_name="hacktest", | ||
| description="lorem ipsum", | ||
| start_date=f'{timezone.now()}', | ||
| end_date=f'{timezone.now()}') | ||
|
|
||
| def test_render_hackathon_list(self): | ||
| """Tests the correct rendering of the hackathon list page, | ||
| including contexts.""" | ||
|
|
||
| response = self.client.get('/hackathon/') | ||
|
|
||
| # Confirms the correct template, context items and queryset | ||
| self.assertEqual(response.status_code, 200) | ||
| self.assertTemplateUsed(response, 'hackathon/hackathon_list.html') | ||
| self.assertTemplateUsed(response, | ||
| 'hackathon/includes/hackathon_card.html') | ||
| self.assertTemplateUsed(response, 'hackathon/includes/paginator.html') | ||
| self.assertTrue(response.context['page_obj']) | ||
| self.assertQuerysetEqual(response.context['page_obj'], | ||
| Hackathon.objects.all().order_by('-created'), | ||
| transform=lambda x: x) |
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,5 +1,7 @@ | ||
| from django.urls import path | ||
|
|
||
| urlpatterns = [ | ||
| from .views import HackathonListView | ||
|
|
||
| urlpatterns = [ | ||
| path('', HackathonListView.as_view(), name="hackathon-list") | ||
| ] |
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,3 +1,10 @@ | ||
| from django.shortcuts import render | ||
| from django.views.generic import ListView | ||
|
|
||
| # Create your views here. | ||
| from .models import Hackathon | ||
|
|
||
|
|
||
| class HackathonListView(ListView): | ||
| """Renders a page with a list of Hackathons.""" | ||
| model = Hackathon | ||
| ordering = ['-created'] | ||
| paginate_by = 8 |
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
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.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Not sure if we need to show the organiser, but let's leave it for the moment.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yeah, I thought it could be handy if people had public-facing profiles. It might not be so useful otherwise.