-
Notifications
You must be signed in to change notification settings - Fork 27
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
Don't import plugin models in main migrations #25
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -29,7 +29,7 @@ def build_media_pattern(base_folder, file_extension): | |
|
||
setup( | ||
name = "django-wiki", | ||
version="0.0.11", | ||
version="0.0.12", | ||
author = "Benjamin Bach", | ||
author_email = "[email protected]", | ||
description = ("A wiki system written for the Django framework."), | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
from __future__ import absolute_import, unicode_literals | ||
|
||
from django.apps import AppConfig | ||
from django.utils.translation import ugettext_lazy as _ | ||
|
||
|
||
class NotifcationsConfig(AppConfig): | ||
name = 'wiki.plugins.notifications' | ||
verbose_name = _("Wiki notifications") | ||
label = 'wiki_notifications' | ||
|
||
|
||
class ImagesConfig(AppConfig): | ||
name = 'wiki.plugins.images' | ||
verbose_name = _("Wiki images") | ||
label = 'wiki_images' | ||
|
||
|
||
class AttachmentsConfig(AppConfig): | ||
name = 'wiki.plugins.attachments' | ||
verbose_name = _("Wiki attachments") | ||
label = 'wiki_attachments' |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,55 @@ | ||
# -*- coding: utf-8 -*- | ||
# Generated by Django 1.11.5 on 2017-09-07 19:03 | ||
from __future__ import unicode_literals | ||
|
||
from django.db import migrations | ||
|
||
|
||
class Migration(migrations.Migration): | ||
|
||
dependencies = [ | ||
('wiki', '0004_increase_slug_size'), | ||
] | ||
|
||
operations = [ | ||
migrations.RemoveField( | ||
model_name='attachment', | ||
name='current_revision', | ||
), | ||
migrations.RemoveField( | ||
model_name='attachment', | ||
name='reusableplugin_ptr', | ||
), | ||
migrations.RemoveField( | ||
model_name='attachmentrevision', | ||
name='attachment', | ||
), | ||
migrations.RemoveField( | ||
model_name='attachmentrevision', | ||
name='previous_revision', | ||
), | ||
migrations.RemoveField( | ||
model_name='attachmentrevision', | ||
name='user', | ||
), | ||
migrations.RemoveField( | ||
model_name='image', | ||
name='revisionplugin_ptr', | ||
), | ||
migrations.RemoveField( | ||
model_name='imagerevision', | ||
name='revisionpluginrevision_ptr', | ||
), | ||
migrations.DeleteModel( | ||
name='Attachment', | ||
), | ||
migrations.DeleteModel( | ||
name='AttachmentRevision', | ||
), | ||
migrations.DeleteModel( | ||
name='Image', | ||
), | ||
migrations.DeleteModel( | ||
name='ImageRevision', | ||
), | ||
] |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
from __future__ import unicode_literals | ||
default_app_config = 'wiki.apps.AttachmentsConfig' |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,78 @@ | ||
# -*- coding: utf-8 -*- | ||
from __future__ import unicode_literals | ||
|
||
from django.db import models, migrations | ||
import wiki.plugins.attachments.models | ||
from django.conf import settings | ||
|
||
|
||
class Migration(migrations.Migration): | ||
|
||
dependencies = [ | ||
('wiki', '0004_increase_slug_size'), | ||
migrations.swappable_dependency(settings.AUTH_USER_MODEL), | ||
] | ||
|
||
operations = [ | ||
migrations.CreateModel( | ||
name='AttachmentRevision', | ||
fields=[ | ||
('id', models.AutoField(verbose_name='ID', serialize=False, auto_created=True, primary_key=True)), | ||
('revision_number', models.IntegerField(verbose_name='revision number', editable=False)), | ||
('user_message', models.TextField(blank=True)), | ||
('automatic_log', models.TextField(editable=False, blank=True)), | ||
('ip_address', models.GenericIPAddressField(verbose_name='IP address', null=True, editable=False, blank=True)), | ||
('modified', models.DateTimeField(auto_now=True)), | ||
('created', models.DateTimeField(auto_now_add=True)), | ||
('deleted', models.BooleanField(default=False, verbose_name='deleted')), | ||
('locked', models.BooleanField(default=False, verbose_name='locked')), | ||
('file', models.FileField(upload_to=wiki.plugins.attachments.models.upload_path, verbose_name='file')), | ||
('description', models.TextField(blank=True)), | ||
], | ||
options={ | ||
'ordering': ('created',), | ||
'get_latest_by': 'revision_number', | ||
'verbose_name': 'attachment revision', | ||
'verbose_name_plural': 'attachment revisions', | ||
'db_table': 'wiki_attachments_attachmentrevision', | ||
}, | ||
bases=(models.Model,), | ||
), | ||
migrations.CreateModel( | ||
name='Attachment', | ||
fields=[ | ||
('reusableplugin_ptr', models.OneToOneField(parent_link=True, auto_created=True, primary_key=True, serialize=False, to='wiki.ReusablePlugin')), | ||
('original_filename', models.CharField(max_length=256, null=True, verbose_name='original filename', blank=True)), | ||
], | ||
options={ | ||
'verbose_name': 'attachment', | ||
'verbose_name_plural': 'attachments', | ||
'db_table': 'wiki_attachments_attachment', | ||
}, | ||
bases=('wiki.reusableplugin',), | ||
), | ||
migrations.AddField( | ||
model_name='attachmentrevision', | ||
name='attachment', | ||
field=models.ForeignKey(to='wiki_attachments.Attachment'), | ||
preserve_default=True, | ||
), | ||
migrations.AddField( | ||
model_name='attachmentrevision', | ||
name='previous_revision', | ||
field=models.ForeignKey(blank=True, to='wiki_attachments.AttachmentRevision', null=True), | ||
preserve_default=True, | ||
), | ||
migrations.AddField( | ||
model_name='attachmentrevision', | ||
name='user', | ||
field=models.ForeignKey(verbose_name='user', blank=True, to=settings.AUTH_USER_MODEL, null=True), | ||
preserve_default=True, | ||
), | ||
migrations.AddField( | ||
model_name='attachment', | ||
name='current_revision', | ||
field=models.OneToOneField(related_name='current_set', null=True, to='wiki_attachments.AttachmentRevision', blank=True, help_text='The revision of this attachment currently in use (on all articles using the attachment)', verbose_name='current revision'), | ||
preserve_default=True, | ||
), | ||
] | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Why the separate There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This is what was in our original |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
from __future__ import unicode_literals | ||
default_app_config = 'wiki.apps.ImagesConfig' |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,43 @@ | ||
# -*- coding: utf-8 -*- | ||
from __future__ import unicode_literals | ||
|
||
from django.db import models, migrations | ||
import wiki.plugins.images.models | ||
|
||
|
||
class Migration(migrations.Migration): | ||
|
||
dependencies = [ | ||
('wiki', '0004_increase_slug_size'), | ||
] | ||
|
||
operations = [ | ||
migrations.CreateModel( | ||
name='Image', | ||
fields=[ | ||
('revisionplugin_ptr', models.OneToOneField(parent_link=True, auto_created=True, primary_key=True, serialize=False, to='wiki.RevisionPlugin')), | ||
], | ||
options={ | ||
'verbose_name': 'image', | ||
'verbose_name_plural': 'images', | ||
'db_table': 'wiki_images_image', | ||
}, | ||
bases=('wiki.revisionplugin',), | ||
), | ||
migrations.CreateModel( | ||
name='ImageRevision', | ||
fields=[ | ||
('revisionpluginrevision_ptr', models.OneToOneField(parent_link=True, auto_created=True, primary_key=True, serialize=False, to='wiki.RevisionPluginRevision')), | ||
('image', models.ImageField(upload_to=wiki.plugins.images.models.upload_path, width_field=b'width', height_field=b'height', max_length=2000, blank=True, null=True)), | ||
('width', models.SmallIntegerField(null=True, blank=True)), | ||
('height', models.SmallIntegerField(null=True, blank=True)), | ||
], | ||
options={ | ||
'ordering': ('-created',), | ||
'verbose_name': 'image revision', | ||
'verbose_name_plural': 'image revisions', | ||
'db_table': 'wiki_images_imagerevision', | ||
}, | ||
bases=('wiki.revisionpluginrevision',), | ||
), | ||
] |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,2 +1,5 @@ | ||
from __future__ import unicode_literals | ||
default_app_config = 'wiki.apps.NotifcationsConfig' | ||
|
||
# Key for django_notify | ||
ARTICLE_EDIT = "article_edit" |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
# -*- coding: utf-8 -*- | ||
from __future__ import unicode_literals | ||
|
||
from django.db import models, migrations | ||
|
||
|
||
class Migration(migrations.Migration): | ||
|
||
dependencies = [ | ||
('wiki', '0004_increase_slug_size'), | ||
('django_notify', '0001_initial'), | ||
] | ||
|
||
operations = [ | ||
migrations.CreateModel( | ||
name='ArticleSubscription', | ||
fields=[ | ||
('subscription_ptr', models.OneToOneField(parent_link=True, auto_created=True, to='django_notify.Subscription')), | ||
('articleplugin_ptr', models.OneToOneField(parent_link=True, auto_created=True, primary_key=True, serialize=False, to='wiki.ArticlePlugin')), | ||
], | ||
options={ | ||
'db_table': 'wiki_notifications_articlesubscription', | ||
}, | ||
bases=('wiki.articleplugin', 'django_notify.subscription'), | ||
), | ||
] |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Just curious - do Django's automatically-generated migrations remove each field like this before deleting models?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think these were just the foreign keys, removed separately to avoid referential integrity problems when dropping the tables. As I noted in my other reply, this is a fairly tangled pair of models.