Skip to content

Commit

Permalink
Merge pull request #11 from pinax/fix-reverse-import
Browse files Browse the repository at this point in the history
Fix reverse import
  • Loading branch information
grahamu authored Jan 24, 2018
2 parents 001ff37 + 8dc1cf2 commit 59ac065
Show file tree
Hide file tree
Showing 6 changed files with 31 additions and 4 deletions.
2 changes: 1 addition & 1 deletion CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -88,7 +88,7 @@ Here is an example of these rules applied:

# second set of imports are Django imports with contrib in their own
# group.
from django.core.urlresolvers import reverse
from django.urls import reverse
from django.db import models
from django.utils import timezone
from django.utils.translation import ugettext_lazy as _
Expand Down
5 changes: 5 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -268,6 +268,11 @@ day.

## Change Log

### 2.0.3

* fix `reverse` import
* add tests

### 2.0.2

* Update requirements, add django>=1.11
Expand Down
2 changes: 1 addition & 1 deletion pinax/calendars/adapters.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
from collections import defaultdict

from django.core.urlresolvers import reverse
from django.urls import reverse

import pytz

Expand Down
19 changes: 18 additions & 1 deletion pinax/calendars/tests/tests.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,15 @@
import datetime

from django.db import models
from django.test import TestCase
from django.urls import reverse

from pinax.calendars.adapters import EventAdapter
from pinax.calendars.templatetags.pinax_calendars_tags import calendar, delta


from pinax.calendars.templatetags.pinax_calendars_tags import delta
class EventModel(models.Model):
date = models.DateTimeField()


class Tests(TestCase):
Expand All @@ -20,3 +29,11 @@ def test_delta_next(self):
"""
self.assertEqual(delta(2016, 2, 1), (2016, 3))
self.assertEqual(delta(2015, 12, 1), (2016, 1))

def test_calendar_prev_next(self):
events = EventAdapter(EventModel.objects.none())

context = {}
cal = calendar(context, events, datetime.datetime(2017, 2, 1))
self.assertEqual(cal["prev"], reverse("monthly", args=[2017, 1]))
self.assertEqual(cal["next"], reverse("monthly", args=[2017, 3]))
5 changes: 5 additions & 0 deletions pinax/calendars/tests/urls.py
Original file line number Diff line number Diff line change
@@ -1,2 +1,7 @@
from django.conf.urls import url
from django.views.generic import View

urlpatterns = [
url(r"^(?P<year>\d{4})/(?P<month>\d{1,2})/$", View.as_view(), name="monthly"),
url(r"^(?P<year>\d{4})/(?P<month>\d{1,2})/(?P<day>\d{1,2})/$", View.as_view(), name="daily"),
]
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 = "2.0.2"
VERSION = "2.0.3"
LONG_DESCRIPTION = """
.. image:: http://pinaxproject.com/pinax-design/patches/pinax-calendars.svg
:target: https://pypi.python.org/pypi/pinax-calendars/
Expand Down

0 comments on commit 59ac065

Please sign in to comment.