-
Notifications
You must be signed in to change notification settings - Fork 10
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* work around possible Django migration bugs * cleaner solution that still seems to work * update forms and tests for email-based users * forgot to remove some spurious prints * Add the requirements from fkprocess to venv so inotify is loaded * oops, accidentally added a log file * these changes seem unoffensive enough and let the local version work by default * turns out you need to do this for the user model too * Minimal upgrade to Django 2.2 that also passes tests * run 0002 non-atomically for backwards compat * basic user auth working now * basic authentication is working * further incremental tweaks to everything * clean up database migrations * add atomic = False to original 0002 migration * make foreign key on_deletes more permissive * retrofit migrations
- Loading branch information
Showing
24 changed files
with
478 additions
and
116 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -6,6 +6,7 @@ | |
|
||
|
||
class Migration(migrations.Migration): | ||
atomic = False | ||
|
||
dependencies = [ | ||
('fk', '0001_initial'), | ||
|
55 changes: 55 additions & 0 deletions
55
packages/fkweb/fk/migrations/0006_add_foreign_key_constraints.py
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,55 @@ | ||
# Generated by Django 2.2 on 2020-01-25 10:45 | ||
|
||
from django.conf import settings | ||
from django.db import migrations, models | ||
import django.db.models.deletion | ||
|
||
|
||
class Migration(migrations.Migration): | ||
|
||
dependencies = [ | ||
('fk', '0005_user_rm_old_fields'), | ||
] | ||
|
||
operations = [ | ||
migrations.AlterField( | ||
model_name='asrun', | ||
name='video', | ||
field=models.ForeignKey(blank=True, null=True, on_delete=django.db.models.deletion.SET_NULL, to='fk.Video'), | ||
), | ||
migrations.AlterField( | ||
model_name='scheduleitem', | ||
name='video', | ||
field=models.ForeignKey(blank=True, null=True, on_delete=django.db.models.deletion.SET_NULL, to='fk.Video'), | ||
), | ||
migrations.AlterField( | ||
model_name='schedulepurpose', | ||
name='organization', | ||
field=models.ForeignKey(blank=True, null=True, on_delete=django.db.models.deletion.SET_NULL, to='fk.Organization'), | ||
), | ||
migrations.AlterField( | ||
model_name='video', | ||
name='editor', | ||
field=models.ForeignKey(on_delete=django.db.models.deletion.PROTECT, to=settings.AUTH_USER_MODEL), | ||
), | ||
migrations.AlterField( | ||
model_name='video', | ||
name='organization', | ||
field=models.ForeignKey(help_text='Organization for video', null=True, on_delete=django.db.models.deletion.PROTECT, to='fk.Organization'), | ||
), | ||
migrations.AlterField( | ||
model_name='videofile', | ||
name='format', | ||
field=models.ForeignKey(on_delete=django.db.models.deletion.PROTECT, to='fk.FileFormat'), | ||
), | ||
migrations.AlterField( | ||
model_name='videofile', | ||
name='video', | ||
field=models.ForeignKey(on_delete=django.db.models.deletion.PROTECT, to='fk.Video'), | ||
), | ||
migrations.AlterField( | ||
model_name='weeklyslot', | ||
name='purpose', | ||
field=models.ForeignKey(blank=True, null=True, on_delete=django.db.models.deletion.SET_NULL, to='fk.SchedulePurpose'), | ||
), | ||
] |
54 changes: 54 additions & 0 deletions
54
packages/fkweb/fk/migrations/0007_work_around_table_name_mishigas.py
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,54 @@ | ||
# -*- coding: utf-8 -*- | ||
# Generated by Django 1.11.26 on 2019-11-17 21:03 | ||
from __future__ import unicode_literals | ||
|
||
from django.db import migrations | ||
|
||
|
||
class Migration(migrations.Migration): | ||
atomic = False | ||
|
||
dependencies = [ | ||
('fk', '0006_add_foreign_key_constraints'), | ||
] | ||
|
||
operations = [ | ||
# By calling RenameModel, for some reason Django no longer | ||
# fails to update the ForeignKey references in the schema. | ||
migrations.RenameModel('User', 'UserNew'), | ||
migrations.AlterModelTable( | ||
name='UserNew', | ||
table=None, | ||
), | ||
migrations.RenameModel('UserNew', 'User'), | ||
migrations.AlterModelOptions( | ||
name='user', | ||
options={'verbose_name': 'user', 'verbose_name_plural': 'users'}, | ||
), | ||
migrations.AlterModelTable( | ||
name='category', | ||
table=None, | ||
), | ||
migrations.RenameModel('FileFormat', 'FileFormatNew'), | ||
migrations.AlterModelTable( | ||
name='fileformatnew', | ||
table=None, | ||
), | ||
migrations.RenameModel('FileFormatNew', 'FileFormat'), | ||
migrations.RenameModel('Organization', 'OrganizationNew'), | ||
migrations.AlterModelTable( | ||
name='organizationnew', | ||
table=None, | ||
), | ||
migrations.RenameModel('OrganizationNew', 'Organization'), | ||
migrations.AlterModelTable( | ||
name='scheduleitem', | ||
table=None, | ||
), | ||
migrations.RenameModel('Video', 'VideoNew'), | ||
migrations.AlterModelTable( | ||
name='videonew', | ||
table=None, | ||
), | ||
migrations.RenameModel('VideoNew', 'Video'), | ||
] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -3,7 +3,7 @@ | |
import datetime | ||
|
||
from django.contrib.auth import get_user_model | ||
from django.core.urlresolvers import reverse | ||
from django.urls import reverse | ||
from django.test import TestCase | ||
from django.utils import timezone | ||
|
||
|
@@ -15,7 +15,7 @@ class UserRegistrationTest(TestCase): | |
|
||
|
||
def setUp(self): | ||
self.client.login(email='staff_user', password='test') | ||
self.client.login(email='staff_user@fake.com', password='test') | ||
|
||
|
||
def test_user_profile_update(self): | ||
|
@@ -25,12 +25,13 @@ def test_user_profile_update(self): | |
reverse('profile'), { | ||
'first_name': 'Firstname', | ||
'last_name': 'Lastname', | ||
# 'email': '[email protected]', | ||
'country': 'Norway' | ||
}) | ||
u = get_user_model().objects.get(email='staff_user') | ||
u = get_user_model().objects.get(email='staff_user@fake.com') | ||
self.assertEqual('Firstname', u.first_name) | ||
self.assertEqual('Lastname', u.last_name) | ||
self.assertEqual('staff_user', u.email) | ||
self.assertEqual('staff_user@fake.com', u.email) | ||
# Uncomment when https://github.com/Frikanalen/frikanalen/issues/77 is fixed | ||
#self.assertEqual('Norway', u.userprofile.country) | ||
|
||
|
@@ -245,7 +246,7 @@ def test_api_scheduleitems_list(self): | |
['00:00:10.010000', '00:01:00'], | ||
[v['video']['duration'] for v in r.data['results']]) | ||
self.assertEqual( | ||
['nuug_user', 'dummy_user'], | ||
['nuug_user@fake.com', 'dummy_user@fake.com'], | ||
[v['video']['editor'] for v in r.data['results']]) | ||
|
||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.