Skip to content

Commit

Permalink
(Missing from previous commit)
Browse files Browse the repository at this point in the history
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!
  • Loading branch information
benjaoming committed May 18, 2014
1 parent ddf6aa3 commit cf789ec
Show file tree
Hide file tree
Showing 19 changed files with 84 additions and 45 deletions.
19 changes: 19 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,25 @@ django-wiki
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***

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.
Expand Down
1 change: 1 addition & 0 deletions docs/index.rst
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ Contents:
customization
settings
tips
release_notes


Indices and tables
Expand Down
21 changes: 20 additions & 1 deletion docs/installation.rst
Original file line number Diff line number Diff line change
Expand Up @@ -100,7 +100,6 @@ maintain the order due to database relational constraints:

'django.contrib.sites', # django 1.6.2
'django.contrib.humanize',
'south',
'django_nyt',
'mptt',
'sekizai',
Expand All @@ -111,6 +110,26 @@ maintain the order due to database relational constraints:
'wiki.plugins.images',
'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
~~~~~~~~

Expand Down
5 changes: 4 additions & 1 deletion testproject/testproject/settings/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -103,12 +103,15 @@
'wiki.plugins.notifications',
'mptt',
]

from django import VERSION
if VERSION <= (1, 6):
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',
}
else:
TEST_RUNNER = 'django.test.runner.DiscoverRunner'
Expand Down
2 changes: 1 addition & 1 deletion wiki/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,4 +15,4 @@
# You should have received a copy of the GNU General Public License
# along with django-wiki. If not, see <http://www.gnu.org/licenses/>.

VERSION = "0.0.3"
VERSION = "0.0.24dev"
2 changes: 2 additions & 0 deletions wiki/admin.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ class ArticleRevisionForm(forms.ModelForm):

class Meta:
model = models.ArticleRevision
exclude = ()

def __init__(self, *args, **kwargs):
super(ArticleRevisionForm, self).__init__(*args, **kwargs)
Expand Down Expand Up @@ -47,6 +48,7 @@ class ArticleForm(forms.ModelForm):

class Meta:
model = models.Article
exclude = ()

def __init__(self, *args, **kwargs):
super(ArticleForm, self).__init__(*args, **kwargs)
Expand Down
2 changes: 1 addition & 1 deletion wiki/conf/settings.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
# -*- coding: utf-8 -*-
from django.conf import settings as django_settings
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?
URL_CASE_SENSITIVE = getattr( django_settings, 'WIKI_URL_CASE_SENSITIVE', False )
Expand Down
7 changes: 5 additions & 2 deletions wiki/models/__init__.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
# -*- coding: utf-8 -*-

from django import VERSION
from django.conf import settings as django_settings
from django.core.exceptions import ImproperlyConfigured
import warnings
Expand Down Expand Up @@ -41,8 +42,10 @@
# 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
Expand Down
1 change: 1 addition & 0 deletions wiki/plugins/attachments/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
default_app_config = 'wiki.apps.AttachmentsConfig'
6 changes: 4 additions & 2 deletions wiki/plugins/attachments/models.py
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,8 @@ def can_delete(self, user):
class Meta:
verbose_name = _('attachment')
verbose_name_plural = _('attachments')
app_label = settings.APP_LABEL
if settings.APP_LABEL:
app_label = settings.APP_LABEL

def __unicode__(self):
return "%s: %s" % (self.article.current_revision.title, self.original_filename)
Expand Down Expand Up @@ -102,7 +103,8 @@ class Meta:
verbose_name_plural = _('attachment revisions')
ordering = ('created',)
get_latest_by = 'revision_number'
app_label = settings.APP_LABEL
if settings.APP_LABEL:
app_label = settings.APP_LABEL

def get_filename(self):
"""Used to retrieve the filename of a revision.
Expand Down
4 changes: 3 additions & 1 deletion wiki/plugins/attachments/settings.py
Original file line number Diff line number Diff line change
@@ -1,8 +1,10 @@
from django import VERSION
from django.conf import settings as django_settings
from wiki.conf import settings as wiki_settings
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"

# Please see this note about support for UTF-8 files on django/apache:
Expand Down
1 change: 1 addition & 0 deletions wiki/plugins/images/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
default_app_config = 'wiki.apps.ImagesConfig'
1 change: 1 addition & 0 deletions wiki/plugins/images/admin.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ class ImageForm(forms.ModelForm):

class Meta:
model = models.Image
exclude = ()

def __init__(self, *args, **kwargs):
super(ImageForm, self).__init__(*args, **kwargs)
Expand Down
6 changes: 4 additions & 2 deletions wiki/plugins/images/models.py
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,8 @@ def can_delete(self, user):
class Meta:
verbose_name = _('image')
verbose_name_plural = _('images')
app_label = settings.APP_LABEL
if settings.APP_LABEL:
app_label = settings.APP_LABEL

def __unicode__(self):
title = (_('Image: %s') % self.current_revision.imagerevision.get_filename()) if self.current_revision else _('Current revision not set!!')
Expand Down Expand Up @@ -93,7 +94,8 @@ def inherit_predecessor(self, image, skip_image_file=False):
class Meta:
verbose_name = _('image revision')
verbose_name_plural = _('image revisions')
app_label = settings.APP_LABEL
if settings.APP_LABEL:
app_label = settings.APP_LABEL
ordering = ('-created',)

def __unicode__(self):
Expand Down
5 changes: 4 additions & 1 deletion wiki/plugins/images/settings.py
Original file line number Diff line number Diff line change
@@ -1,8 +1,11 @@
from django import VERSION
from django.conf import settings as django_settings
from wiki.conf import settings as wiki_settings

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
IMAGE_PATH = getattr(django_settings, 'WIKI_IMAGES_PATH', "wiki/images/%aid/")
Expand Down
1 change: 1 addition & 0 deletions wiki/plugins/notifications/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
default_app_config = 'wiki.apps.NotifcationsConfig'
12 changes: 9 additions & 3 deletions wiki/plugins/notifications/models.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
from django.core.urlresolvers import reverse
from django.utils.translation import ugettext_lazy as _
from django.db.models import signals
from django.db import models

from django_nyt.utils import notify
from django_nyt.models import Subscription
Expand All @@ -13,17 +14,22 @@
from wiki.plugins.notifications import settings
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):
title = (_("%(user)s subscribing to %(article)s (%(type)s)") %
title = (_("%(user)s subscribing to %(article)s (%(type)s)") %
{'user': self.settings.user.username,
'article': self.article.current_revision.title,
'type': self.notification_type.label})
return unicode(title)

class Meta:
app_label = settings.APP_LABEL
if settings.APP_LABEL:
app_label = settings.APP_LABEL


def default_url(article, urlpath=None):
Expand Down
5 changes: 3 additions & 2 deletions wiki/plugins/notifications/settings.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
#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.
ARTICLE_EDIT = "article_edit"
Expand Down

This file was deleted.

0 comments on commit cf789ec

Please sign in to comment.