Skip to content

Commit

Permalink
Merge branch 'release/0.6.0'
Browse files Browse the repository at this point in the history
  • Loading branch information
JackMorganNZ committed Jun 7, 2018
2 parents 44b7573 + 26f7b9c commit 971ac7f
Show file tree
Hide file tree
Showing 84 changed files with 2,598 additions and 47 deletions.
3 changes: 1 addition & 2 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,7 @@ jobs:
include:
- stage: test
script: coverage run --rcfile=.coveragerc manage.py test tests --settings=config.settings.testing -v=3
- script: python manage.py loadpikau
- script: python manage.py loadlicences
- script: python manage.py loaddata
- script: flake8
- script: pydocstyle --count --explain
after_success:
Expand Down
17 changes: 17 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,22 @@
# Changelog

## 0.6.0 (Pre-release)

*This release requires a database wipe due to new migrations.*

- Add "Why digital technologies?" pīkau.
- Store and load readiness level for pīkau.
- Ensure pīkau title fits within pathway diagram nodes. (fixes #56)
- Fix bug where file licence warning displayed wrong licence. (fixes #60)
- Load file data from loader.
- Check files used in pīkau are listed within files application.
- Display links between files and pīkau. (fixes #61)
- Display image preview for files. (fixes #35)
- Add test cases.
- Dependency updates:
- Update django from 2.0.5 to 2.0.6.
- Update django-anymail 2.2 to 3.0.

## 0.5.1 (Pre-release)

- Fix bug where slug max length was too short for titles.
Expand Down
2 changes: 1 addition & 1 deletion config/__init__.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
"""Module for Django system configuration."""

__version__ = "0.5.1"
__version__ = "0.6.0"
158 changes: 158 additions & 0 deletions files/content/files.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,158 @@
banner-mahuika-maui-png:
name: "Mahuika and Māui Banner"
filename: "banner-mahuika-maui.png"
location: "https://drive.google.com/open?id=1NJfnUmj6et78-o8Eov2i7fgZdauR_myE"
direct-link: "images/core-education/banner-mahuika-maui.png"
maui-face-png:
name: "Māui face"
filename: "maui-face.png"
location: "https://drive.google.com/open?id=1NU2glbUDS928aBwKgivX4GdoyKKkbMmo"
direct-link: "images/core-education/maui-face.png"
mahuika-face-png:
name: "Mahuika face"
filename: "mahuika-face.png"
location: "https://drive.google.com/open?id=1396r4RQjZxZdyAPVzDm3o0heDJit1m_E"
direct-link: "images/core-education/mahuika-face.png"
what-is-ct-png:
name: "What is CT?"
filename: "what-is-ct.png"
location: "images/pikau/what-is-ct.png"
direct-link: "images/pikau/what-is-ct.png"
licence: cc-by-sa-4
ct-around-the-world-png:
name: "CT around the world"
filename: "ct-around-the-world.png"
location: "images/pikau/ct-around-the-world.png"
direct-link: "images/pikau/ct-around-the-world.png"
licence: cc-by-sa-4
arnold-the-wonder-parrot-jpg:
name: "Arnold the Wonder Parrot"
filename: "arnold-the-wonder-parrot.jpg"
location: "images/pikau/arnold-the-wonder-parrot.jpg"
direct-link: "images/pikau/arnold-the-wonder-parrot.jpg"
licence: cc-by-sa-4
information-theory-activity-jpg:
name: "Information Theory CS Unplugged Activity"
filename: "information-theory-activity.jpg"
location: "images/pikau/information-theory-activity.jpg"
direct-link: "images/pikau/information-theory-activity.jpg"
licence: cc-by-sa-4
placeholder-video:
name: "Kia Takatū ā-Matihiko Placeholder Video"
filename: "https://www.youtube.com/embed/zSfzB-Z-mKM"
location: "https://www.youtube.com/embed/zSfzB-Z-mKM"
direct-link: "https://www.youtube.com/embed/zSfzB-Z-mKM"
licence: cc-by-sa-4
ct-loading-planes-trimmed-mov:
name: "CT Loading Planes - Trimmed"
filename: "CT loading planes trimmed.mov"
location: "https://vimeo.com/273809039/eb5cb42933"
direct-link: "https://vimeo.com/273809039/eb5cb42933"
licence: cc-by-sa-4
ct-six-elements-of-digital-devices-mp4:
name: "Six elements of digital devices"
filename: "six elements of digital devices.mp4"
location: "https://vimeo.com/273813250/f251e2a3d4"
direct-link: "https://vimeo.com/273813250/f251e2a3d4"
licence: cc-by-sa-4
digital-images-mp4:
name: "Digital images"
filename: "digital images.mp4"
location: "https://vimeo.com/273824548/770c5c1c48"
direct-link: "https://vimeo.com/273824548/770c5c1c48"
licence: cc-by-sa-4
csfg-algorithms-trailer-mp4:
name: "Computer Science Field Guide: Algorithms"
filename: "Computer Science Field Guide - Algorithms.mp4"
location: "https://vimeo.com/69609500"
direct-link: "https://vimeo.com/69609500"
licence: cc-by-sa-4
getting-the-most-out-of-pikau:
name: Getting the most out of pīkau
filename: "https://vimeo.com/272882311/8e4cf1de3f"
location: "https://vimeo.com/272882311/8e4cf1de3f"
direct-link: "https://vimeo.com/272882311/8e4cf1de3f"
1983-cpa-5426-png:
name: Muḥammad ibn Mūsā al-Ḵwārizmī
filename: 1983 CPA 5426 (1).png
location: "https://commons.wikimedia.org/wiki/File:1983_CPA_5426_(1).png"
direct-link: "https://upload.wikimedia.org/wikipedia/commons/1/11/1983_CPA_5426_%281%29.png"
licence: public-domain
description: "This work is not an object of copyright according to article 1259 of Book IV of the Civil Code of the Russian Federation No. 230-FZ of December 18, 2006."
euklid-von-alexandria-1-jpg:
name: Euklid-von-Alexandria
filename: Euklid-von-Alexandria_1.jpg
location: "https://commons.wikimedia.org/wiki/File:Euklid-von-Alexandria_1.jpg"
direct-link: "https://upload.wikimedia.org/wikipedia/commons/3/30/Euklid-von-Alexandria_1.jpg"
licence: public-domain
description: "This work is in the public domain in its country of origin and other countries and areas where the copyright term is the author's life plus 70 years or less."
telescope-with-stars-jpg:
name: Telescope in front of stars
filename: science.jpg
location: "https://www.timelinecoverbanner.com/covers/telescope-knowledge-mystery-and-science-Facebook-cover/"
direct-link: "https://www.timelinecoverbanner.com/facebook-covers/2013/01/science.jpg"
licence: cc0
design-desk-display-jpg:
name: User frustrated in front of computer
filename: design-desk-display-313690.jpg
location: "https://www.pexels.com/photo/design-desk-display-eyewear-313690/"
licence: cc0
dt3e-interviews-with-teachers-mp4:
name: "DT3e - Interviews with teachers"
filename: "DT3e interviews with teachers.mp4"
location: "https://vimeo.com/273841538"
direct-link: "https://vimeo.com/273841538"
licence: cc-by-sa-4
use-modify-create-diagram-svg:
name: Use-Modify-Create Learning Progression Diagram
filename: "use-modify-create-diagram.svg"
location: "images/pikau/use-modify-create-diagram.svg"
direct-link: "images/pikau/use-modify-create-diagram.svg"
licence: cc-by-sa-4
technology-diagram-jpg:
name: NZ Curriculum Technology Diagram
filename: "technology-diagram.jpg"
location: "images/core-education/technology-diagram.jpg"
direct-link: "images/core-education/technology-diagram.jpg"
oudjat-svg:
name: Oudjat
filename: "Oudjat.SVG"
location: "https://commons.wikimedia.org/wiki/File:Oudjat.SVG"
direct-link: "https://upload.wikimedia.org/wikipedia/commons/thumb/f/f5/Oudjat.SVG/500px-Oudjat.SVG.png"
licence: cc-by-sa-3
eratosthene-png:
name: Eratosthene
filename: "Eratosthene.01.png"
location: "https://commons.wikimedia.org/wiki/File:Eratosthene.01.png"
direct-link: "https://upload.wikimedia.org/wikipedia/commons/b/b3/Eratosthene.01.png"
licence: public-domain
ada-lovelace-jpg:
name: Ada Lovelace
filename: "Ada Lovelace portrait.jpg"
location: "https://commons.wikimedia.org/wiki/File:Ada_Lovelace_portrait.jpg"
direct-link: "https://upload.wikimedia.org/wikipedia/commons/thumb/a/a4/Ada_Lovelace_portrait.jpg/334px-Ada_Lovelace_portrait.jpg"
licence: public-domain
edsger-wybe-dijkstra-jpg:
name: Edsger Wybe Dijkstra
filename: "Edsger Wybe Dijkstra.jpg"
location: "https://commons.wikimedia.org/wiki/File:Edsger_Wybe_Dijkstra.jpg"
direct-link: "https://upload.wikimedia.org/wikipedia/commons/thumb/d/d9/Edsger_Wybe_Dijkstra.jpg/450px-Edsger_Wybe_Dijkstra.jpg"
licence: cc-by-sa-3
pagerank-png:
name: PageRank
filename: "PageRank-hi-res.png"
location: "https://commons.wikimedia.org/wiki/File:PageRank-hi-res.png"
direct-link: "https://upload.wikimedia.org/wikipedia/commons/thumb/6/69/PageRank-hi-res.png/640px-PageRank-hi-res.png"
licence: cc-by-sa-2-5
jeannette-wing-jpg:
name: Jeannette Wing
filename: "Jeannette Wing, Davos 2013.jpg"
location: "https://commons.wikimedia.org/wiki/File:Jeannette_Wing,_Davos_2013.jpg"
direct-link: "https://upload.wikimedia.org/wikipedia/commons/thumb/7/77/Jeannette_Wing%2C_Davos_2013.jpg/532px-Jeannette_Wing%2C_Davos_2013.jpg"
licence: cc-by-sa-2
khwarizmi-amirkabir-png:
name: Khwarizmi Amirkabir University of Technology
filename: "Khwarizmi Amirkabir University of Technology.png"
location: "https://commons.wikimedia.org/wiki/File:Khwarizmi_Amirkabir_University_of_Technology.png"
direct-link: "https://upload.wikimedia.org/wikipedia/commons/a/a6/Khwarizmi_Amirkabir_University_of_Technology.png"
licence: cc-by-sa-3
24 changes: 21 additions & 3 deletions files/content/licences.yaml
Original file line number Diff line number Diff line change
@@ -1,6 +1,24 @@
- name: "Unknown"
unknown:
name: "Unknown"
url: "https://creativecommons.org/choose/"
- name: "Creative Commons (BY-SA 4.0)"
cc0:
name: "CC0 - No Rights Reserved"
url: "https://creativecommons.org/share-your-work/public-domain/cc0/"
cc-by-sa-2:
name: "Creative Commons (BY-SA 2.0)"
url: "https://creativecommons.org/licenses/by-sa/2.0/"
cc-by-sa-2-5:
name: "Creative Commons (BY-SA 2.5)"
url: "https://creativecommons.org/licenses/by-sa/2.5/"
cc-by-sa-3:
name: "Creative Commons (BY-SA 3.0)"
url: "https://creativecommons.org/licenses/by-sa/3.0/"
cc-by-sa-4:
name: "Creative Commons (BY-SA 4.0)"
url: "https://creativecommons.org/licenses/by-sa/4.0/"
- name: "Creative Commons (BY-NC-SA 4.0)"
cc-by-nc-sa-4:
name: "Creative Commons (BY-NC-SA 4.0)"
url: "https://creativecommons.org/licenses/by-nc-sa/4.0/"
public-domain:
name: Public Domain
url: "https://wiki.creativecommons.org/wiki/Public_domain"
32 changes: 32 additions & 0 deletions files/management/commands/_FileLoader.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
"""Custom loader for loading files."""

from django.db import transaction
from files.models import File, Licence
from utils.BaseLoader import BaseLoader


class FileLoader(BaseLoader):
"""Custom loader for loading files."""

@transaction.atomic
def load(self):
"""Load the files into the database."""
files = self.load_yaml_file("files.yaml")

for file_slug, file_data in files.items():
licence = Licence.objects.get(slug=file_data.get("licence", "unknown"))
defaults = {
"name": file_data["name"],
"filename": file_data["filename"],
"location": file_data["location"],
"direct_link": file_data.get("direct-link", ""),
"licence": licence,
"description": file_data.get("description", ""),
}
file_object, created = File.objects.update_or_create(
slug=file_slug,
defaults=defaults,
)
self.log_object_creation(created, file_object)

self.log("All files loaded!\n")
5 changes: 3 additions & 2 deletions files/management/commands/_LicenceLoader.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,12 +13,13 @@ def load(self):
"""Load the licences into the database."""
licences = self.load_yaml_file("licences.yaml")

for licence_data in licences:
for licence_slug, licence_data in licences.items():
defaults = {
"name": licence_data["name"],
"url": licence_data["url"],
}
licence, created = Licence.objects.update_or_create(
name=licence_data["name"],
slug=licence_slug,
defaults=defaults,
)
self.log_object_creation(created, licence)
Expand Down
Original file line number Diff line number Diff line change
@@ -1,16 +1,18 @@
"""Module for the custom Django loadlicences command."""
"""Module for the custom Django loadfiles command."""

from django.conf import settings
from django.core import management
from files.management.commands._LicenceLoader import LicenceLoader
from files.management.commands._FileLoader import FileLoader


class Command(management.base.BaseCommand):
"""Required command class for the custom Django loadlicences command."""
"""Required command class for the custom Django loadfiles command."""

help = "Loads licences into the website"

def handle(self, *args, **options):
"""Automatically called when the loadlicences command is given."""
"""Automatically called when the loadfiles command is given."""
base_path = settings.FILES_CONTENT_BASE_PATH
LicenceLoader(base_path).load()
FileLoader(base_path).load()
8 changes: 5 additions & 3 deletions files/migrations/0001_initial.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# Generated by Django 2.0.5 on 2018-05-21 04:19
# Generated by Django 2.0.5 on 2018-06-07 02:53

from django.db import migrations, models
import django.db.models.deletion
Expand All @@ -18,15 +18,17 @@ class Migration(migrations.Migration):
fields=[
('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
('slug', models.SlugField(unique=True)),
('filename', models.CharField(max_length=200)),
('name', models.CharField(max_length=200, unique=True)),
('filename', models.CharField(max_length=200, unique=True)),
('description', models.TextField(blank=True)),
('location', models.URLField()),
('location', models.URLField(unique=True)),
],
),
migrations.CreateModel(
name='Licence',
fields=[
('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
('slug', models.SlugField(unique=True)),
('name', models.CharField(max_length=200, unique=True)),
('url', models.URLField()),
],
Expand Down
23 changes: 23 additions & 0 deletions files/migrations/0002_auto_20180607_2117.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
# Generated by Django 2.0.5 on 2018-06-07 09:17

from django.db import migrations, models


class Migration(migrations.Migration):

dependencies = [
('files', '0001_initial'),
]

operations = [
migrations.AddField(
model_name='file',
name='direct_link',
field=models.URLField(blank=True),
),
migrations.AlterField(
model_name='file',
name='location',
field=models.URLField(),
),
]
Loading

0 comments on commit 971ac7f

Please sign in to comment.