Commit cf789ec8 by benjaoming

(Missing from previous commit)

Refactor old South migration modules "migrations"->"south_migrations", add AppConfigs for future Django 1.7 (not supported yet), initial release notes, delete odd notifications migration that by mistake deletes the notifications subscriptions tables!
parent ddf6aa30
...@@ -4,6 +4,25 @@ django-wiki ...@@ -4,6 +4,25 @@ django-wiki
News News
---- ----
***News: May 18th, 2014***
Django-wiki 0.1 is landing, please see the Release Notes.
The overall plan is that we'll be supporting Python 2.7, Python 3.3+, and
Django 1.5+ simultaneuously. That actually means a lot under the hood.
Firstly, South is both unnecessary and incompatible with Django 1.7 as the
new django.db.migrations framework has arrived. Secondly, we still need
South migrations for Django installations before 1.7 (and those are still plenty).
Another big thing in 0.1 is the plugins API which is now freezing as is. This
means that proper documentation for writing plugins will arrive soon.
If you want to upgrade a system running django-wiki \< 0.1, please make sure to
have an installation of 0.0.24 first and do the migrations in that one!
Otherwise 0.1 will **not** work. Migration trees in 0.1 are reset and most likely,
the same thing will happen in 0.2, each minor number denoting that migrations
trees are squashed.
***News: November 18th, 2013*** ***News: November 18th, 2013***
Better late than never! A new release is out with promising support of django 1.6 and Bootstrap 3. Also, jquery, colorbox, and markitup editor have been bumped to newer releases. Better late than never! A new release is out with promising support of django 1.6 and Bootstrap 3. Also, jquery, colorbox, and markitup editor have been bumped to newer releases.
......
...@@ -16,6 +16,7 @@ Contents: ...@@ -16,6 +16,7 @@ Contents:
customization customization
settings settings
tips tips
release_notes
Indices and tables Indices and tables
......
...@@ -100,7 +100,6 @@ maintain the order due to database relational constraints: ...@@ -100,7 +100,6 @@ maintain the order due to database relational constraints:
'django.contrib.sites', # django 1.6.2 'django.contrib.sites', # django 1.6.2
'django.contrib.humanize', 'django.contrib.humanize',
'south',
'django_nyt', 'django_nyt',
'mptt', 'mptt',
'sekizai', 'sekizai',
...@@ -111,6 +110,26 @@ maintain the order due to database relational constraints: ...@@ -111,6 +110,26 @@ maintain the order due to database relational constraints:
'wiki.plugins.images', 'wiki.plugins.images',
'wiki.plugins.macros', 'wiki.plugins.macros',
Django < 1.7
~~~~~~~~~~~~
If you run older versions of django, please point south to the correct
migrations modules like so:
::
INSTALLED_APPS.append('south')
SOUTH_MIGRATION_MODULES = {
'django_nyt': 'django_nyt.south_migrations',
'wiki': 'wiki.south_migrations',
'images': 'wiki.plugins.images.south_migrations',
'notifications': 'wiki.plugins.notifications.south_migrations',
'attachments': 'wiki.plugins.attachments.south_migrations',
}
Database Database
~~~~~~~~ ~~~~~~~~
......
...@@ -103,12 +103,15 @@ INSTALLED_APPS = [ ...@@ -103,12 +103,15 @@ INSTALLED_APPS = [
'wiki.plugins.notifications', 'wiki.plugins.notifications',
'mptt', 'mptt',
] ]
from django import VERSION from django import VERSION
if VERSION <= (1, 6): if VERSION <= (1, 6):
INSTALLED_APPS.append('south') INSTALLED_APPS.append('south')
SOUTH_MIGRATION_MODULES = { SOUTH_MIGRATION_MODULES = {
'django_nyt': 'django_nyt.south_migrations', 'django_nyt': 'django_nyt.south_migrations',
'wiki': 'wiki.south_migrations',
'images': 'wiki.plugins.images.south_migrations',
'notifications': 'wiki.plugins.notifications.south_migrations',
'attachments': 'wiki.plugins.attachments.south_migrations',
} }
else: else:
TEST_RUNNER = 'django.test.runner.DiscoverRunner' TEST_RUNNER = 'django.test.runner.DiscoverRunner'
......
...@@ -15,4 +15,4 @@ ...@@ -15,4 +15,4 @@
# You should have received a copy of the GNU General Public License # You should have received a copy of the GNU General Public License
# along with django-wiki. If not, see <http://www.gnu.org/licenses/>. # along with django-wiki. If not, see <http://www.gnu.org/licenses/>.
VERSION = "0.0.3" VERSION = "0.0.24dev"
...@@ -17,6 +17,7 @@ class ArticleRevisionForm(forms.ModelForm): ...@@ -17,6 +17,7 @@ class ArticleRevisionForm(forms.ModelForm):
class Meta: class Meta:
model = models.ArticleRevision model = models.ArticleRevision
exclude = ()
def __init__(self, *args, **kwargs): def __init__(self, *args, **kwargs):
super(ArticleRevisionForm, self).__init__(*args, **kwargs) super(ArticleRevisionForm, self).__init__(*args, **kwargs)
...@@ -47,6 +48,7 @@ class ArticleForm(forms.ModelForm): ...@@ -47,6 +48,7 @@ class ArticleForm(forms.ModelForm):
class Meta: class Meta:
model = models.Article model = models.Article
exclude = ()
def __init__(self, *args, **kwargs): def __init__(self, *args, **kwargs):
super(ArticleForm, self).__init__(*args, **kwargs) super(ArticleForm, self).__init__(*args, **kwargs)
......
# -*- coding: utf-8 -*- # -*- coding: utf-8 -*-
from django.conf import settings as django_settings from django.conf import settings as django_settings
from django.core.urlresolvers import reverse_lazy from django.core.urlresolvers import reverse_lazy
from django.utils.translation import ugettext as _ from django.utils.translation import ugettext_lazy as _
# Should urls be case sensitive? # Should urls be case sensitive?
URL_CASE_SENSITIVE = getattr( django_settings, 'WIKI_URL_CASE_SENSITIVE', False ) URL_CASE_SENSITIVE = getattr( django_settings, 'WIKI_URL_CASE_SENSITIVE', False )
......
# -*- coding: utf-8 -*- # -*- coding: utf-8 -*-
from django import VERSION
from django.conf import settings as django_settings from django.conf import settings as django_settings
from django.core.exceptions import ImproperlyConfigured from django.core.exceptions import ImproperlyConfigured
import warnings import warnings
...@@ -41,8 +42,10 @@ if not 'django.core.context_processors.request' in django_settings.TEMPLATE_CONT ...@@ -41,8 +42,10 @@ if not 'django.core.context_processors.request' in django_settings.TEMPLATE_CONT
# Warnings # Warnings
###################### ######################
if not 'south' in django_settings.INSTALLED_APPS:
warnings.warn("django-wiki: No south in your INSTALLED_APPS. This is highly discouraged.") if VERSION < (1, 7):
if not 'south' in django_settings.INSTALLED_APPS:
warnings.warn("django-wiki: No south in your INSTALLED_APPS. This is highly discouraged.")
from django.core import urlresolvers from django.core import urlresolvers
......
default_app_config = 'wiki.apps.AttachmentsConfig'
\ No newline at end of file
...@@ -43,7 +43,8 @@ class Attachment(ReusablePlugin): ...@@ -43,7 +43,8 @@ class Attachment(ReusablePlugin):
class Meta: class Meta:
verbose_name = _('attachment') verbose_name = _('attachment')
verbose_name_plural = _('attachments') verbose_name_plural = _('attachments')
app_label = settings.APP_LABEL if settings.APP_LABEL:
app_label = settings.APP_LABEL
def __unicode__(self): def __unicode__(self):
return "%s: %s" % (self.article.current_revision.title, self.original_filename) return "%s: %s" % (self.article.current_revision.title, self.original_filename)
...@@ -102,7 +103,8 @@ class AttachmentRevision(BaseRevisionMixin, models.Model): ...@@ -102,7 +103,8 @@ class AttachmentRevision(BaseRevisionMixin, models.Model):
verbose_name_plural = _('attachment revisions') verbose_name_plural = _('attachment revisions')
ordering = ('created',) ordering = ('created',)
get_latest_by = 'revision_number' get_latest_by = 'revision_number'
app_label = settings.APP_LABEL if settings.APP_LABEL:
app_label = settings.APP_LABEL
def get_filename(self): def get_filename(self):
"""Used to retrieve the filename of a revision. """Used to retrieve the filename of a revision.
......
from django import VERSION
from django.conf import settings as django_settings from django.conf import settings as django_settings
from wiki.conf import settings as wiki_settings from wiki.conf import settings as wiki_settings
from django.core.exceptions import ImproperlyConfigured from django.core.exceptions import ImproperlyConfigured
APP_LABEL = 'wiki' # This is not used in django 1.7+
APP_LABEL = 'attachments' if VERSION < (1, 7) else None
SLUG = "attachments" SLUG = "attachments"
# Please see this note about support for UTF-8 files on django/apache: # Please see this note about support for UTF-8 files on django/apache:
......
default_app_config = 'wiki.apps.ImagesConfig'
\ No newline at end of file
...@@ -6,6 +6,7 @@ class ImageForm(forms.ModelForm): ...@@ -6,6 +6,7 @@ class ImageForm(forms.ModelForm):
class Meta: class Meta:
model = models.Image model = models.Image
exclude = ()
def __init__(self, *args, **kwargs): def __init__(self, *args, **kwargs):
super(ImageForm, self).__init__(*args, **kwargs) super(ImageForm, self).__init__(*args, **kwargs)
......
...@@ -40,7 +40,8 @@ class Image(RevisionPlugin): ...@@ -40,7 +40,8 @@ class Image(RevisionPlugin):
class Meta: class Meta:
verbose_name = _('image') verbose_name = _('image')
verbose_name_plural = _('images') verbose_name_plural = _('images')
app_label = settings.APP_LABEL if settings.APP_LABEL:
app_label = settings.APP_LABEL
def __unicode__(self): def __unicode__(self):
title = (_('Image: %s') % self.current_revision.imagerevision.get_filename()) if self.current_revision else _('Current revision not set!!') title = (_('Image: %s') % self.current_revision.imagerevision.get_filename()) if self.current_revision else _('Current revision not set!!')
...@@ -93,7 +94,8 @@ class ImageRevision(RevisionPluginRevision): ...@@ -93,7 +94,8 @@ class ImageRevision(RevisionPluginRevision):
class Meta: class Meta:
verbose_name = _('image revision') verbose_name = _('image revision')
verbose_name_plural = _('image revisions') verbose_name_plural = _('image revisions')
app_label = settings.APP_LABEL if settings.APP_LABEL:
app_label = settings.APP_LABEL
ordering = ('-created',) ordering = ('-created',)
def __unicode__(self): def __unicode__(self):
......
from django import VERSION
from django.conf import settings as django_settings from django.conf import settings as django_settings
from wiki.conf import settings as wiki_settings from wiki.conf import settings as wiki_settings
SLUG = 'images' SLUG = 'images'
APP_LABEL = 'wiki'
# This is deprecated in django 1.7+
APP_LABEL = 'images' if VERSION < (1, 7) else None
# Where to store images # Where to store images
IMAGE_PATH = getattr(django_settings, 'WIKI_IMAGES_PATH', "wiki/images/%aid/") IMAGE_PATH = getattr(django_settings, 'WIKI_IMAGES_PATH', "wiki/images/%aid/")
......
default_app_config = 'wiki.apps.NotifcationsConfig'
\ No newline at end of file
...@@ -3,6 +3,7 @@ from __future__ import unicode_literals ...@@ -3,6 +3,7 @@ from __future__ import unicode_literals
from django.core.urlresolvers import reverse from django.core.urlresolvers import reverse
from django.utils.translation import ugettext_lazy as _ from django.utils.translation import ugettext_lazy as _
from django.db.models import signals from django.db.models import signals
from django.db import models
from django_nyt.utils import notify from django_nyt.utils import notify
from django_nyt.models import Subscription from django_nyt.models import Subscription
...@@ -13,17 +14,22 @@ from wiki.core.plugins import registry ...@@ -13,17 +14,22 @@ from wiki.core.plugins import registry
from wiki.plugins.notifications import settings from wiki.plugins.notifications import settings
from wiki.plugins.notifications.util import get_title from wiki.plugins.notifications.util import get_title
class ArticleSubscription(ArticlePlugin, Subscription):
class ArticleSubscription(ArticlePlugin):
subscription_ptr = models.OneToOneField(Subscription, related_name='deprecated_subscriptions')
subscription = models.OneToOneField(Subscription, null=True)
def __unicode__(self): def __unicode__(self):
title = (_("%(user)s subscribing to %(article)s (%(type)s)") % title = (_("%(user)s subscribing to %(article)s (%(type)s)") %
{'user': self.settings.user.username, {'user': self.settings.user.username,
'article': self.article.current_revision.title, 'article': self.article.current_revision.title,
'type': self.notification_type.label}) 'type': self.notification_type.label})
return unicode(title) return unicode(title)
class Meta: class Meta:
app_label = settings.APP_LABEL if settings.APP_LABEL:
app_label = settings.APP_LABEL
def default_url(article, urlpath=None): def default_url(article, urlpath=None):
......
#from django.conf import settings as django_settings from django import VERSION
APP_LABEL = 'wiki' # This is deprecated in django 1.7+
APP_LABEL = 'notifications' if VERSION < (1, 7) else None
# Key for django_nyt - changing it will break any existing notifications. # Key for django_nyt - changing it will break any existing notifications.
ARTICLE_EDIT = "article_edit" ARTICLE_EDIT = "article_edit"
......
# -*- coding: utf-8 -*-
import datetime
from south.db import db
from south.v2 import SchemaMigration
from django.db import models
class Migration(SchemaMigration):
def forwards(self, orm):
# Deleting model 'ArticleSubscription'
db.delete_table('notifications_articlesubscription')
def backwards(self, orm):
# Adding model 'ArticleSubscription'
db.create_table('notifications_articlesubscription', (
('articleplugin_ptr', self.gf('django.db.models.fields.related.OneToOneField')(to=orm['wiki.ArticlePlugin'], unique=True, primary_key=True)),
('subscription_ptr', self.gf('django.db.models.fields.related.OneToOneField')(to=orm['django_notify.Subscription'], unique=True)),
))
db.send_create_signal('notifications', ['ArticleSubscription'])
models = {
}
complete_apps = ['notifications']
\ No newline at end of file
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment