Skip to content

Commit

Permalink
hasty but obligatory Django 2.0 upgrade
Browse files Browse the repository at this point in the history
The future is now!

Squash-regenerating as one initial migration was easier than figuring out how
to edit the migration history now that User.on_delete is mandatory (recall
4d6a2a8); I don't know what people do in production.

It doesn't look like the debug toolbar is working, and we should feel guilty
for using a deprecation mixin ... but let it pass for now.

Resolves #65.
  • Loading branch information
zackmdavis committed Jan 22, 2018
1 parent a1029f0 commit 97794ca
Show file tree
Hide file tree
Showing 20 changed files with 81 additions and 305 deletions.
6 changes: 5 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -51,4 +51,8 @@ db.sqlite3
.disable_debug_toolbar

# really
share/
share/

# other droppings
pip-selfcheck.json
selenium/
4 changes: 3 additions & 1 deletion core/middleware.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
import settings

class FinetoothEnvironmentMiddleware:
from django.utils import deprecation

class FinetoothEnvironmentMiddleware(deprecation.MiddlewareMixin):
def process_request(self, request):
request.possible_environments = settings.Environment
request.environment = settings.ENVIRONMENT
102 changes: 58 additions & 44 deletions core/migrations/0001_initial.py
Original file line number Diff line number Diff line change
@@ -1,112 +1,126 @@
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
# Generated by Django 2.0.1 on 2018-01-22 21:01

from django.db import models, migrations
import core.votable
from django.conf import settings
import django.utils.timezone
import django.contrib.auth.models
import django.contrib.auth.validators
import django.core.validators
import core.votable
from django.db import migrations, models
import django.db.models.deletion
import django.utils.timezone


class Migration(migrations.Migration):

initial = True

dependencies = [
('auth', '0001_initial'),
('auth', '0009_alter_user_last_name_max_length'),
]

