From 8e3bdb14d54f4fa419748f921a555de31244a9c3 Mon Sep 17 00:00:00 2001 From: Graham Ullrich Date: Sun, 7 Jan 2018 18:08:45 -0700 Subject: [PATCH 1/3] Fix model name reference Should be `BadgeAward`, hat tip to eagle-eyed github user @eykd. --- README.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index 0a4c679..3e5c8d2 100644 --- a/README.md +++ b/README.md @@ -229,7 +229,7 @@ additional state to the `award()` method. ##### `badge_awarded` This signal is sent whenever a badge is awarded to a user. It provides a -single argument, `badge`, which is an instance of `pinax.badges.models.BadgeAwarded`. +single argument, `badge`, which is an instance of `pinax.badges.models.BadgeAward`. ### Template Tags @@ -258,7 +258,7 @@ To get the count as a template variable: This tag provides a `QuerySet` of all of a user's badges, ordered by when they were awarded, descending, and makes them available as a template variable. -The `QuerySet` is composed of `pinax.badges.models.BadgeAwarded` instances. +The `QuerySet` is composed of `pinax.badges.models.BadgeAward` instances. ```html {% badges_for_user user as badges %} From dc5004ea581128c6fa47867fd4947ecfe6850cad Mon Sep 17 00:00:00 2001 From: Graham Ullrich Date: Sun, 7 Jan 2018 18:23:51 -0700 Subject: [PATCH 2/3] Remove unused test setting --- runtests.py | 1 - 1 file changed, 1 deletion(-) diff --git a/runtests.py b/runtests.py index 9a8c8f9..db0353b 100644 --- a/runtests.py +++ b/runtests.py @@ -15,7 +15,6 @@ "pinax.badges", "pinax.badges.tests" ], - MIDDLEWARE_CLASSES=[], DATABASES={ "default": { "ENGINE": "django.db.backends.sqlite3", From 45d73922ca63af49627796a238b485f0affc540b Mon Sep 17 00:00:00 2001 From: Graham Ullrich Date: Sat, 20 Jan 2018 14:08:03 -0700 Subject: [PATCH 3/3] Add django>=1.11 requirement Improve doc markup --- .circleci/config.yml | 1 - README.md | 28 ++++++++++++++++++---------- setup.py | 4 ++-- 3 files changed, 20 insertions(+), 13 deletions(-) diff --git a/.circleci/config.yml b/.circleci/config.yml index 88e3d52..73efe61 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -7,7 +7,6 @@ common: &common - restore_cache: keys: - v2-deps-{{ .Environment.CIRCLE_JOB }}-{{ checksum "setup.py" }}-{{ checksum "tox.ini" }} - - v2-deps- - run: name: install dependencies command: pip install --user tox diff --git a/README.md b/README.md index 3e5c8d2..6d11d60 100644 --- a/README.md +++ b/README.md @@ -62,18 +62,27 @@ Django \ Python | 2.7 | 3.4 | 3.5 | 3.6 Install the development version: - pip install pinax-badges +```shell + $ pip install pinax-badges +``` Add `pinax.badges` to your `INSTALLED_APPS` setting: - INSTALLED_APPS = ( +```python + INSTALLED_APPS = [ # other apps "pinax.badges", - ) + ] +``` -Add entry to your `urls.py`: +Add `pinax.badges.urls` to your project urlpatterns: - url(r"^badges/", include("pinax.badges.urls", namespace="pinax_badges")) +```python + urlpatterns = [ + # other urls + url(r"^badges/", include("pinax.badges.urls", namespace="pinax_badges")), + ] +``` ### Usage @@ -173,7 +182,7 @@ to `possibly_award_badge()`. ### Asynchronous Badges -!!! important +**Important** To use asynchronous badges you must have [celery](http://github.com/ask/celery) installed and configured. @@ -191,7 +200,6 @@ compute `award()` correctly. This may be necessary because your `Badge` requires some mutable state. ```python - class AddictBadge(Badge): # stuff async = True @@ -244,13 +252,13 @@ This tag returns the number of badges that have been awarded to this user, it can either set a value in context, or simple display the count. To display the count its syntax is: -```html +```django {% badge_count user %} ``` To get the count as a template variable: -```html +```django {% badge_count user as badges %} ``` @@ -260,7 +268,7 @@ This tag provides a `QuerySet` of all of a user's badges, ordered by when they were awarded, descending, and makes them available as a template variable. The `QuerySet` is composed of `pinax.badges.models.BadgeAward` instances. -```html +```django {% badges_for_user user as badges %} ``` diff --git a/setup.py b/setup.py index bcc1e21..8d1bfdc 100644 --- a/setup.py +++ b/setup.py @@ -30,7 +30,7 @@ .. image:: http://slack.pinaxproject.com/badge.svg :target: http://slack.pinaxproject.com/ .. image:: https://img.shields.io/badge/license-MIT-blue.svg - :target: https://pypi.python.org/pypi/pinax-badges/ + :target: https://opensource.org/licenses/MIT/ \ @@ -80,7 +80,7 @@ "Topic :: Software Development :: Libraries :: Python Modules", ], install_requires=[ - "Django>=1.8" + "django>=1.11", ], tests_require=[ ],