Skip to content

Commit

Permalink
Merge branch 'release/0.17.0'
Browse files Browse the repository at this point in the history
  • Loading branch information
JackMorganNZ committed Sep 22, 2019
2 parents 3f2ec9e + d88f899 commit 7d38175
Show file tree
Hide file tree
Showing 27 changed files with 441 additions and 20 deletions.
4 changes: 2 additions & 2 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,7 @@ notifications:
on_failure: change
stages:
- name: test
- name: develop deploy
- name: development deployment
if: branch = develop
- name: production deploy
- name: production deployment
if: branch = master
13 changes: 13 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,18 @@
# Changelog

## 0.17.0

- Add secret pages application.
- Update LICENSE to include license exclusions.
- Dependencies changes:
- Update python-slugify from 3.0.3 to 3.0.4.
- Update django-anymail from 6.1.0 to 7.0.0.
- Update django-allauth from 0.39.1 to 0.40.0.
- Update django-recaptcha from 2.0.4 to 2.0.5.
- Update django-storages from 1.7.1 to 1.7.2.
- Update google-cloud-storage from 1.18.0 to 1.19.1.
- Update google-resumable-media from 0.3.2 to 0.4.1.

## 0.16.6

- Fix bug where empty progress outcome data was shown in POET admin.
Expand Down
10 changes: 10 additions & 0 deletions LICENSE
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
MIT License

Copyright (c) 2019 University of Canterbury Computer Science Education Research
This license applies to all files within this repository, except for the exclusions listed at the end of this file.

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
Expand All @@ -19,3 +20,12 @@ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.


EXCLUSIONS

dthm4kaiako/static/img/logos/
Files belong to their respective owners.