operations = [
migrations.CreateModel(
name='FinetoothUser',
fields=[
('id', models.AutoField(auto_created=True, verbose_name='ID', primary_key=True, serialize=False)),
('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
('password', models.CharField(max_length=128, verbose_name='password')),
('last_login', models.DateTimeField(verbose_name='last login', default=django.utils.timezone.now)),
('is_superuser', models.BooleanField(verbose_name='superuser status', default=False, help_text='Designates that this user has all permissions without explicitly assigning them.')),
('username', models.CharField(unique=True, max_length=30, verbose_name='username', validators=[django.core.validators.RegexValidator('^[\\w.@+-]+$', 'Enter a valid username.', 'invalid')], help_text='Required. 30 characters or fewer. Letters, digits and @/./+/-/_ only.')),
('first_name', models.CharField(max_length=30, blank=True, verbose_name='first name')),
('last_name', models.CharField(max_length=30, blank=True, verbose_name='last name')),
('email', models.EmailField(max_length=75, blank=True, verbose_name='email address')),
('is_staff', models.BooleanField(verbose_name='staff status', default=False, help_text='Designates whether the user can log into this admin site.')),
('is_active', models.BooleanField(verbose_name='active', default=True, help_text='Designates whether this user should be treated as active. Unselect this instead of deleting accounts.')),
('date_joined', models.DateTimeField(verbose_name='date joined', default=django.utils.timezone.now)),
('last_login', models.DateTimeField(blank=True, null=True, verbose_name='last login')),
('is_superuser', models.BooleanField(default=False, help_text='Designates that this user has all permissions without explicitly assigning them.', verbose_name='superuser status')),
('username', models.CharField(error_messages={'unique': 'A user with that username already exists.'}, help_text='Required. 150 characters or fewer. Letters, digits and @/./+/-/_ only.', max_length=150, unique=True, validators=[django.contrib.auth.validators.UnicodeUsernameValidator()], verbose_name='username')),
('first_name', models.CharField(blank=True, max_length=30, verbose_name='first name')),
('last_name', models.CharField(blank=True, max_length=150, verbose_name='last name')),
('email', models.EmailField(blank=True, max_length=254, verbose_name='email address')),
('is_staff', models.BooleanField(default=False, help_text='Designates whether the user can log into this admin site.', verbose_name='staff status')),
('is_active', models.BooleanField(default=True, help_text='Designates whether this user should be treated as active. Unselect this instead of deleting accounts.', verbose_name='active')),
('date_joined', models.DateTimeField(default=django.utils.timezone.now, verbose_name='date joined')),
('location', models.CharField(max_length=100, null=True)),
('url', models.URLField(null=True)),
('groups', models.ManyToManyField(verbose_name='groups', to='auth.Group', related_name='user_set', blank=True, help_text='The groups this user belongs to. A user will get all permissions granted to each of his/her group.', related_query_name='user')),
('user_permissions', models.ManyToManyField(verbose_name='user permissions', to='auth.Permission', related_name='user_set', blank=True, help_text='Specific permissions for this user.', related_query_name='user')),
('groups', models.ManyToManyField(blank=True, help_text='The groups this user belongs to. A user will get all permissions granted to each of their groups.', related_name='user_set', related_query_name='user', to='auth.Group', verbose_name='groups')),
('user_permissions', models.ManyToManyField(blank=True, help_text='Specific permissions for this user.', related_name='user_set', related_query_name='user', to='auth.Permission', verbose_name='user permissions')),
],
options={
'abstract': False,
'verbose_name': 'user',
'abstract': False,
'verbose_name_plural': 'users',
},
bases=(models.Model,),
managers=[
('objects', django.contrib.auth.models.UserManager()),
],
),
migrations.CreateModel(
name='Comment',
fields=[
('id', models.AutoField(auto_created=True, verbose_name='ID', primary_key=True, serialize=False)),
('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
('content', models.TextField()),
('commenter', models.ForeignKey(to=settings.AUTH_USER_MODEL)),
('parent', models.ForeignKey(to='core.Comment', null=True)),
('published_at', models.DateTimeField(auto_now_add=True)),
('commenter', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to=settings.AUTH_USER_MODEL)),
('parent', models.ForeignKey(null=True, on_delete=django.db.models.deletion.CASCADE, to='core.Comment')),
],
options={
'ordering': ('published_at',),
},
bases=(models.Model, core.votable.VotableMixin),
),
migrations.CreateModel(
name='Post',
fields=[
('id', models.AutoField(auto_created=True, verbose_name='ID', primary_key=True, serialize=False)),
('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
('title', models.CharField(max_length=200)),
('content', models.TextField()),
('author', models.ForeignKey(to=settings.AUTH_USER_MODEL)),
('content', models.TextField(validators=[django.core.validators.MinLengthValidator(5, 'Posts must contain at least five characters.')])),
('published_at', models.DateTimeField()),
('slug', models.SlugField(unique=True)),
('author', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to=settings.AUTH_USER_MODEL)),
],
options={
'ordering': ('-published_at',),
},
bases=(models.Model, core.votable.VotableMixin),
),
migrations.CreateModel(
name='Tag',
fields=[
('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
('label', models.CharField(max_length=64, unique=True)),
('posts', models.ManyToManyField(to='core.Post')),
],
),
migrations.CreateModel(
name='Vote',
fields=[
('id', models.AutoField(auto_created=True, verbose_name='ID', primary_key=True, serialize=False)),
('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
('value', models.IntegerField()),
('start_index', models.PositiveIntegerField()),
('end_index', models.PositiveIntegerField()),
],
options={
},
bases=(models.Model,),
),
migrations.CreateModel(
name='PostVote',
name='CommentVote',
fields=[
('vote_ptr', models.OneToOneField(auto_created=True, serialize=False, to='core.Vote', parent_link=True, primary_key=True)),
('post', models.ForeignKey(to='core.Post')),
('vote_ptr', models.OneToOneField(auto_created=True, on_delete=django.db.models.deletion.CASCADE, parent_link=True, primary_key=True, serialize=False, to='core.Vote')),
],
options={
},
bases=('core.vote',),
),
migrations.CreateModel(
name='CommentVote',
name='PostVote',
fields=[
('vote_ptr', models.OneToOneField(auto_created=True, serialize=False, to='core.Vote', parent_link=True, primary_key=True)),
('comment', models.ForeignKey(to='core.Comment')),
('vote_ptr', models.OneToOneField(auto_created=True, on_delete=django.db.models.deletion.CASCADE, parent_link=True, primary_key=True, serialize=False, to='core.Vote')),
('post', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to='core.Post')),
],
options={
},
bases=('core.vote',),
),
migrations.AddField(
model_name='vote',
name='voter',
field=models.ForeignKey(to=settings.AUTH_USER_MODEL),
preserve_default=True,
field=models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to=settings.AUTH_USER_MODEL),
),
migrations.AddField(
model_name='comment',
name='post',
field=models.ForeignKey(to='core.Post'),
preserve_default=True,
field=models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to='core.Post'),
),
migrations.AddField(
model_name='commentvote',
name='comment',
field=models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to='core.Comment'),
),
]
27 changes: 0 additions & 27 deletions core/migrations/0002_auto_20140903_0357.py

This file was deleted.

25 changes: 0 additions & 25 deletions core/migrations/0003_tag.py

This file was deleted.

20 changes: 0 additions & 20 deletions core/migrations/0004_post_slug.py

This file was deleted.

29 changes: 0 additions & 29 deletions core/migrations/0005_slugifying_data_migration.py

This file was deleted.

19 changes: 0 additions & 19 deletions core/migrations/0006_auto_20141012_0251.py

This file was deleted.

47 changes: 0 additions & 47 deletions core/migrations/0007_auto_20150308_2143.py

This file was deleted.

20 changes: 0 additions & 20 deletions core/migrations/0008_auto_20150311_0549.py

This file was deleted.

Loading

0 comments on commit 97794ca

Please sign in to comment.