Skip to content
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

Towards Django 2.0 support #395

Merged
merged 8 commits into from
Dec 28, 2017
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 4 additions & 2 deletions wafer/kv/migrations/0001_initial.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,10 +16,12 @@ class Migration(migrations.Migration):
migrations.CreateModel(
name='KeyValue',
fields=[
('id', models.AutoField(verbose_name='ID', serialize=False, auto_created=True, primary_key=True)),
('id', models.AutoField(verbose_name='ID', serialize=False,
auto_created=True, primary_key=True)),
('key', models.CharField(max_length=64, db_index=True)),
('value', jsonfield.fields.JSONField()),
('group', models.ForeignKey(to='auth.Group')),
('group', models.ForeignKey(
to='auth.Group', on_delete=models.CASCADE)),
],
),
]
4 changes: 3 additions & 1 deletion wafer/pages/migrations/0001_initial.py
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,9 @@ class Migration(migrations.Migration):
('exclude_from_static', models.BooleanField(default=False, help_text='Whether to exclude this page from the static version of the site (Container pages, etc.)')),
('_content_rendered', models.TextField(editable=False, blank=True)),
('files', models.ManyToManyField(help_text='Images and other files for use in the content markdown field.', related_name='pages', null=True, to='pages.File', blank=True)),
('parent', models.ForeignKey(blank=True, to='pages.Page', null=True)),
('parent', models.ForeignKey(
blank=True, to='pages.Page', null=True,
on_delete=models.CASCADE)),
],
options={
},
Expand Down
2 changes: 1 addition & 1 deletion wafer/registration/templatetags/wafer_crispy.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
register = template.Library()