dthm4kaiako/static/img/secret_pages/tenz-ct-puzzle/
"Bellbird" (https://www.flickr.com/photos/sidm/6681523917) by Sid Mosdell (https://www.flickr.com/photos/sidm/) is licensed under CC BY 2.0, and was used as source for creating vector image of the bellbird.
11 changes: 11 additions & 0 deletions dev
Original file line number Diff line number Diff line change
Expand Up @@ -142,6 +142,17 @@ cmd_static_prod() {
}
defhelp static_prod 'Build production static files.'

# Update and collect static files
cmd_update_static() {
cmd_static

echo ""
cmd_collect_static
echo ""
echo -e "\n${GREEN}Static files are updated!${NC}"
}
defhelp update_static 'Update and collect static files.'

# Run shell
cmd_shell() {
docker-compose exec django bash
Expand Down
2 changes: 1 addition & 1 deletion dthm4kaiako/config/__init__.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
"""Configuration for Django system."""

__version__ = "0.16.6"
__version__ = "0.17.0"
__version_info__ = tuple(
[
int(num) if num.isdigit() else num
Expand Down
2 changes: 2 additions & 0 deletions dthm4kaiako/config/settings/base.py
Original file line number Diff line number Diff line change
Expand Up @@ -126,6 +126,7 @@
'dtta.apps.DttaAppConfig',
'learning_area_cards.apps.LearningAreaCardsAppConfig',
'poet.apps.POETAppConfig',
'secret_pages.apps.SecretPagesAppConfig',
]
# https://docs.djangoproject.com/en/dev/ref/settings/#installed-apps
INSTALLED_APPS = DJANGO_APPS + THIRD_PARTY_APPS + LOCAL_APPS
Expand Down Expand Up @@ -430,6 +431,7 @@
DEPLOYMENT_TYPE = env("DEPLOYMENT", default='local')
SAMPLE_DATA_ADMIN_PASSWORD = env('SAMPLE_DATA_ADMIN_PASSWORD', default='password')
SAMPLE_DATA_USER_PASSWORD = env('SAMPLE_DATA_USER_PASSWORD', default='password')
SECRET_PAGES_TEMPLATE_TEMPLATE = 'secret_pages/{}.html'

# reCAPTCHA
# ------------------------------------------------------------------------------
Expand Down
1 change: 1 addition & 0 deletions dthm4kaiako/config/urls.py
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@
path('users/', include('users.urls', namespace='users'),),
path('poet/', include('poet.urls', namespace='poet')),
path('learning-area-cards/', include('learning_area_cards.urls', namespace='learning_area_cards')),
path('s/', include('secret_pages.urls', namespace='secret_pages')),
path('accounts/', include('allauth.urls')),
path('markdownx/', include('markdownx.urls')),
path('ckeditor/', include('ckeditor_uploader.urls')),
Expand Down
2 changes: 1 addition & 1 deletion dthm4kaiako/gulpfile.js
Original file line number Diff line number Diff line change
Expand Up @@ -96,7 +96,7 @@ function css() {
// scss (libsass)
// --------------------------
function scss() {
return gulp.src('static/scss/*.scss')
return gulp.src('static/scss/**/*.scss')
.pipe(errorHandler(catchError))
// sourcemaps + scss + error handling
.pipe(gulpif(!production, sourcemaps.init()))
Expand Down
1 change: 1 addition & 0 deletions dthm4kaiako/secret_pages/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
"""Module for secret pages application."""
14 changes: 14 additions & 0 deletions dthm4kaiako/secret_pages/admin.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
"""Module for admin configuration for the secret pages application."""

from django.contrib import admin
from secret_pages.models import SecretPage


class SecretPageAdmin(admin.ModelAdmin):
"""Configuration for displaying secret pages in admin."""

list_display = ('name', 'active', 'slug', 'template')
ordering = ('name', 'active', 'slug', 'template')


admin.site.register(SecretPage, SecretPageAdmin)
10 changes: 10 additions & 0 deletions dthm4kaiako/secret_pages/apps.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
"""Application configuration for secret pages application."""

from django.apps import AppConfig


class SecretPagesAppConfig(AppConfig):
"""Application configuration for secret pages application."""

name = 'secret_pages'
verbose_name = 'Secret Pages'
24 changes: 24 additions & 0 deletions dthm4kaiako/secret_pages/migrations/0001_initial.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
# Generated by Django 2.1.5 on 2019-09-20 13:08

from django.db import migrations, models


class Migration(migrations.Migration):

initial = True

dependencies = [
]

operations = [
migrations.CreateModel(
name='SecretPage',
fields=[
('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
('name', models.CharField(max_length=150, unique=True)),
('slug', models.SlugField(unique=True)),
('template', models.CharField(help_text='File extension (.html) is not required.', max_length=300)),
('active', models.BooleanField(default=False)),
],
),
]
1 change: 1 addition & 0 deletions dthm4kaiako/secret_pages/migrations/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
"""Migration files for secret pages application."""
41 changes: 41 additions & 0 deletions dthm4kaiako/secret_pages/models.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
"""Models for secret pages application."""

from django.db import models
from django.conf import settings
from django.template.loader import get_template, TemplateDoesNotExist
from django.core.exceptions import ValidationError

TEMPLATE_EXTENSION = '.html'


class SecretPage(models.Model):
"""Model for a secret page."""

name = models.CharField(
unique=True,
max_length=150,
)
slug = models.SlugField(unique=True)
template = models.CharField(
max_length=300,
help_text="File extension (.html) is not required."
)
active = models.BooleanField(default=False)

def clean(self):
"""Check template exists and set to full path."""
if self.template.endswith(TEMPLATE_EXTENSION):
self.template = self.template[:-len(TEMPLATE_EXTENSION)]
template_path = settings.SECRET_PAGES_TEMPLATE_TEMPLATE.format(self.template)
try:
get_template(template_path)
except TemplateDoesNotExist:
raise ValidationError('Template "{}" cannot be found.'.format(template_path))

def __str__(self):
"""Text representation of object.
Returns:
Name of secret page (str).
"""
return self.name
9 changes: 9 additions & 0 deletions dthm4kaiako/secret_pages/urls.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
"""URL routing for secret_pages application."""

from django.urls import path
from secret_pages import views

app_name = 'secret_pages'
urlpatterns = [
path('<slug:slug>/', views.secret_page_view, name='page'),
]
24 changes: 24 additions & 0 deletions dthm4kaiako/secret_pages/views.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
"""Views for general application."""

from django.shortcuts import render, get_object_or_404
from django.conf import settings
from secret_pages.models import SecretPage


def secret_page_view(request, slug):
"""View of a secret page.
Args:
request (Request): Request from user.
slug (str): Slug captured in URL.
Returns:
HTTP response.
"""
page = get_object_or_404(
SecretPage,
slug=slug,
active=True,
)
template = settings.SECRET_PAGES_TEMPLATE_TEMPLATE.format(page.template)
return render(request, template)
Loading

0 comments on commit 7d38175

Please sign in to comment.