Skip to content

Commit

Permalink
Remove unneeded compatibility
Browse files Browse the repository at this point in the history
  • Loading branch information
grahamu committed Jan 25, 2018
1 parent a9a280f commit f3f2ecc
Show file tree
Hide file tree
Showing 6 changed files with 9 additions and 25 deletions.
4 changes: 4 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -472,6 +472,10 @@ urlpatterns = [

## Change Log

### 5.0.2

* Remove unneeded compatibility

### 5.0.1

* Fix bytestring decoding bug
Expand Down
19 changes: 0 additions & 19 deletions pinax/notifications/compat.py
Original file line number Diff line number Diff line change
@@ -1,8 +1,3 @@
try:
from django.contrib.contenttypes.fields import GenericForeignKey
except ImportError:
from django.contrib.contenttypes.generic import GenericForeignKey # noqa

try:
from urllib import quote
except ImportError:
Expand All @@ -17,17 +12,3 @@
from account.decorators import login_required
except ImportError:
from django.contrib.auth.decorators import login_required # noqa

try:
from django.apps import apps as django_apps
get_model = django_apps.get_model
except ImportError:
from django.db.models import get_model as old_get_model # noqa

def get_model(path):
return old_get_model(*path.split("."))

try:
from django.urls import reverse
except ImportError:
from django.core.urlresolvers import reverse # noqa
5 changes: 2 additions & 3 deletions pinax/notifications/conf.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,17 +2,16 @@

import importlib

from django.apps import apps as django_apps
from django.conf import settings # noqa
from django.core.exceptions import ImproperlyConfigured

from appconf import AppConf

from .compat import get_model


def load_model(path):
try:
return get_model(path)
return django_apps.get_model(path)
except ValueError:
raise ImproperlyConfigured(
"{0} must be of the form 'app_label.model_name'".format(path)
Expand Down
2 changes: 1 addition & 1 deletion pinax/notifications/models.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@

import base64

from django.contrib.contenttypes.fields import GenericForeignKey
from django.contrib.contenttypes.models import ContentType
from django.core.exceptions import ImproperlyConfigured
from django.db import models
Expand All @@ -11,7 +12,6 @@
from django.utils.translation import ugettext_lazy as _
from django.utils.translation import activate, get_language

from .compat import GenericForeignKey
from .conf import settings
from .hooks import hookset
from .utils import load_media_defaults
Expand Down
2 changes: 1 addition & 1 deletion pinax/notifications/tests/test_views.py
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
from django.contrib.auth import get_user_model
from django.test import RequestFactory, TestCase
from django.urls import reverse

from . import get_backend_id
from ..compat import reverse
from ..models import NoticeSetting, NoticeType
from ..views import NoticeSettingsView

Expand Down
2 changes: 1 addition & 1 deletion setup.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
from setuptools import find_packages, setup

VERSION = "5.0.1"
VERSION = "5.0.2"
LONG_DESCRIPTION = """
.. image:: http://pinaxproject.com/pinax-design/patches/pinax-notifications.svg
:target: https://pypi.python.org/pypi/pinax-notifications/
Expand Down

0 comments on commit f3f2ecc

Please sign in to comment.