Skip to content

Commit

Permalink
Merge pull request labd#123 from AccentDesign/wagtail-2-5
Browse files Browse the repository at this point in the history
Wagtail 2.5
  • Loading branch information
stuartaccent committed May 18, 2019
2 parents ecc6580 + 8211fdd commit 14d9d93
Show file tree
Hide file tree
Showing 11 changed files with 68 additions and 20 deletions.
9 changes: 7 additions & 2 deletions CHANGELOG.rst
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,13 @@
Changelog
*********

Next Release
------------
3.6.0
-----

* Wagtail 2.5 Support

3.5.0
-----

* Wagtail 2.4 Support
* Tweak docs to ensure files work in js example (Thanks Aimee Hendrycks)
Expand Down
1 change: 1 addition & 0 deletions example/settings.py
Original file line number Diff line number Diff line change
Expand Up @@ -157,3 +157,4 @@
RECAPTCHA_PUBLIC_KEY = '6LeIxAcTAAAAAJcZVRqyHh71UMIEGNQ_MXjiZKhI'
RECAPTCHA_PRIVATE_KEY = '6LeIxAcTAAAAAGG-vFI1TnRWxMZNFuojJ4WifJWe'
NOCAPTCHA = True
SILENCED_SYSTEM_CHECKS = ['captcha.recaptcha_test_key_error']
2 changes: 1 addition & 1 deletion setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@


install_requires = [
'wagtail>=2,<2.5'
'wagtail>=2,<2.6'
]

documentation_extras = [
Expand Down
8 changes: 1 addition & 7 deletions tests/fields/test_hook_select_field.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,16 +4,10 @@

from wagtailstreamforms.fields import HookSelectField, HookMultiSelectFormField

from ..models import HookSelectModel
from ..test_case import AppTestCase


class HookSelectModel(models.Model):
hooks = HookSelectField(null=True, blank=True, help_text='Some hooks')

class Meta:
app_label = 'tests'


class HookSelectFieldTests(AppTestCase):

def test_default_choices_has_in_app_hooks(self):
Expand Down
42 changes: 42 additions & 0 deletions tests/migrations/0001_initial.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
# Generated by Django 2.2.1 on 2019-05-17 19:15

from django.db import migrations, models
import django.db.models.deletion
import wagtailstreamforms.fields


class Migration(migrations.Migration):

initial = True

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

operations = [
migrations.CreateModel(
name='HookSelectModel',
fields=[
('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
('hooks', wagtailstreamforms.fields.HookSelectField(blank=True, help_text='Some hooks', null=True)),
],
),
migrations.CreateModel(
name='InvalidFormSettingsModel',
fields=[
('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
],
),
migrations.CreateModel(
name='ValidFormSettingsModel',
fields=[
('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
('name', models.CharField(max_length=255)),
('number', models.IntegerField()),
('form', models.OneToOneField(on_delete=django.db.models.deletion.CASCADE, related_name='advanced_settings', to='wagtailstreamforms.Form')),
],
options={
'abstract': False,
},
),
]
Empty file added tests/migrations/__init__.py
Empty file.
5 changes: 5 additions & 0 deletions tests/models/__init__.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
from django.db import models

from wagtailstreamforms.fields import HookSelectField
from wagtailstreamforms.models import AbstractFormSetting


Expand All @@ -10,3 +11,7 @@ class ValidFormSettingsModel(AbstractFormSetting):

class InvalidFormSettingsModel(models.Model):
pass


class HookSelectModel(models.Model):
hooks = HookSelectField(null=True, blank=True, help_text='Some hooks')
8 changes: 5 additions & 3 deletions tests/models/test_form_submission_file.py
Original file line number Diff line number Diff line change
Expand Up @@ -43,11 +43,13 @@ class DeleteTests(TransactionTestCase):

def test_files_are_deleted_on_commit(self):
test_file = AppTestCase().get_file()
name = None
with transaction.atomic():
form = Form.objects.get(pk=1)
submission = FormSubmission.objects.create(form=form, form_data={})
file = FormSubmissionFile.objects.create(submission=submission, field='field', file=test_file)
self.assertTrue(file.file.storage.exists(file.file.name))
name = file.file.name
self.assertTrue(file.file.storage.exists(name))
file.delete()
self.assertTrue(file.file.storage.exists(file.file.name))
self.assertFalse(file.file.storage.exists(file.file.name))
self.assertTrue(file.file.storage.exists(name))
self.assertFalse(file.file.storage.exists(name))
3 changes: 2 additions & 1 deletion tests/settings.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
'django.contrib.sessions',
'django.contrib.messages',
'django.contrib.staticfiles',

# wagtail
'wagtail.core',
'wagtail.admin',
Expand Down Expand Up @@ -47,6 +47,7 @@
DATABASES = {
'default': {
'ENGINE': 'django.db.backends.sqlite3',
'NAME': 'testdb'
}
}

Expand Down
8 changes: 3 additions & 5 deletions tox.ini
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
[tox]
envlist =
deps
flake8
py{34,35,36}-dj{20}-wt{20,21,22,23}
py{35,36,37}-dj{21}-wt{24}
py{35,36,37}-dj{22}-wt{25}

[testenv]
deps =
Expand All @@ -12,11 +12,13 @@ deps =

dj20: Django>=2,<2.1
dj21: Django>=2.1,<2.2
dj22: Django>=2.2,<2.3
wt20: wagtail>=2,<2.1
wt21: wagtail>=2.1,<2.2
wt22: wagtail>=2.2,<2.3
wt23: wagtail>=2.3,<2.4
wt24: wagtail>=2.4,<2.5
wt25: wagtail>=2.5,<2.6

commands =
coverage erase
Expand All @@ -43,10 +45,6 @@ basepython = python3.7
deps = flake8
commands = flake8 wagtailstreamforms

[testenv:deps]
basepython = python3.7
commands = python -Wd manage.py test

[flake8]
ignore = F401
exclude =
Expand Down
2 changes: 1 addition & 1 deletion wagtailstreamforms/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,6 @@

# major.minor.patch.release.number
# release must be one of alpha, beta, rc, or final
VERSION = (3, 5, 0, 'final', 1)
VERSION = (3, 6, 0, 'final', 1)

__version__ = get_version(VERSION)

0 comments on commit 14d9d93

Please sign in to comment.