@register.assignment_tag(takes_context=True)
@register.simple_tag(takes_context=True)
def wafer_form_helper(context, helper_name):
'''
Find the specified Crispy FormHelper and instantiate it.
Expand Down
19 changes: 14 additions & 5 deletions wafer/schedule/migrations/0001_initial.py
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,9 @@ class Migration(migrations.Migration):
('notes', models.TextField(help_text='Notes for the conference organisers', blank=True)),
('css_class', models.CharField(help_text='Custom css class for this schedule item', max_length=128, blank=True)),
('details_html', models.TextField(editable=False)),
('page', models.ForeignKey(blank=True, to='pages.Page', null=True)),
('page', models.ForeignKey(
blank=True, to='pages.Page', null=True,
on_delete=models.CASCADE)),
],
options={
},
Expand All @@ -45,8 +47,12 @@ class Migration(migrations.Migration):
('start_time', models.TimeField(help_text='Start time (if no previous slot)', null=True, blank=True)),
('end_time', models.TimeField(help_text='Slot end time', null=True)),
('name', models.CharField(help_text='Identifier for use in the admin panel', max_length=1024, null=True, blank=True)),
('day', models.ForeignKey(blank=True, to='schedule.Day', help_text='Day for this slot', null=True)),
('previous_slot', models.ForeignKey(blank=True, to='schedule.Slot', help_text='Previous slot', null=True)),
('day', models.ForeignKey(
blank=True, to='schedule.Day', null=True,
help_text='Day for this slot', on_delete=models.PROTECT)),
('previous_slot', models.ForeignKey(
blank=True, to='schedule.Slot', help_text='Previous slot',
null=True, on_delete=models.CASCADE)),
],
options={
'ordering': ['end_time', 'start_time'],
Expand Down Expand Up @@ -81,13 +87,16 @@ class Migration(migrations.Migration):
migrations.AddField(
model_name='scheduleitem',
name='talk',
field=models.ForeignKey(blank=True, to='talks.Talk', null=True),
field=models.ForeignKey(
blank=True, to='talks.Talk', null=True,
on_delete=models.CASCADE),
preserve_default=True,
),
migrations.AddField(
model_name='scheduleitem',
name='venue',
field=models.ForeignKey(to='schedule.Venue'),
field=models.ForeignKey(
to='schedule.Venue', on_delete=models.PROTECT),
preserve_default=True,
),
]
2 changes: 1 addition & 1 deletion wafer/settings.py
Original file line number Diff line number Diff line change
Expand Up @@ -121,7 +121,7 @@
]


MIDDLEWARE_CLASSES = (
MIDDLEWARE = (
'django.middleware.common.CommonMiddleware',
'django.contrib.sessions.middleware.SessionMiddleware',
'django.middleware.csrf.CsrfViewMiddleware',
Expand Down
5 changes: 1 addition & 4 deletions wafer/sponsors/templatetags/sponsors.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,10 +13,7 @@ def sponsors():
}


# We use assignment_tag for compatibility with Django 1.8
# Once we drop 1.8 support, we should change this to
# simple_tag
@register.assignment_tag()
@register.simple_tag()
def sponsor_image_url(sponsor, name):
"""Returns the corresponding url from the sponsors images"""
if sponsor.files.filter(name=name).exists():
Expand Down
44 changes: 33 additions & 11 deletions wafer/talks/migrations/0001_initial.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,14 +16,30 @@ class Migration(migrations.Migration):
migrations.CreateModel(
name='Talk',
fields=[
('talk_id', models.AutoField(serialize=False, primary_key=True)),
('talk_id', models.AutoField(
serialize=False, primary_key=True)),
('title', models.CharField(max_length=1024)),
('abstract', markitup.fields.MarkupField(help_text='Write two or three paragraphs describing your talk. Who is your audience? What will they get out of it? What will you cover?<br />You can use Markdown syntax.', no_rendered_field=True)),
('notes', models.TextField(help_text='Any notes for the conference organisers?', null=True, blank=True)),
('status', models.CharField(default=b'P', max_length=1, choices=[(b'A', b'Accepted'), (b'R', b'Not Accepted'), (b'P', b'Under Consideration')])),
('_abstract_rendered', models.TextField(editable=False, blank=True)),
('authors', models.ManyToManyField(related_name='talks', to=settings.AUTH_USER_MODEL)),
('corresponding_author', models.ForeignKey(related_name='contact_talks', to=settings.AUTH_USER_MODEL)),
('abstract', markitup.fields.MarkupField(
help_text='Write two or three paragraphs describing your '
'talk. Who is your audience? What will they get '
'out of it? What will you cover?<br />You can '
'use Markdown syntax.',
no_rendered_field=True)),
('notes', models.TextField(
help_text='Any notes for the conference organisers?',
null=True, blank=True)),
('status', models.CharField(
default=b'P', max_length=1, choices=[
(b'A', b'Accepted'),
(b'R', b'Not Accepted'),
(b'P', b'Under Consideration')])),
('_abstract_rendered', models.TextField(
editable=False, blank=True)),
('authors', models.ManyToManyField(
related_name='talks', to=settings.AUTH_USER_MODEL)),
('corresponding_author', models.ForeignKey(
related_name='contact_talks', to=settings.AUTH_USER_MODEL,
on_delete=models.CASCADE)),
],
options={
},
Expand All @@ -32,7 +48,9 @@ class Migration(migrations.Migration):
migrations.CreateModel(
name='TalkType',
fields=[
('id', models.AutoField(verbose_name='ID', serialize=False, auto_created=True, primary_key=True)),
('id', models.AutoField(
verbose_name='ID', serialize=False, auto_created=True,
primary_key=True)),
('name', models.CharField(max_length=255)),
('description', models.TextField(max_length=1024)),
],
Expand All @@ -43,10 +61,13 @@ class Migration(migrations.Migration):
migrations.CreateModel(
name='TalkUrl',
fields=[
('id', models.AutoField(verbose_name='ID', serialize=False, auto_created=True, primary_key=True)),
('id', models.AutoField(
verbose_name='ID', serialize=False, auto_created=True,
primary_key=True)),
('description', models.CharField(max_length=256)),
('url', models.URLField()),
('talk', models.ForeignKey(to='talks.Talk')),
('talk', models.ForeignKey(to='talks.Talk',
on_delete=models.CASCADE)),
],
options={
},
Expand All @@ -55,7 +76,8 @@ class Migration(migrations.Migration):
migrations.AddField(
model_name='talk',
name='talk_type',
field=models.ForeignKey(to='talks.TalkType', null=True),
field=models.ForeignKey(to='talks.TalkType', null=True,
on_delete=models.SET_NULL),
preserve_default=True,
),
]
10 changes: 8 additions & 2 deletions wafer/talks/migrations/0006_author_helptext.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,11 +15,17 @@ class Migration(migrations.Migration):
migrations.AlterField(
model_name='talk',
name='authors',
field=models.ManyToManyField(help_text='The speakers presenting the talk.', related_name='talks', to=settings.AUTH_USER_MODEL),
field=models.ManyToManyField(
help_text='The speakers presenting the talk.',
related_name='talks', to=settings.AUTH_USER_MODEL),
),
migrations.AlterField(
model_name='talk',
name='corresponding_author',
field=models.ForeignKey(related_name='contact_talks', to=settings.AUTH_USER_MODEL, help_text='The person submitting the talk (and who questions regarding the talk should be addressed to).'),
field=models.ForeignKey(
related_name='contact_talks', to=settings.AUTH_USER_MODEL,
help_text='The person submitting the talk (and who questions '
'regarding the talk should be addressed to).',
on_delete=models.CASCADE),
),
]
3 changes: 2 additions & 1 deletion wafer/talks/migrations/0012_add_tracks.py
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,8 @@ class Migration(migrations.Migration):
model_name='talk',
name='track',
field=models.ForeignKey(null=True, blank=True, default=None,
to='talks.Track'),
to='talks.Track',
on_delete=models.SET_NULL),
preserve_default=False,
),
]
3 changes: 2 additions & 1 deletion wafer/tickets/migrations/0001_initial.py
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,8 @@ class Migration(migrations.Migration):
migrations.AddField(
model_name='ticket',
name='type',
field=models.ForeignKey(to='tickets.TicketType'),
field=models.ForeignKey(
to='tickets.TicketType', on_delete=models.CASCADE),
preserve_default=True,
),
migrations.AddField(
Expand Down
2 changes: 1 addition & 1 deletion wafer/urls.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
url(r'^talks/', include('wafer.talks.urls')),
url(r'^sponsors/', include('wafer.sponsors.urls')),
url(r'^pages/', include('wafer.pages.urls')),
url(r'^admin/', include(admin.site.urls)),
url(r'^admin/', admin.site.urls),
url(r'^markitup/', include('markitup.urls')),
url(r'^schedule/', include('wafer.schedule.urls')),
url(r'^tickets/', include('wafer.tickets.urls')),
Expand Down
25 changes: 19 additions & 6 deletions wafer/users/migrations/0001_initial.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
# -*- coding: utf-8 -*-
from __future__ import unicode_literals

import django.core.validators
from django.db import models, migrations
from django.conf import settings

Expand All @@ -15,13 +16,25 @@ class Migration(migrations.Migration):
migrations.CreateModel(
name='UserProfile',
fields=[
('id', models.AutoField(verbose_name='ID', serialize=False, auto_created=True, primary_key=True)),
('contact_number', models.CharField(max_length=16, null=True, blank=True)),
('id', models.AutoField(
verbose_name='ID', serialize=False, auto_created=True,
primary_key=True)),
('contact_number', models.CharField(
max_length=16, null=True, blank=True)),
('bio', models.TextField(null=True, blank=True)),
('homepage', models.CharField(max_length=256, null=True, blank=True)),
('twitter_handle', models.CharField(max_length=15, null=True, blank=True)),
('github_username', models.CharField(max_length=32, null=True, blank=True)),
('user', models.OneToOneField(to=settings.AUTH_USER_MODEL)),
('homepage', models.CharField(
max_length=256, null=True, blank=True)),
('twitter_handle', models.CharField(
max_length=15, null=True, blank=True,
validators=[
django.core.validators.RegexValidator(
'^[A-Za-z0-9_]{1,15}$',
'Incorrectly formatted twitter handle')
])),
('github_username', models.CharField(
max_length=32, null=True, blank=True)),
('user', models.OneToOneField(
to=settings.AUTH_USER_MODEL, on_delete=models.CASCADE)),
],
options={
},
Expand Down
2 changes: 1 addition & 1 deletion wafer/users/models.py
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ class UserProfile(models.Model):
class Meta:
ordering = ['id']

user = models.OneToOneField(User)
user = models.OneToOneField(User, on_delete=models.CASCADE)
kv = models.ManyToManyField(KeyValue)
contact_number = models.CharField(max_length=16, null=True, blank=True)
bio = models.TextField(null=True, blank=True)
Expand Down