From b3544906d70bae51315639ae12381a5c40b048e5 Mon Sep 17 00:00:00 2001 From: Les Orchard Date: Tue, 1 Jan 2013 21:00:45 -0500 Subject: [PATCH] fix issue 138: New badger_example app and standalone test scaffolding * Moved badger_example out of tests directory and up to package root * Clean out playdoh / jinja templates, since they live in badg.us * Misc tweaks to get tests working standalone --- .travis.yml | 22 ++ README.rst | 3 + badger/requirements/tests.txt | 12 + .../badger_playdoh/award_detail.html | 120 ---------- .../badger_playdoh/awards_by_badge.html | 35 --- .../badger_playdoh/awards_by_user.html | 18 -- .../templates/badger_playdoh/awards_list.html | 24 -- .../templates/badger_playdoh/badge_award.html | 31 --- .../badger_playdoh/badge_create.html | 80 ------- .../badger_playdoh/badge_delete.html | 44 ---- .../badger_playdoh/badge_detail.html | 209 ------------------ .../templates/badger_playdoh/badges_list.html | 39 ---- badger/templates/badger_playdoh/base.html | 1 - .../badger_playdoh/deferred_award_body.txt | 13 -- .../badger_playdoh/deferred_award_subject.txt | 1 - badger/templates/badger_playdoh/home.html | 125 ----------- .../includes/award_as_badge.html | 5 - .../includes/award_as_user.html | 4 - .../badger_playdoh/includes/award_full.html | 19 -- .../includes/awards_as_badges_list.html | 16 -- .../badger_playdoh/includes/awards_list.html | 34 --- .../badger_playdoh/includes/badge_full.html | 44 ---- .../badger_playdoh/includes/badges_list.html | 15 -- .../badger_playdoh/includes/pagination.html | 21 -- .../badger_vanilla/includes/award_full.html | 10 - badger/templatetags/badger_tags.py | 19 +- badger/tests/__init__.py | 8 +- badger/tests/test_badges_py.py | 2 +- badger/tests/test_models.py | 2 +- badger/tests/test_views.py | 10 +- .../__init__.py | 0 .../badges.py | 0 .../fixtures/badger_example_badges.json | 0 .../models.py | 0 .../templates/badger}/award_delete.html | 20 +- .../templates/badger}/award_detail.html | 0 .../templates/badger}/awards_by_badge.html | 0 .../templates/badger}/awards_by_user.html | 0 .../templates/badger}/awards_list.html | 0 .../templates/badger}/badge_award.html | 7 +- .../templates/badger/badge_create.html | 18 ++ .../templates/badger/badge_delete.html | 43 ++++ .../templates/badger}/badge_detail.html | 0 .../templates/badger}/badge_edit.html | 8 +- .../templates/badger}/badge_nominate_for.html | 10 +- .../templates/badger}/badges_by_user.html | 4 +- .../templates/badger}/badges_list.html | 0 .../templates/badger}/base.html | 0 .../badger}/claim_deferred_award.html | 40 ++-- .../templates/badger}/claims_list.html | 2 +- .../templates/badger/deferred_award_body.txt | 10 + .../badger/deferred_award_subject.txt | 2 + .../templates/badger}/home.html | 0 .../badger}/includes/award_as_badge.html | 0 .../badger}/includes/award_as_user.html | 0 .../templates/badger/includes/award_full.html | 24 ++ .../includes/awards_as_badges_list.html | 0 .../badger}/includes/awards_list.html | 0 .../badger}/includes/badge_full.html | 15 +- .../badger}/includes/badges_list.html | 0 .../badger}/includes/pagination.html | 0 .../templates/badger}/manage_claims.html | 4 +- .../templates/badger}/nomination_detail.html | 4 +- .../notification/award_accepted/full.html | 0 .../notification/award_accepted/full.txt | 0 .../notification/award_accepted/notice.html | 0 .../notification/award_accepted/short.txt | 0 .../notification/award_declined/full.html | 0 .../notification/award_declined/full.txt | 0 .../notification/award_declined/notice.html | 0 .../notification/award_declined/short.txt | 0 .../notification/award_received/full.html | 0 .../notification/award_received/full.txt | 0 .../notification/award_received/notice.html | 0 .../notification/award_received/short.txt | 0 .../notification/badge_awarded/full.html | 0 .../notification/badge_awarded/full.txt | 0 .../notification/badge_awarded/notice.html | 0 .../notification/badge_awarded/short.txt | 0 .../notification/badge_edited/full.html | 0 .../notification/badge_edited/full.txt | 0 .../notification/badge_edited/notice.html | 0 .../notification/badge_edited/short.txt | 0 .../templates/badger}/notification/base.html | 0 .../badger}/notification/email_body.txt | 0 .../badger}/notification/email_subject.txt | 0 .../templates/badger}/notification/full.html | 0 .../templates/badger}/notification/full.txt | 0 .../nomination_accepted/full.html | 0 .../notification/nomination_accepted/full.txt | 0 .../nomination_accepted/notice.html | 0 .../nomination_accepted/short.txt | 0 .../nomination_approved/full.html | 0 .../notification/nomination_approved/full.txt | 0 .../nomination_approved/notice.html | 0 .../nomination_approved/short.txt | 0 .../nomination_declined/full.html | 0 .../notification/nomination_declined/full.txt | 0 .../nomination_declined/notice.html | 0 .../nomination_declined/short.txt | 0 .../nomination_received/full.html | 0 .../notification/nomination_received/full.txt | 0 .../nomination_received/notice.html | 0 .../nomination_received/short.txt | 0 .../nomination_rejected/full.html | 0 .../notification/nomination_rejected/full.txt | 0 .../nomination_rejected/notice.html | 0 .../nomination_rejected/short.txt | 0 .../nomination_submitted/full.html | 0 .../nomination_submitted/full.txt | 0 .../nomination_submitted/notice.html | 0 .../nomination_submitted/short.txt | 0 .../badger}/notification/notice.html | 0 .../badger}/notification/notice_settings.html | 0 .../badger}/notification/notices.html | 0 .../templates/badger}/notification/short.txt | 0 .../badger}/notification/single.html | 0 .../templates/badger}/staff_tools.html | 6 +- badger_example/templates/base.html | 8 + badger_example/urls.py | 16 ++ manage.py | 13 ++ runtests.py | 56 +---- setup.py | 11 +- test_settings.py | 160 ++++++++++++++ 124 files changed, 416 insertions(+), 1051 deletions(-) create mode 100644 .travis.yml create mode 100644 badger/requirements/tests.txt delete mode 100644 badger/templates/badger_playdoh/award_detail.html delete mode 100644 badger/templates/badger_playdoh/awards_by_badge.html delete mode 100644 badger/templates/badger_playdoh/awards_by_user.html delete mode 100644 badger/templates/badger_playdoh/awards_list.html delete mode 100644 badger/templates/badger_playdoh/badge_award.html delete mode 100644 badger/templates/badger_playdoh/badge_create.html delete mode 100644 badger/templates/badger_playdoh/badge_delete.html delete mode 100644 badger/templates/badger_playdoh/badge_detail.html delete mode 100644 badger/templates/badger_playdoh/badges_list.html delete mode 100644 badger/templates/badger_playdoh/base.html delete mode 100644 badger/templates/badger_playdoh/deferred_award_body.txt delete mode 100644 badger/templates/badger_playdoh/deferred_award_subject.txt delete mode 100644 badger/templates/badger_playdoh/home.html delete mode 100644 badger/templates/badger_playdoh/includes/award_as_badge.html delete mode 100644 badger/templates/badger_playdoh/includes/award_as_user.html delete mode 100644 badger/templates/badger_playdoh/includes/award_full.html delete mode 100644 badger/templates/badger_playdoh/includes/awards_as_badges_list.html delete mode 100644 badger/templates/badger_playdoh/includes/awards_list.html delete mode 100644 badger/templates/badger_playdoh/includes/badge_full.html delete mode 100644 badger/templates/badger_playdoh/includes/badges_list.html delete mode 100644 badger/templates/badger_playdoh/includes/pagination.html delete mode 100644 badger/templates/badger_vanilla/includes/award_full.html rename {badger/tests/badger_example => badger_example}/__init__.py (100%) rename {badger/tests/badger_example => badger_example}/badges.py (100%) rename badger/tests/badger_example/fixtures/badger_tests_badger_example_badges.json => badger_example/fixtures/badger_example_badges.json (100%) rename {badger/tests/badger_example => badger_example}/models.py (100%) rename {badger/templates/badger_playdoh => badger_example/templates/badger}/award_delete.html (51%) rename {badger/templates/badger_vanilla => badger_example/templates/badger}/award_detail.html (100%) rename {badger/templates/badger_vanilla => badger_example/templates/badger}/awards_by_badge.html (100%) rename {badger/templates/badger_vanilla => badger_example/templates/badger}/awards_by_user.html (100%) rename {badger/templates/badger_vanilla => badger_example/templates/badger}/awards_list.html (100%) rename {badger/templates/badger_vanilla => badger_example/templates/badger}/badge_award.html (89%) create mode 100644 badger_example/templates/badger/badge_create.html create mode 100644 badger_example/templates/badger/badge_delete.html rename {badger/templates/badger_vanilla => badger_example/templates/badger}/badge_detail.html (100%) rename {badger/templates/badger_playdoh => badger_example/templates/badger}/badge_edit.html (72%) rename {badger/templates/badger_playdoh => badger_example/templates/badger}/badge_nominate_for.html (72%) rename {badger/templates/badger_playdoh => badger_example/templates/badger}/badges_by_user.html (79%) rename {badger/templates/badger_vanilla => badger_example/templates/badger}/badges_list.html (100%) rename {badger/templates/badger_vanilla => badger_example/templates/badger}/base.html (100%) rename {badger/templates/badger_playdoh => badger_example/templates/badger}/claim_deferred_award.html (60%) rename {badger/templates/badger_playdoh => badger_example/templates/badger}/claims_list.html (96%) create mode 100644 badger_example/templates/badger/deferred_award_body.txt create mode 100644 badger_example/templates/badger/deferred_award_subject.txt rename {badger/templates/badger_vanilla => badger_example/templates/badger}/home.html (100%) rename {badger/templates/badger_vanilla => badger_example/templates/badger}/includes/award_as_badge.html (100%) rename {badger/templates/badger_vanilla => badger_example/templates/badger}/includes/award_as_user.html (100%) create mode 100644 badger_example/templates/badger/includes/award_full.html rename {badger/templates/badger_vanilla => badger_example/templates/badger}/includes/awards_as_badges_list.html (100%) rename {badger/templates/badger_vanilla => badger_example/templates/badger}/includes/awards_list.html (100%) rename {badger/templates/badger_vanilla => badger_example/templates/badger}/includes/badge_full.html (66%) rename {badger/templates/badger_vanilla => badger_example/templates/badger}/includes/badges_list.html (100%) rename {badger/templates/badger_vanilla => badger_example/templates/badger}/includes/pagination.html (100%) rename {badger/templates/badger_playdoh => badger_example/templates/badger}/manage_claims.html (96%) rename {badger/templates/badger_playdoh => badger_example/templates/badger}/nomination_detail.html (97%) rename {badger/templates/badger_playdoh => badger_example/templates/badger}/notification/award_accepted/full.html (100%) rename {badger/templates/badger_playdoh => badger_example/templates/badger}/notification/award_accepted/full.txt (100%) rename {badger/templates/badger_playdoh => badger_example/templates/badger}/notification/award_accepted/notice.html (100%) rename {badger/templates/badger_playdoh => badger_example/templates/badger}/notification/award_accepted/short.txt (100%) rename {badger/templates/badger_playdoh => badger_example/templates/badger}/notification/award_declined/full.html (100%) rename {badger/templates/badger_playdoh => badger_example/templates/badger}/notification/award_declined/full.txt (100%) rename {badger/templates/badger_playdoh => badger_example/templates/badger}/notification/award_declined/notice.html (100%) rename {badger/templates/badger_playdoh => badger_example/templates/badger}/notification/award_declined/short.txt (100%) rename {badger/templates/badger_playdoh => badger_example/templates/badger}/notification/award_received/full.html (100%) rename {badger/templates/badger_playdoh => badger_example/templates/badger}/notification/award_received/full.txt (100%) rename {badger/templates/badger_playdoh => badger_example/templates/badger}/notification/award_received/notice.html (100%) rename {badger/templates/badger_playdoh => badger_example/templates/badger}/notification/award_received/short.txt (100%) rename {badger/templates/badger_playdoh => badger_example/templates/badger}/notification/badge_awarded/full.html (100%) rename {badger/templates/badger_playdoh => badger_example/templates/badger}/notification/badge_awarded/full.txt (100%) rename {badger/templates/badger_playdoh => badger_example/templates/badger}/notification/badge_awarded/notice.html (100%) rename {badger/templates/badger_playdoh => badger_example/templates/badger}/notification/badge_awarded/short.txt (100%) rename {badger/templates/badger_playdoh => badger_example/templates/badger}/notification/badge_edited/full.html (100%) rename {badger/templates/badger_playdoh => badger_example/templates/badger}/notification/badge_edited/full.txt (100%) rename {badger/templates/badger_playdoh => badger_example/templates/badger}/notification/badge_edited/notice.html (100%) rename {badger/templates/badger_playdoh => badger_example/templates/badger}/notification/badge_edited/short.txt (100%) rename {badger/templates/badger_playdoh => badger_example/templates/badger}/notification/base.html (100%) rename {badger/templates/badger_playdoh => badger_example/templates/badger}/notification/email_body.txt (100%) rename {badger/templates/badger_playdoh => badger_example/templates/badger}/notification/email_subject.txt (100%) rename {badger/templates/badger_playdoh => badger_example/templates/badger}/notification/full.html (100%) rename {badger/templates/badger_playdoh => badger_example/templates/badger}/notification/full.txt (100%) rename {badger/templates/badger_playdoh => badger_example/templates/badger}/notification/nomination_accepted/full.html (100%) rename {badger/templates/badger_playdoh => badger_example/templates/badger}/notification/nomination_accepted/full.txt (100%) rename {badger/templates/badger_playdoh => badger_example/templates/badger}/notification/nomination_accepted/notice.html (100%) rename {badger/templates/badger_playdoh => badger_example/templates/badger}/notification/nomination_accepted/short.txt (100%) rename {badger/templates/badger_playdoh => badger_example/templates/badger}/notification/nomination_approved/full.html (100%) rename {badger/templates/badger_playdoh => badger_example/templates/badger}/notification/nomination_approved/full.txt (100%) rename {badger/templates/badger_playdoh => badger_example/templates/badger}/notification/nomination_approved/notice.html (100%) rename {badger/templates/badger_playdoh => badger_example/templates/badger}/notification/nomination_approved/short.txt (100%) rename {badger/templates/badger_playdoh => badger_example/templates/badger}/notification/nomination_declined/full.html (100%) rename {badger/templates/badger_playdoh => badger_example/templates/badger}/notification/nomination_declined/full.txt (100%) rename {badger/templates/badger_playdoh => badger_example/templates/badger}/notification/nomination_declined/notice.html (100%) rename {badger/templates/badger_playdoh => badger_example/templates/badger}/notification/nomination_declined/short.txt (100%) rename {badger/templates/badger_playdoh => badger_example/templates/badger}/notification/nomination_received/full.html (100%) rename {badger/templates/badger_playdoh => badger_example/templates/badger}/notification/nomination_received/full.txt (100%) rename {badger/templates/badger_playdoh => badger_example/templates/badger}/notification/nomination_received/notice.html (100%) rename {badger/templates/badger_playdoh => badger_example/templates/badger}/notification/nomination_received/short.txt (100%) rename {badger/templates/badger_playdoh => badger_example/templates/badger}/notification/nomination_rejected/full.html (100%) rename {badger/templates/badger_playdoh => badger_example/templates/badger}/notification/nomination_rejected/full.txt (100%) rename {badger/templates/badger_playdoh => badger_example/templates/badger}/notification/nomination_rejected/notice.html (100%) rename {badger/templates/badger_playdoh => badger_example/templates/badger}/notification/nomination_rejected/short.txt (100%) rename {badger/templates/badger_playdoh => badger_example/templates/badger}/notification/nomination_submitted/full.html (100%) rename {badger/templates/badger_playdoh => badger_example/templates/badger}/notification/nomination_submitted/full.txt (100%) rename {badger/templates/badger_playdoh => badger_example/templates/badger}/notification/nomination_submitted/notice.html (100%) rename {badger/templates/badger_playdoh => badger_example/templates/badger}/notification/nomination_submitted/short.txt (100%) rename {badger/templates/badger_playdoh => badger_example/templates/badger}/notification/notice.html (100%) rename {badger/templates/badger_playdoh => badger_example/templates/badger}/notification/notice_settings.html (100%) rename {badger/templates/badger_playdoh => badger_example/templates/badger}/notification/notices.html (100%) rename {badger/templates/badger_playdoh => badger_example/templates/badger}/notification/short.txt (100%) rename {badger/templates/badger_playdoh => badger_example/templates/badger}/notification/single.html (100%) rename {badger/templates/badger_playdoh => badger_example/templates/badger}/staff_tools.html (84%) create mode 100644 badger_example/templates/base.html create mode 100644 badger_example/urls.py create mode 100755 manage.py create mode 100644 test_settings.py diff --git a/.travis.yml b/.travis.yml new file mode 100644 index 0000000..3b15597 --- /dev/null +++ b/.travis.yml @@ -0,0 +1,22 @@ +language: python + +python: + - "2.7" + +env: + - DB=mysql + +before_install: + - sudo apt-get update -qq + - sudo apt-get install build-essential python-dev python-pip python-virtualenv python-imaging python-lxml python-pyquery libxml2-dev libxslt-dev libjpeg8 libjpeg62-dev libfreetype6 libfreetype6-dev zlib1g-dev python-bcrypt sqlite3 + - sudo ln -s /usr/lib/`uname -i`-linux-gnu/libfreetype.so /usr/lib + - sudo ln -s /usr/lib/`uname -i`-linux-gnu/libz.so /usr/lib + +install: + - pip install -r badger/requirements/tests.txt --use-mirrors + +script: python manage.py test badger + +notifications: + email: + - me@lmorchard.com diff --git a/README.rst b/README.rst index fcdc6f5..13dde13 100644 --- a/README.rst +++ b/README.rst @@ -2,6 +2,9 @@ django-badger ============= +.. image:: https://secure.travis-ci.org/lmorchard/django-badger.png?branch=master + :target: http://travis-ci.org/lmorchard/django-badger + Badger is a family of Django apps intended to help introduce badges into your project, to track and award achievements by your users. This can be used to help encourage certain behaviors, recognize skills, or just generally diff --git a/badger/requirements/tests.txt b/badger/requirements/tests.txt new file mode 100644 index 0000000..f9a75cc --- /dev/null +++ b/badger/requirements/tests.txt @@ -0,0 +1,12 @@ +Django==1.4.3 +PIL==1.1.7 +lxml==3.1beta1 +pyquery==1.2.4 +South==0.7.6 +argparse==1.2.1 +cssselect==0.7.1 +distribute==0.6.24 +django-nose==1.1 +feedparser==5.1.3 +nose==1.2.1 +wsgiref==0.1.2 diff --git a/badger/templates/badger_playdoh/award_detail.html b/badger/templates/badger_playdoh/award_detail.html deleted file mode 100644 index 67ce5d6..0000000 --- a/badger/templates/badger_playdoh/award_detail.html +++ /dev/null @@ -1,120 +0,0 @@ -{% extends "badger_playdoh/base.html" %} - -{% set user = award.user %} -{% set award_url = request.build_absolute_uri(url('badger.views.award_detail', award.badge.slug, award.id)) %} -{% if award.image %} - {% set image_url = award.image.url %} -{% elif badge.image %} - {% set image_url = badge.image.url %} -{% else %} - {# TODO: Put the URL for default badge image in settings #} - {% set image_url = "/media/img/default-badge.png" %} -{% endif %} - -{% block pageid %}award_detail{% endblock %} - -{% block extrahead %} - - - - - - - - - - - - {% for tag in badge.tags.all() %} - - {% endfor %} -{% endblock %} - -{% block content %} - -
- -
- {% include "badger_playdoh/includes/badge_full.html" %} -
- -
- {% include "badger_playdoh/includes/award_full.html" %} - -
- -
- -
- - -{% endblock %} - -{% block js %} - - - -{% endblock %} diff --git a/badger/templates/badger_playdoh/awards_by_badge.html b/badger/templates/badger_playdoh/awards_by_badge.html deleted file mode 100644 index 85e8431..0000000 --- a/badger/templates/badger_playdoh/awards_by_badge.html +++ /dev/null @@ -1,35 +0,0 @@ -{% extends "badger_playdoh/base.html" %} - -{% block pageid %}badge_awards_by_badge{% endblock %} - -{% block extrahead %} - -{% endblock %} - -{% block content %} - -
-
- - {% include "badger_playdoh/includes/badge_full.html" %} -
- -
- -
    - {% for award in awards %} -
  • - {% include "badger_playdoh/includes/award_as_user.html" %} -
  • - {% endfor %} -
-
-
- -{% endblock %} diff --git a/badger/templates/badger_playdoh/awards_by_user.html b/badger/templates/badger_playdoh/awards_by_user.html deleted file mode 100644 index 20be26a..0000000 --- a/badger/templates/badger_playdoh/awards_by_user.html +++ /dev/null @@ -1,18 +0,0 @@ -{% extends "badger_playdoh/base.html" %} - -{% block pageid %}badge_awards_by_user{% endblock %} - -{% block extrahead %} - -{% endblock %} - -{% block content %} -
- - {% include "badger_playdoh/includes/awards_as_badges_list.html" %} -
-{% endblock %} diff --git a/badger/templates/badger_playdoh/awards_list.html b/badger/templates/badger_playdoh/awards_list.html deleted file mode 100644 index be7c4c8..0000000 --- a/badger/templates/badger_playdoh/awards_list.html +++ /dev/null @@ -1,24 +0,0 @@ -{% extends "badger_playdoh/base.html" %} - -{% block pageid %}awards{% endblock %} - -{% block extrahead %} - -{% endblock %} - -{% block content %} - -
- - {% include "badger_playdoh/includes/awards_list.html" %} -
- -{% endblock %} diff --git a/badger/templates/badger_playdoh/badge_award.html b/badger/templates/badger_playdoh/badge_award.html deleted file mode 100644 index 8c60a87..0000000 --- a/badger/templates/badger_playdoh/badge_award.html +++ /dev/null @@ -1,31 +0,0 @@ -{% extends "badger_playdoh/base.html" %} - -{% block pageid %}badge_award{% endblock %} - -{% block content %} - -
- -
- - {% include "badger_playdoh/includes/badge_full.html" %} -
- -
- - -
- {{ csrf() }} -
    - {{ form.as_ul() }} -
  • -
-
-
- -
-{% endblock %} diff --git a/badger/templates/badger_playdoh/badge_create.html b/badger/templates/badger_playdoh/badge_create.html deleted file mode 100644 index 9eb9515..0000000 --- a/badger/templates/badger_playdoh/badge_create.html +++ /dev/null @@ -1,80 +0,0 @@ -{% extends "badger_playdoh/base.html" %} - -{% block pageid %}badge_create{% endblock %} - -{% block content %} - -
-
-
- -
- {{ csrf() }} -
    - {{ form.as_ul() }} -
  • -
-
-
-
- -

{% trans %} - This isn't a real badge, but it shows a few things you can do. - {% endtrans %}

- {# TODO: Put the URL for default badge image in settings #} - {% set image_url = "/media/img/default-badge.png" %} -
-
{{_("Title:")}}
-
{{ _('Test Badger') }} -

{% trans %} - Try to keep this to 5 words, or less. - {% endtrans %}

-
{{_("Image:")}}
-
-

{% trans %} - This should be a square image, around 256x256 - pixels. The system will automatically crop and - resize images that fall outside these guidelines. - Also, consider using simple artwork that stays - distinctive at a variety of sizes and viewing - distances. Lots of small details and words are hard - to see when the badge image is either small or far - away. - {% endtrans %}

-
-
{{_("Description:")}}
-
{{ _("For having qualities like a test pilot, but more badgery.") }} -

{% trans %} - Use this to describe why someone would earn this - badge. Explain the conditions and criteria a person - would need to satisfy to receive this badge as an - award. - {% endtrans %}

-
-
{{ _("Tags:") }}
-
    - {% set tags = [ 'tests', 'A2makerfaire2012', 'badgers' ] %} - {% for tag in tags %} -
  • {{ tag }}
  • - {% endfor %} -
- {% set example_tag_url = url('badger.badges_list', tag_name='a2makerfaire2012') %} -

{% trans %} - Use tags to group your badge with others. These are - like hashtags on Twitter. - These are best used sparingly: - Try not to enter more than 2-5 concise topics or keywords. Events - often use tags to help gather badges that will be - offered (eg. A2makerfaire2012). - {% endtrans %}

-
-
-
-
-
- -{% endblock %} diff --git a/badger/templates/badger_playdoh/badge_delete.html b/badger/templates/badger_playdoh/badge_delete.html deleted file mode 100644 index b16d21e..0000000 --- a/badger/templates/badger_playdoh/badge_delete.html +++ /dev/null @@ -1,44 +0,0 @@ -{% extends "badger_playdoh/base.html" %} - -{% block pageid %}badge_delete{% endblock %} - -{% block content %} - -
- -
- - {% include "badger_playdoh/includes/badge_full.html" %} -
- -
- - -
- {{ csrf() }} - {% if awards_count %} -

{% trans badge_url=badge.get_absolute_url(), awards_count=awards_count %} - Note: - Deleting this badge will also delete - {{awards_count}} award(s) - {% endtrans %}

- {% else %} -

{% trans %} - Note: - No one has been awarded this badge, yet. - {% endtrans %}

- {% endif %} -

{{ _("Are you sure?") }}

-
    -
  • -
-
-
- -
- -{% endblock %} diff --git a/badger/templates/badger_playdoh/badge_detail.html b/badger/templates/badger_playdoh/badge_detail.html deleted file mode 100644 index bcbbc09..0000000 --- a/badger/templates/badger_playdoh/badge_detail.html +++ /dev/null @@ -1,209 +0,0 @@ -{% extends "badger_playdoh/base.html" %} - -{% set badge_url = request.build_absolute_uri(badge.get_absolute_url()) %} -{% if badge.image %} - {% set image_url = badge.image.url %} -{% else %} - {# TODO: Put the URL for default badge image in settings #} - {% set image_url = "/media/img/default-badge.png" %} -{% endif %} - -{% block pageid %}badge_detail{% endblock %} - -{% block extrahead %} - - - - - - - - - - - - {% for tag in badge.tags.all() %} - - {% endfor %} -{% endblock %} - -{% block content %} - -
- -
- - {% include "badger_playdoh/includes/badge_full.html" %} - {% if not award %} - - {% endif %} -
- - {% if award_list %} -
- -
- - -
- -
- {% endif %} - -
- - {% if badge.allows_nominate_for(request.user) %} -
- -
- {{ csrf() }} -
    - {{ sections.nominate.form.as_ul() }} -
  • -
-
-
- {% endif %} - - {% if badge.allows_award_to(request.user) %} -
- -
- {{ csrf() }} -
    - {{ sections.award.form.as_ul() }} -
  • -
-
-
- {% endif %} - - {% if badge.allows_manage_deferred_awards_by(request.user) %} -
- -
- {{ csrf() }} - - - -
- -
- {% endif %} - -
- -
- -
- - -{% endblock %} - -{% block js %} - - -{% endblock %} diff --git a/badger/templates/badger_playdoh/badges_list.html b/badger/templates/badger_playdoh/badges_list.html deleted file mode 100644 index 55775aa..0000000 --- a/badger/templates/badger_playdoh/badges_list.html +++ /dev/null @@ -1,39 +0,0 @@ -{% extends "badger_playdoh/base.html" %} - -{% block pageid %}badges{% endblock %} - -{% block content %} - -
- - {% include "badger_playdoh/includes/badges_list.html" %} - - {% if award_list %} -

{{ _('Recent awards for these badges') }}

- {% set award_list = award_list[:12] %} - {% set hide_pagination = True %} - {% include "badger_playdoh/includes/awards_list.html" %} - {% endif %} - -
-{% endblock %} diff --git a/badger/templates/badger_playdoh/base.html b/badger/templates/badger_playdoh/base.html deleted file mode 100644 index 94d9808..0000000 --- a/badger/templates/badger_playdoh/base.html +++ /dev/null @@ -1 +0,0 @@ -{% extends "base.html" %} diff --git a/badger/templates/badger_playdoh/deferred_award_body.txt b/badger/templates/badger_playdoh/deferred_award_body.txt deleted file mode 100644 index c5f112b..0000000 --- a/badger/templates/badger_playdoh/deferred_award_body.txt +++ /dev/null @@ -1,13 +0,0 @@ -{% trans domain=current_site.domain, - badge_url=badge.get_absolute_url(), - badge_title=badge.title, - claim_url=deferred_award.get_claim_url(), - protocol=(protocol or 'http') %} - -You have received an award for the badge {{ badge_title }}. - -You can claim it, here: - - {{ protocol }}://{{ domain }}{{ claim_url }} - -{% endtrans %} diff --git a/badger/templates/badger_playdoh/deferred_award_subject.txt b/badger/templates/badger_playdoh/deferred_award_subject.txt deleted file mode 100644 index bb4d25b..0000000 --- a/badger/templates/badger_playdoh/deferred_award_subject.txt +++ /dev/null @@ -1 +0,0 @@ -{% trans site_name=current_site.name, badge_title=badge.title %}[{{ site_name }}] Claim your award for the badge "{{ badge_title }}"{% endtrans %} diff --git a/badger/templates/badger_playdoh/home.html b/badger/templates/badger_playdoh/home.html deleted file mode 100644 index fb2cea1..0000000 --- a/badger/templates/badger_playdoh/home.html +++ /dev/null @@ -1,125 +0,0 @@ -{% extends "badger_playdoh/base.html" %} - -{% block pageid %}home{% endblock %} - -{% block extrahead %} - - -{% endblock %} - -{% block content %} - -
-

{{ _("Welcome to {site_title}!") | f(site_title=settings.SITE_TITLE) }}

- -
- -
-
-

This is an experimental service - for badges, - powered by Open Source. - Check the FAQ! - Submit suggestions! -

-
-
- {% if request.user.is_authenticated() %} -

{{ _("☺ View your profile") }}

- {% else %} - {% block signin %} -
- {{ csrf() }} - {% set next = request.GET.get('next', False) %} - {% if next %} - - {% else %} - - {% endif %} - {{ browserid_form.as_p()|safe }} - -
- {% endblock %} - {% endif %} -
-
- -
-
-

{{ _("Have a claim code?") }}

-

{{ _("Type it here to claim your badge:") }}

-
-
-
- {{ csrf() }} - - -
-
-
- -
-
-

{{ _("Have an idea for a badge?") }}

-

{{ _("Click here to start:") }}

-
-
-

{{ _("✸ Create a new badge") }}

-
-
- -
-
- -{% if badge_tags %} -
-
- -
-
-{% endif %} - -
- -
- - - {% set badge_list = badge_list[:12] %} - {% include "badger_playdoh/includes/badges_list.html" %} -
- -
- - {% set award_list = award_list[:9] %} - {% include "badger_playdoh/includes/awards_list.html" %} -
- -
-{% endblock %} diff --git a/badger/templates/badger_playdoh/includes/award_as_badge.html b/badger/templates/badger_playdoh/includes/award_as_badge.html deleted file mode 100644 index 1c8c427..0000000 --- a/badger/templates/badger_playdoh/includes/award_as_badge.html +++ /dev/null @@ -1,5 +0,0 @@ -{% set badge = award.badge %} -
- {% include "badger_playdoh/includes/badge_full.html" %} - {{ _('Award details') }} -
diff --git a/badger/templates/badger_playdoh/includes/award_as_user.html b/badger/templates/badger_playdoh/includes/award_as_user.html deleted file mode 100644 index 9b4c8d5..0000000 --- a/badger/templates/badger_playdoh/includes/award_as_user.html +++ /dev/null @@ -1,4 +0,0 @@ -{% set user = award.user %} -
- {{ user }} -
diff --git a/badger/templates/badger_playdoh/includes/award_full.html b/badger/templates/badger_playdoh/includes/award_full.html deleted file mode 100644 index 96391cc..0000000 --- a/badger/templates/badger_playdoh/includes/award_full.html +++ /dev/null @@ -1,19 +0,0 @@ -
-
{{_("Awarded to:")}}
-
- {{ award.user }}{{ award.user }} - {% if request.user == award.user %} - {{ _("(That's you!)") }} - {% endif %} -
-
{{_("Awarded by:")}}
-
{{ award.creator }}{{ award.creator }}
-
{{_("Awarded at:")}}
-
{{ award.created }}
- {% if award.description %} -
{{_("Explanation:")}}
-
{{ award.description }}
- {% endif %} -
diff --git a/badger/templates/badger_playdoh/includes/awards_as_badges_list.html b/badger/templates/badger_playdoh/includes/awards_as_badges_list.html deleted file mode 100644 index ada40a4..0000000 --- a/badger/templates/badger_playdoh/includes/awards_as_badges_list.html +++ /dev/null @@ -1,16 +0,0 @@ - -{% include "badger_playdoh/includes/pagination.html" %} diff --git a/badger/templates/badger_playdoh/includes/awards_list.html b/badger/templates/badger_playdoh/includes/awards_list.html deleted file mode 100644 index 11308e7..0000000 --- a/badger/templates/badger_playdoh/includes/awards_list.html +++ /dev/null @@ -1,34 +0,0 @@ - -{% if not hide_pagination %} - {% include "badger_playdoh/includes/pagination.html" %} -{% endif %} diff --git a/badger/templates/badger_playdoh/includes/badge_full.html b/badger/templates/badger_playdoh/includes/badge_full.html deleted file mode 100644 index f6969e8..0000000 --- a/badger/templates/badger_playdoh/includes/badge_full.html +++ /dev/null @@ -1,44 +0,0 @@ -{% if award and award.image %} - {% set image_url = award.image.url %} -{% elif badge.image %} - {% set image_url = badge.image.url %} -{% else %} - {# TODO: Put the URL for default badge image in settings #} - {% set image_url = "/media/img/default-badge.png" %} -{% endif %} -{% if not award %} - -{% endif %} -
- {% if badge_show_title %} -
{{_("Title:")}}
-
{{ badge.title }}
- {% endif %} -
{{_("Image:")}}
-
- {% if badge.description %} -
{{_("Description:")}}
-
{{ badge.description }}
- {% endif %} - {% if badge.tags and badge.tags.count() %} -
{{ _("Tags:") }}
-
- {% endif %} -
{{_("Creator:")}}
-
{{ badge.creator }}{{ badge.creator }}
-
{{_("Created:")}}
-
{{ badge.created }}
-
{{_("Modified:")}}
-
{{ badge.modified }}
-
diff --git a/badger/templates/badger_playdoh/includes/badges_list.html b/badger/templates/badger_playdoh/includes/badges_list.html deleted file mode 100644 index c27ea68..0000000 --- a/badger/templates/badger_playdoh/includes/badges_list.html +++ /dev/null @@ -1,15 +0,0 @@ - -{% include "badger_playdoh/includes/pagination.html" %} diff --git a/badger/templates/badger_playdoh/includes/pagination.html b/badger/templates/badger_playdoh/includes/pagination.html deleted file mode 100644 index f6f5a12..0000000 --- a/badger/templates/badger_playdoh/includes/pagination.html +++ /dev/null @@ -1,21 +0,0 @@ - diff --git a/badger/templates/badger_vanilla/includes/award_full.html b/badger/templates/badger_vanilla/includes/award_full.html deleted file mode 100644 index 7eb0d9e..0000000 --- a/badger/templates/badger_vanilla/includes/award_full.html +++ /dev/null @@ -1,10 +0,0 @@ -
-
Awarded to:
-
{{ award.user }}
-
Awarded by:
-
{{ award.creator }}
-
Issued on:
-
{{ award.created }}
-
diff --git a/badger/templatetags/badger_tags.py b/badger/templatetags/badger_tags.py index 2555be7..2cbc51d 100644 --- a/badger/templatetags/badger_tags.py +++ b/badger/templatetags/badger_tags.py @@ -16,6 +16,23 @@ from django.utils.translation import ugettext_lazy as _ register = template.Library() + +@register.filter +def permissions_for(obj, user): + try: + return obj.get_permissions_for(user) + except: + return {} + + +@register.filter +def key(obj, name): + try: + return obj[name] + except: + return None + + @register.simple_tag def user_avatar(user, secure=False, size=256, rating='pg', default=''): @@ -65,4 +82,4 @@ def user_award_list(badge, user): if badge.allows_award_to(user): return '
  • %s
  • ' % ( reverse('badger.views.award_badge', args=[badge.slug,]), _('Issue award') ) else: - return '' \ No newline at end of file + return '' diff --git a/badger/tests/__init__.py b/badger/tests/__init__.py index 0673cc1..450382a 100644 --- a/badger/tests/__init__.py +++ b/badger/tests/__init__.py @@ -22,15 +22,11 @@ from badger.models import (Badge, Award, Progress, DeferredAward) class BadgerTestCase(test.TestCase): """Ensure test app and models are set up before tests""" - apps = ('badger.tests.badger_example',) def _pre_setup(self): - # Add the models to the db. - self._original_installed_apps = list(settings.INSTALLED_APPS) - for app in self.apps: - settings.INSTALLED_APPS.append(app) loading.cache.loaded = False call_command('syncdb', interactive=False, verbosity=0) + call_command('migrate', interactive=False, verbosity=0) call_command('update_badges', verbosity=0) badger.autodiscover() @@ -58,8 +54,6 @@ class BadgerTestCase(test.TestCase): Award.objects.all().delete() Badge.objects.all().delete() - # Restore the settings. - settings.INSTALLED_APPS = self._original_installed_apps loading.cache.loaded = False if get_url_prefix: diff --git a/badger/tests/test_badges_py.py b/badger/tests/test_badges_py.py index 9fa3758..b318c24 100644 --- a/badger/tests/test_badges_py.py +++ b/badger/tests/test_badges_py.py @@ -17,7 +17,7 @@ from badger.models import (Badge, Award, Progress, BadgeAwardNotAllowedException, BadgeAlreadyAwardedException) -from badger.tests.badger_example.models import GuestbookEntry +from badger_example.models import GuestbookEntry class BadgesPyTest(BadgerTestCase): diff --git a/badger/tests/test_models.py b/badger/tests/test_models.py index a35c1b6..5210592 100644 --- a/badger/tests/test_models.py +++ b/badger/tests/test_models.py @@ -49,7 +49,7 @@ from badger.models import (Badge, Award, Nomination, Progress, DeferredAward, NominationRejectNotAllowedException, SITE_ISSUER) -from badger.tests.badger_example.models import GuestbookEntry +from badger_example.models import GuestbookEntry BASE_URL = 'http://example.com' diff --git a/badger/tests/test_views.py b/badger/tests/test_views.py index 14bae87..93a48fc 100644 --- a/badger/tests/test_views.py +++ b/badger/tests/test_views.py @@ -59,7 +59,7 @@ class BadgerViewsTest(BadgerTestCase): doc = pq(r.content) eq_('badge_detail', doc.find('body').attr('id')) - eq_(1, doc.find('.badge-title:contains("%s")' % badge.title).length) + eq_(1, doc.find('.badge .title:contains("%s")' % badge.title).length) eq_(badge.description, doc.find('.badge .description').text()) # Now, take a look at the JSON format @@ -87,8 +87,8 @@ class BadgerViewsTest(BadgerTestCase): doc = pq(r.content) eq_('award_detail', doc.find('body').attr('id')) - eq_(1, doc.find('.awarded_to .username:contains("%s")' % user2.username).length) - eq_(1, doc.find('.badge-title:contains("%s")' % b1.title).length) + eq_(1, doc.find('.award .awarded_to .username:contains("%s")' % user2.username).length) + eq_(1, doc.find('.badge .title:contains("%s")' % b1.title).length) # Now, take a look at the JSON format url = reverse('badger.award_detail_json', args=(b1.slug, award.pk,)) @@ -398,7 +398,7 @@ class BadgerViewsTest(BadgerTestCase): doc = pq(r.content) eq_('badge_detail', doc.find('body').attr('id')) - ok_(badge_title in doc.find('.badge-title').text()) + ok_(badge_title in doc.find('.badge .title').text()) eq_(badge_desc, doc.find('.badge .description').text()) slug = doc.find('.badge').attr('data-slug') @@ -438,7 +438,7 @@ class BadgerViewsTest(BadgerTestCase): doc = pq(r.content) eq_('badge_detail', doc.find('body').attr('id')) - ok_(badge_title in doc.find('.badge-title').text()) + ok_(badge_title in doc.find('.badge .title').text()) eq_(badge_desc, doc.find('.badge .description').text()) slug = doc.find('.badge').attr('data-slug') diff --git a/badger/tests/badger_example/__init__.py b/badger_example/__init__.py similarity index 100% rename from badger/tests/badger_example/__init__.py rename to badger_example/__init__.py diff --git a/badger/tests/badger_example/badges.py b/badger_example/badges.py similarity index 100% rename from badger/tests/badger_example/badges.py rename to badger_example/badges.py diff --git a/badger/tests/badger_example/fixtures/badger_tests_badger_example_badges.json b/badger_example/fixtures/badger_example_badges.json similarity index 100% rename from badger/tests/badger_example/fixtures/badger_tests_badger_example_badges.json rename to badger_example/fixtures/badger_example_badges.json diff --git a/badger/tests/badger_example/models.py b/badger_example/models.py similarity index 100% rename from badger/tests/badger_example/models.py rename to badger_example/models.py diff --git a/badger/templates/badger_playdoh/award_delete.html b/badger_example/templates/badger/award_delete.html similarity index 51% rename from badger/templates/badger_playdoh/award_delete.html rename to badger_example/templates/badger/award_delete.html index 3964a67..b5477fe 100644 --- a/badger/templates/badger_playdoh/award_delete.html +++ b/badger_example/templates/badger/award_delete.html @@ -1,15 +1,7 @@ -{% extends "badger_playdoh/base.html" %} +{% extends "badger/base.html" %} -{% set user = award.user %} -{% set award_url = request.build_absolute_uri(url('badger.views.award_detail', award.badge.slug, award.id)) %} -{% if award.image %} - {% set image_url = award.image.url %} -{% elif badge.image %} - {% set image_url = badge.image.url %} -{% else %} - {# TODO: Put the URL for default badge image in settings #} - {% set image_url = "/media/img/default-badge.png" %} -{% endif %} +{% load i18n %} +{% load badger_tags %} {% block pageid %}award_delete{% endblock %} @@ -20,20 +12,20 @@
    - {% include "badger_playdoh/includes/badge_full.html" %} + {% include "badger/includes/badge_full.html" %}
    - {{ csrf() }} + {{ csrf }}

    {{ _("Delete this award, are you sure?") }}

    - {% include "badger_playdoh/includes/award_full.html" %} + {% include "badger/includes/award_full.html" %}
    diff --git a/badger/templates/badger_vanilla/award_detail.html b/badger_example/templates/badger/award_detail.html similarity index 100% rename from badger/templates/badger_vanilla/award_detail.html rename to badger_example/templates/badger/award_detail.html diff --git a/badger/templates/badger_vanilla/awards_by_badge.html b/badger_example/templates/badger/awards_by_badge.html similarity index 100% rename from badger/templates/badger_vanilla/awards_by_badge.html rename to badger_example/templates/badger/awards_by_badge.html diff --git a/badger/templates/badger_vanilla/awards_by_user.html b/badger_example/templates/badger/awards_by_user.html similarity index 100% rename from badger/templates/badger_vanilla/awards_by_user.html rename to badger_example/templates/badger/awards_by_user.html diff --git a/badger/templates/badger_vanilla/awards_list.html b/badger_example/templates/badger/awards_list.html similarity index 100% rename from badger/templates/badger_vanilla/awards_list.html rename to badger_example/templates/badger/awards_list.html diff --git a/badger/templates/badger_vanilla/badge_award.html b/badger_example/templates/badger/badge_award.html similarity index 89% rename from badger/templates/badger_vanilla/badge_award.html rename to badger_example/templates/badger/badge_award.html index 1bccc6f..91af5a7 100644 --- a/badger/templates/badger_vanilla/badge_award.html +++ b/badger_example/templates/badger/badge_award.html @@ -3,13 +3,11 @@ {% block pageid %}badge_award{% endblock %} {% block content %} -

    Award a badge

    -
    - {{ csrf() }} + {{ csrf }}
    @@ -18,5 +16,4 @@

    Badge

    {% include "badger/includes/badge_full.html" %} - {% endblock %} diff --git a/badger_example/templates/badger/badge_create.html b/badger_example/templates/badger/badge_create.html new file mode 100644 index 0000000..86e01fd --- /dev/null +++ b/badger_example/templates/badger/badge_create.html @@ -0,0 +1,18 @@ +{% extends "badger/base.html" %} + +{% block pageid %}badge_create{% endblock %} + +{% block content %} +
    +
    +

    Create a badge

    +
    +
    + {{ csrf }} +
      + {{ form.as_ul }} +
    • +
    +
    +
    +{% endblock %} diff --git a/badger_example/templates/badger/badge_delete.html b/badger_example/templates/badger/badge_delete.html new file mode 100644 index 0000000..ffc40e4 --- /dev/null +++ b/badger_example/templates/badger/badge_delete.html @@ -0,0 +1,43 @@ +{% extends "badger/base.html" %} + +{% load i18n %} +{% load badger_tags %} + +{% block pageid %}badge_delete{% endblock %} + +{% block content %} + +
    + + {% include "badger/includes/badge_full.html" %} +
    + +
    + + +
    + {{ csrf }} + {% if awards_count %} +

    {% blocktrans with badge_url=badge.get_absolute_url awards_count=awards_count %} + Note: + Deleting this badge will also delete + {{awards_count}} award(s) + {% endblocktrans %}

    + {% else %} +

    {% blocktrans %} + Note: + No one has been awarded this badge, yet. + {% endblocktrans %}

    + {% endif %} +

    {{ _("Are you sure?") }}

    +
      +
    • +
    +
    +
    + +{% endblock %} diff --git a/badger/templates/badger_vanilla/badge_detail.html b/badger_example/templates/badger/badge_detail.html similarity index 100% rename from badger/templates/badger_vanilla/badge_detail.html rename to badger_example/templates/badger/badge_detail.html diff --git a/badger/templates/badger_playdoh/badge_edit.html b/badger_example/templates/badger/badge_edit.html similarity index 72% rename from badger/templates/badger_playdoh/badge_edit.html rename to badger_example/templates/badger/badge_edit.html index bb2e1fb..e9b6d1d 100644 --- a/badger/templates/badger_playdoh/badge_edit.html +++ b/badger_example/templates/badger/badge_edit.html @@ -1,4 +1,4 @@ -{% extends "badger_playdoh/base.html" %} +{% extends "badger/base.html" %} {% block pageid %}badge_edit{% endblock %} @@ -6,14 +6,14 @@
    - {{ csrf() }} + {{ csrf }}
      - {{ form.as_ul() }} + {{ form.as_ul }}
    diff --git a/badger/templates/badger_playdoh/badge_nominate_for.html b/badger_example/templates/badger/badge_nominate_for.html similarity index 72% rename from badger/templates/badger_playdoh/badge_nominate_for.html rename to badger_example/templates/badger/badge_nominate_for.html index 4d91707..9ff7a33 100644 --- a/badger/templates/badger_playdoh/badge_nominate_for.html +++ b/badger_example/templates/badger/badge_nominate_for.html @@ -1,4 +1,4 @@ -{% extends "badger_playdoh/base.html" %} +{% extends "badger/base.html" %} {% block pageid %}badge_nominate{% endblock %} @@ -8,9 +8,9 @@
    - {% include "badger_playdoh/includes/badge_full.html" %} + {% include "badger/includes/badge_full.html" %}
    @@ -19,9 +19,9 @@
    - {{ csrf() }} + {{ csrf }}
      - {{ form.as_ul() }} + {{ form.as_ul }}
    diff --git a/badger/templates/badger_playdoh/badges_by_user.html b/badger_example/templates/badger/badges_by_user.html similarity index 79% rename from badger/templates/badger_playdoh/badges_by_user.html rename to badger_example/templates/badger/badges_by_user.html index fdf2a38..3f8c352 100644 --- a/badger/templates/badger_playdoh/badges_by_user.html +++ b/badger_example/templates/badger/badges_by_user.html @@ -1,4 +1,4 @@ -{% extends "badger_playdoh/base.html" %} +{% extends "badger/base.html" %} {% block pageid %}badges_by_user{% endblock %} @@ -11,6 +11,6 @@ {% block content %}

    {{ _("Badges created by {user}") | f(user=user) }}

    - {% include "badger_playdoh/includes/badges_list.html" %} + {% include "badger/includes/badges_list.html" %}
    {% endblock %} diff --git a/badger/templates/badger_vanilla/badges_list.html b/badger_example/templates/badger/badges_list.html similarity index 100% rename from badger/templates/badger_vanilla/badges_list.html rename to badger_example/templates/badger/badges_list.html diff --git a/badger/templates/badger_vanilla/base.html b/badger_example/templates/badger/base.html similarity index 100% rename from badger/templates/badger_vanilla/base.html rename to badger_example/templates/badger/base.html diff --git a/badger/templates/badger_playdoh/claim_deferred_award.html b/badger_example/templates/badger/claim_deferred_award.html similarity index 60% rename from badger/templates/badger_playdoh/claim_deferred_award.html rename to badger_example/templates/badger/claim_deferred_award.html index f88c22b..2c8979d 100644 --- a/badger/templates/badger_playdoh/claim_deferred_award.html +++ b/badger_example/templates/badger/claim_deferred_award.html @@ -1,16 +1,17 @@ -{% extends "badger_playdoh/base.html" %} +{% extends "badger/base.html" %} + +{% load badger_tags %} +{% load i18n %} {% block pageid %}claim_badge{% endblock %} {% block content %} -
    -
    - {% include "badger_playdoh/includes/badge_full.html" %} + {% include "badger/includes/badge_full.html" %}
    @@ -28,43 +29,36 @@
    {{ deferred_award.claim_code }}
    - {% if user.is_anonymous() %} + {% if user.is_anonymous %}

    {{ _("Claim") }}

    {{ _("Sign in to claim this badge award") }}

    -
    - {{ csrf() }} - - {{ browserid_form.as_p()|safe }} - -
    {% endif %} - {% if deferred_award.allows_grant_by(request.user) %} + {% if deferred_award|permissions_for:request.user|key:'grant_by' %}
    - {{ csrf() }} + {{ csrf }}

    {{ _("Grant") }}

    {{ _("You can grant this award to someone else") }} - {{ grant_form.as_p() }} + {{ grant_form.as_p }}

    {% endif %} - {% if deferred_award.allows_claim_by(request.user) %} - {% set email_mismatch = (deferred_award.email and request.user.email != deferred_award.email) %} -
    -
    - {% endblock %} diff --git a/badger/templates/badger_playdoh/claims_list.html b/badger_example/templates/badger/claims_list.html similarity index 96% rename from badger/templates/badger_playdoh/claims_list.html rename to badger_example/templates/badger/claims_list.html index 74509f4..891e668 100644 --- a/badger/templates/badger_playdoh/claims_list.html +++ b/badger_example/templates/badger/claims_list.html @@ -1,4 +1,4 @@ -{% extends "badger_playdoh/base.html" %} +{% extends "badger/base.html" %} {% block pageid %}claims_list{% endblock %} diff --git a/badger_example/templates/badger/deferred_award_body.txt b/badger_example/templates/badger/deferred_award_body.txt new file mode 100644 index 0000000..c9f42e6 --- /dev/null +++ b/badger_example/templates/badger/deferred_award_body.txt @@ -0,0 +1,10 @@ +{% load i18n %} +{% blocktrans with domain=current_site.domain badge_url=badge.get_absolute_url badge_title=badge.title claim_url=deferred_award.get_claim_url protocol=protocol|default:"http" %} + +You have received an award for the badge {{ badge_title }}. + +You can claim it, here: + + {{ protocol }}://{{ domain }}{{ claim_url }} + +{% endblocktrans %} diff --git a/badger_example/templates/badger/deferred_award_subject.txt b/badger_example/templates/badger/deferred_award_subject.txt new file mode 100644 index 0000000..508003a --- /dev/null +++ b/badger_example/templates/badger/deferred_award_subject.txt @@ -0,0 +1,2 @@ +{% load i18n %} +{% blocktrans with site_name=current_site.name badge_title=badge.title %}[{{ site_name }}] Claim your award for the badge "{{ badge_title }}"{% endblocktrans %} diff --git a/badger/templates/badger_vanilla/home.html b/badger_example/templates/badger/home.html similarity index 100% rename from badger/templates/badger_vanilla/home.html rename to badger_example/templates/badger/home.html diff --git a/badger/templates/badger_vanilla/includes/award_as_badge.html b/badger_example/templates/badger/includes/award_as_badge.html similarity index 100% rename from badger/templates/badger_vanilla/includes/award_as_badge.html rename to badger_example/templates/badger/includes/award_as_badge.html diff --git a/badger/templates/badger_vanilla/includes/award_as_user.html b/badger_example/templates/badger/includes/award_as_user.html similarity index 100% rename from badger/templates/badger_vanilla/includes/award_as_user.html rename to badger_example/templates/badger/includes/award_as_user.html diff --git a/badger_example/templates/badger/includes/award_full.html b/badger_example/templates/badger/includes/award_full.html new file mode 100644 index 0000000..d3abb3b --- /dev/null +++ b/badger_example/templates/badger/includes/award_full.html @@ -0,0 +1,24 @@ +{% load badger_tags %} + +
    +
    Awarded to:
    +
    {{ award.user }}
    + {% if award.description %} +
    Explanation:
    +
    {{ award.description }}
    +{% endif %} +
    Awarded by:
    +
    {{ award.creator }}
    +
    Issued on:
    +
    {{ award.created }}
    +
    +{% if award|permissions_for:request.user|key:'delete_by' %} +
    +
    Actions:
    +
    +
    +{% endif %} diff --git a/badger/templates/badger_vanilla/includes/awards_as_badges_list.html b/badger_example/templates/badger/includes/awards_as_badges_list.html similarity index 100% rename from badger/templates/badger_vanilla/includes/awards_as_badges_list.html rename to badger_example/templates/badger/includes/awards_as_badges_list.html diff --git a/badger/templates/badger_vanilla/includes/awards_list.html b/badger_example/templates/badger/includes/awards_list.html similarity index 100% rename from badger/templates/badger_vanilla/includes/awards_list.html rename to badger_example/templates/badger/includes/awards_list.html diff --git a/badger/templates/badger_vanilla/includes/badge_full.html b/badger_example/templates/badger/includes/badge_full.html similarity index 66% rename from badger/templates/badger_vanilla/includes/badge_full.html rename to badger_example/templates/badger/includes/badge_full.html index dcd99ca..2fbf727 100644 --- a/badger/templates/badger_vanilla/includes/badge_full.html +++ b/badger_example/templates/badger/includes/badge_full.html @@ -1,5 +1,18 @@ {% load badger_tags %} +{% if not award %} + +{% endif %} + +
    +
    Title:
    {{ badge.title }}
    @@ -27,4 +40,4 @@ {% user_award_list badge request.user %} -
    \ No newline at end of file +
    diff --git a/badger/templates/badger_vanilla/includes/badges_list.html b/badger_example/templates/badger/includes/badges_list.html similarity index 100% rename from badger/templates/badger_vanilla/includes/badges_list.html rename to badger_example/templates/badger/includes/badges_list.html diff --git a/badger/templates/badger_vanilla/includes/pagination.html b/badger_example/templates/badger/includes/pagination.html similarity index 100% rename from badger/templates/badger_vanilla/includes/pagination.html rename to badger_example/templates/badger/includes/pagination.html diff --git a/badger/templates/badger_playdoh/manage_claims.html b/badger_example/templates/badger/manage_claims.html similarity index 96% rename from badger/templates/badger_playdoh/manage_claims.html rename to badger_example/templates/badger/manage_claims.html index 5134a33..7b714fd 100644 --- a/badger/templates/badger_playdoh/manage_claims.html +++ b/badger_example/templates/badger/manage_claims.html @@ -1,4 +1,4 @@ -{% extends "badger_playdoh/base.html" %} +{% extends "badger/base.html" %} {% block pageid %}manage_claims{% endblock %} @@ -12,7 +12,7 @@ - {% include "badger_playdoh/includes/badge_full.html" %} + {% include "badger/includes/badge_full.html" %}
    diff --git a/badger/templates/badger_playdoh/nomination_detail.html b/badger_example/templates/badger/nomination_detail.html similarity index 97% rename from badger/templates/badger_playdoh/nomination_detail.html rename to badger_example/templates/badger/nomination_detail.html index 9659096..d0ab3bb 100644 --- a/badger/templates/badger_playdoh/nomination_detail.html +++ b/badger_example/templates/badger/nomination_detail.html @@ -1,4 +1,4 @@ -{% extends "badger_playdoh/base.html" %} +{% extends "badger/base.html" %} {% block pageid %}nomination_detail{% endblock %} @@ -9,7 +9,7 @@ - {% include "badger_playdoh/includes/badge_full.html" %} + {% include "badger/includes/badge_full.html" %}
    diff --git a/badger/templates/badger_playdoh/notification/award_accepted/full.html b/badger_example/templates/badger/notification/award_accepted/full.html similarity index 100% rename from badger/templates/badger_playdoh/notification/award_accepted/full.html rename to badger_example/templates/badger/notification/award_accepted/full.html diff --git a/badger/templates/badger_playdoh/notification/award_accepted/full.txt b/badger_example/templates/badger/notification/award_accepted/full.txt similarity index 100% rename from badger/templates/badger_playdoh/notification/award_accepted/full.txt rename to badger_example/templates/badger/notification/award_accepted/full.txt diff --git a/badger/templates/badger_playdoh/notification/award_accepted/notice.html b/badger_example/templates/badger/notification/award_accepted/notice.html similarity index 100% rename from badger/templates/badger_playdoh/notification/award_accepted/notice.html rename to badger_example/templates/badger/notification/award_accepted/notice.html diff --git a/badger/templates/badger_playdoh/notification/award_accepted/short.txt b/badger_example/templates/badger/notification/award_accepted/short.txt similarity index 100% rename from badger/templates/badger_playdoh/notification/award_accepted/short.txt rename to badger_example/templates/badger/notification/award_accepted/short.txt diff --git a/badger/templates/badger_playdoh/notification/award_declined/full.html b/badger_example/templates/badger/notification/award_declined/full.html similarity index 100% rename from badger/templates/badger_playdoh/notification/award_declined/full.html rename to badger_example/templates/badger/notification/award_declined/full.html diff --git a/badger/templates/badger_playdoh/notification/award_declined/full.txt b/badger_example/templates/badger/notification/award_declined/full.txt similarity index 100% rename from badger/templates/badger_playdoh/notification/award_declined/full.txt rename to badger_example/templates/badger/notification/award_declined/full.txt diff --git a/badger/templates/badger_playdoh/notification/award_declined/notice.html b/badger_example/templates/badger/notification/award_declined/notice.html similarity index 100% rename from badger/templates/badger_playdoh/notification/award_declined/notice.html rename to badger_example/templates/badger/notification/award_declined/notice.html diff --git a/badger/templates/badger_playdoh/notification/award_declined/short.txt b/badger_example/templates/badger/notification/award_declined/short.txt similarity index 100% rename from badger/templates/badger_playdoh/notification/award_declined/short.txt rename to badger_example/templates/badger/notification/award_declined/short.txt diff --git a/badger/templates/badger_playdoh/notification/award_received/full.html b/badger_example/templates/badger/notification/award_received/full.html similarity index 100% rename from badger/templates/badger_playdoh/notification/award_received/full.html rename to badger_example/templates/badger/notification/award_received/full.html diff --git a/badger/templates/badger_playdoh/notification/award_received/full.txt b/badger_example/templates/badger/notification/award_received/full.txt similarity index 100% rename from badger/templates/badger_playdoh/notification/award_received/full.txt rename to badger_example/templates/badger/notification/award_received/full.txt diff --git a/badger/templates/badger_playdoh/notification/award_received/notice.html b/badger_example/templates/badger/notification/award_received/notice.html similarity index 100% rename from badger/templates/badger_playdoh/notification/award_received/notice.html rename to badger_example/templates/badger/notification/award_received/notice.html diff --git a/badger/templates/badger_playdoh/notification/award_received/short.txt b/badger_example/templates/badger/notification/award_received/short.txt similarity index 100% rename from badger/templates/badger_playdoh/notification/award_received/short.txt rename to badger_example/templates/badger/notification/award_received/short.txt diff --git a/badger/templates/badger_playdoh/notification/badge_awarded/full.html b/badger_example/templates/badger/notification/badge_awarded/full.html similarity index 100% rename from badger/templates/badger_playdoh/notification/badge_awarded/full.html rename to badger_example/templates/badger/notification/badge_awarded/full.html diff --git a/badger/templates/badger_playdoh/notification/badge_awarded/full.txt b/badger_example/templates/badger/notification/badge_awarded/full.txt similarity index 100% rename from badger/templates/badger_playdoh/notification/badge_awarded/full.txt rename to badger_example/templates/badger/notification/badge_awarded/full.txt diff --git a/badger/templates/badger_playdoh/notification/badge_awarded/notice.html b/badger_example/templates/badger/notification/badge_awarded/notice.html similarity index 100% rename from badger/templates/badger_playdoh/notification/badge_awarded/notice.html rename to badger_example/templates/badger/notification/badge_awarded/notice.html diff --git a/badger/templates/badger_playdoh/notification/badge_awarded/short.txt b/badger_example/templates/badger/notification/badge_awarded/short.txt similarity index 100% rename from badger/templates/badger_playdoh/notification/badge_awarded/short.txt rename to badger_example/templates/badger/notification/badge_awarded/short.txt diff --git a/badger/templates/badger_playdoh/notification/badge_edited/full.html b/badger_example/templates/badger/notification/badge_edited/full.html similarity index 100% rename from badger/templates/badger_playdoh/notification/badge_edited/full.html rename to badger_example/templates/badger/notification/badge_edited/full.html diff --git a/badger/templates/badger_playdoh/notification/badge_edited/full.txt b/badger_example/templates/badger/notification/badge_edited/full.txt similarity index 100% rename from badger/templates/badger_playdoh/notification/badge_edited/full.txt rename to badger_example/templates/badger/notification/badge_edited/full.txt diff --git a/badger/templates/badger_playdoh/notification/badge_edited/notice.html b/badger_example/templates/badger/notification/badge_edited/notice.html similarity index 100% rename from badger/templates/badger_playdoh/notification/badge_edited/notice.html rename to badger_example/templates/badger/notification/badge_edited/notice.html diff --git a/badger/templates/badger_playdoh/notification/badge_edited/short.txt b/badger_example/templates/badger/notification/badge_edited/short.txt similarity index 100% rename from badger/templates/badger_playdoh/notification/badge_edited/short.txt rename to badger_example/templates/badger/notification/badge_edited/short.txt diff --git a/badger/templates/badger_playdoh/notification/base.html b/badger_example/templates/badger/notification/base.html similarity index 100% rename from badger/templates/badger_playdoh/notification/base.html rename to badger_example/templates/badger/notification/base.html diff --git a/badger/templates/badger_playdoh/notification/email_body.txt b/badger_example/templates/badger/notification/email_body.txt similarity index 100% rename from badger/templates/badger_playdoh/notification/email_body.txt rename to badger_example/templates/badger/notification/email_body.txt diff --git a/badger/templates/badger_playdoh/notification/email_subject.txt b/badger_example/templates/badger/notification/email_subject.txt similarity index 100% rename from badger/templates/badger_playdoh/notification/email_subject.txt rename to badger_example/templates/badger/notification/email_subject.txt diff --git a/badger/templates/badger_playdoh/notification/full.html b/badger_example/templates/badger/notification/full.html similarity index 100% rename from badger/templates/badger_playdoh/notification/full.html rename to badger_example/templates/badger/notification/full.html diff --git a/badger/templates/badger_playdoh/notification/full.txt b/badger_example/templates/badger/notification/full.txt similarity index 100% rename from badger/templates/badger_playdoh/notification/full.txt rename to badger_example/templates/badger/notification/full.txt diff --git a/badger/templates/badger_playdoh/notification/nomination_accepted/full.html b/badger_example/templates/badger/notification/nomination_accepted/full.html similarity index 100% rename from badger/templates/badger_playdoh/notification/nomination_accepted/full.html rename to badger_example/templates/badger/notification/nomination_accepted/full.html diff --git a/badger/templates/badger_playdoh/notification/nomination_accepted/full.txt b/badger_example/templates/badger/notification/nomination_accepted/full.txt similarity index 100% rename from badger/templates/badger_playdoh/notification/nomination_accepted/full.txt rename to badger_example/templates/badger/notification/nomination_accepted/full.txt diff --git a/badger/templates/badger_playdoh/notification/nomination_accepted/notice.html b/badger_example/templates/badger/notification/nomination_accepted/notice.html similarity index 100% rename from badger/templates/badger_playdoh/notification/nomination_accepted/notice.html rename to badger_example/templates/badger/notification/nomination_accepted/notice.html diff --git a/badger/templates/badger_playdoh/notification/nomination_accepted/short.txt b/badger_example/templates/badger/notification/nomination_accepted/short.txt similarity index 100% rename from badger/templates/badger_playdoh/notification/nomination_accepted/short.txt rename to badger_example/templates/badger/notification/nomination_accepted/short.txt diff --git a/badger/templates/badger_playdoh/notification/nomination_approved/full.html b/badger_example/templates/badger/notification/nomination_approved/full.html similarity index 100% rename from badger/templates/badger_playdoh/notification/nomination_approved/full.html rename to badger_example/templates/badger/notification/nomination_approved/full.html diff --git a/badger/templates/badger_playdoh/notification/nomination_approved/full.txt b/badger_example/templates/badger/notification/nomination_approved/full.txt similarity index 100% rename from badger/templates/badger_playdoh/notification/nomination_approved/full.txt rename to badger_example/templates/badger/notification/nomination_approved/full.txt diff --git a/badger/templates/badger_playdoh/notification/nomination_approved/notice.html b/badger_example/templates/badger/notification/nomination_approved/notice.html similarity index 100% rename from badger/templates/badger_playdoh/notification/nomination_approved/notice.html rename to badger_example/templates/badger/notification/nomination_approved/notice.html diff --git a/badger/templates/badger_playdoh/notification/nomination_approved/short.txt b/badger_example/templates/badger/notification/nomination_approved/short.txt similarity index 100% rename from badger/templates/badger_playdoh/notification/nomination_approved/short.txt rename to badger_example/templates/badger/notification/nomination_approved/short.txt diff --git a/badger/templates/badger_playdoh/notification/nomination_declined/full.html b/badger_example/templates/badger/notification/nomination_declined/full.html similarity index 100% rename from badger/templates/badger_playdoh/notification/nomination_declined/full.html rename to badger_example/templates/badger/notification/nomination_declined/full.html diff --git a/badger/templates/badger_playdoh/notification/nomination_declined/full.txt b/badger_example/templates/badger/notification/nomination_declined/full.txt similarity index 100% rename from badger/templates/badger_playdoh/notification/nomination_declined/full.txt rename to badger_example/templates/badger/notification/nomination_declined/full.txt diff --git a/badger/templates/badger_playdoh/notification/nomination_declined/notice.html b/badger_example/templates/badger/notification/nomination_declined/notice.html similarity index 100% rename from badger/templates/badger_playdoh/notification/nomination_declined/notice.html rename to badger_example/templates/badger/notification/nomination_declined/notice.html diff --git a/badger/templates/badger_playdoh/notification/nomination_declined/short.txt b/badger_example/templates/badger/notification/nomination_declined/short.txt similarity index 100% rename from badger/templates/badger_playdoh/notification/nomination_declined/short.txt rename to badger_example/templates/badger/notification/nomination_declined/short.txt diff --git a/badger/templates/badger_playdoh/notification/nomination_received/full.html b/badger_example/templates/badger/notification/nomination_received/full.html similarity index 100% rename from badger/templates/badger_playdoh/notification/nomination_received/full.html rename to badger_example/templates/badger/notification/nomination_received/full.html diff --git a/badger/templates/badger_playdoh/notification/nomination_received/full.txt b/badger_example/templates/badger/notification/nomination_received/full.txt similarity index 100% rename from badger/templates/badger_playdoh/notification/nomination_received/full.txt rename to badger_example/templates/badger/notification/nomination_received/full.txt diff --git a/badger/templates/badger_playdoh/notification/nomination_received/notice.html b/badger_example/templates/badger/notification/nomination_received/notice.html similarity index 100% rename from badger/templates/badger_playdoh/notification/nomination_received/notice.html rename to badger_example/templates/badger/notification/nomination_received/notice.html diff --git a/badger/templates/badger_playdoh/notification/nomination_received/short.txt b/badger_example/templates/badger/notification/nomination_received/short.txt similarity index 100% rename from badger/templates/badger_playdoh/notification/nomination_received/short.txt rename to badger_example/templates/badger/notification/nomination_received/short.txt diff --git a/badger/templates/badger_playdoh/notification/nomination_rejected/full.html b/badger_example/templates/badger/notification/nomination_rejected/full.html similarity index 100% rename from badger/templates/badger_playdoh/notification/nomination_rejected/full.html rename to badger_example/templates/badger/notification/nomination_rejected/full.html diff --git a/badger/templates/badger_playdoh/notification/nomination_rejected/full.txt b/badger_example/templates/badger/notification/nomination_rejected/full.txt similarity index 100% rename from badger/templates/badger_playdoh/notification/nomination_rejected/full.txt rename to badger_example/templates/badger/notification/nomination_rejected/full.txt diff --git a/badger/templates/badger_playdoh/notification/nomination_rejected/notice.html b/badger_example/templates/badger/notification/nomination_rejected/notice.html similarity index 100% rename from badger/templates/badger_playdoh/notification/nomination_rejected/notice.html rename to badger_example/templates/badger/notification/nomination_rejected/notice.html diff --git a/badger/templates/badger_playdoh/notification/nomination_rejected/short.txt b/badger_example/templates/badger/notification/nomination_rejected/short.txt similarity index 100% rename from badger/templates/badger_playdoh/notification/nomination_rejected/short.txt rename to badger_example/templates/badger/notification/nomination_rejected/short.txt diff --git a/badger/templates/badger_playdoh/notification/nomination_submitted/full.html b/badger_example/templates/badger/notification/nomination_submitted/full.html similarity index 100% rename from badger/templates/badger_playdoh/notification/nomination_submitted/full.html rename to badger_example/templates/badger/notification/nomination_submitted/full.html diff --git a/badger/templates/badger_playdoh/notification/nomination_submitted/full.txt b/badger_example/templates/badger/notification/nomination_submitted/full.txt similarity index 100% rename from badger/templates/badger_playdoh/notification/nomination_submitted/full.txt rename to badger_example/templates/badger/notification/nomination_submitted/full.txt diff --git a/badger/templates/badger_playdoh/notification/nomination_submitted/notice.html b/badger_example/templates/badger/notification/nomination_submitted/notice.html similarity index 100% rename from badger/templates/badger_playdoh/notification/nomination_submitted/notice.html rename to badger_example/templates/badger/notification/nomination_submitted/notice.html diff --git a/badger/templates/badger_playdoh/notification/nomination_submitted/short.txt b/badger_example/templates/badger/notification/nomination_submitted/short.txt similarity index 100% rename from badger/templates/badger_playdoh/notification/nomination_submitted/short.txt rename to badger_example/templates/badger/notification/nomination_submitted/short.txt diff --git a/badger/templates/badger_playdoh/notification/notice.html b/badger_example/templates/badger/notification/notice.html similarity index 100% rename from badger/templates/badger_playdoh/notification/notice.html rename to badger_example/templates/badger/notification/notice.html diff --git a/badger/templates/badger_playdoh/notification/notice_settings.html b/badger_example/templates/badger/notification/notice_settings.html similarity index 100% rename from badger/templates/badger_playdoh/notification/notice_settings.html rename to badger_example/templates/badger/notification/notice_settings.html diff --git a/badger/templates/badger_playdoh/notification/notices.html b/badger_example/templates/badger/notification/notices.html similarity index 100% rename from badger/templates/badger_playdoh/notification/notices.html rename to badger_example/templates/badger/notification/notices.html diff --git a/badger/templates/badger_playdoh/notification/short.txt b/badger_example/templates/badger/notification/short.txt similarity index 100% rename from badger/templates/badger_playdoh/notification/short.txt rename to badger_example/templates/badger/notification/short.txt diff --git a/badger/templates/badger_playdoh/notification/single.html b/badger_example/templates/badger/notification/single.html similarity index 100% rename from badger/templates/badger_playdoh/notification/single.html rename to badger_example/templates/badger/notification/single.html diff --git a/badger/templates/badger_playdoh/staff_tools.html b/badger_example/templates/badger/staff_tools.html similarity index 84% rename from badger/templates/badger_playdoh/staff_tools.html rename to badger_example/templates/badger/staff_tools.html index d0b671f..85908ab 100644 --- a/badger/templates/badger_playdoh/staff_tools.html +++ b/badger_example/templates/badger/staff_tools.html @@ -1,4 +1,4 @@ -{% extends "badger_playdoh/base.html" %} +{% extends "badger/base.html" %} {% block pageid %}staff_tools{% endblock %} @@ -11,10 +11,10 @@

    Grant multiple claim codes

    - {{ csrf() }} + {{ csrf }}
      - {{ grant_form.as_ul() }} + {{ grant_form.as_ul }}
    diff --git a/badger_example/templates/base.html b/badger_example/templates/base.html new file mode 100644 index 0000000..e404857 --- /dev/null +++ b/badger_example/templates/base.html @@ -0,0 +1,8 @@ + + + {% block extrahead %}{% endblock %} + + + {% block content %}{% endblock %} + + diff --git a/badger_example/urls.py b/badger_example/urls.py new file mode 100644 index 0000000..5978c18 --- /dev/null +++ b/badger_example/urls.py @@ -0,0 +1,16 @@ +from django.conf.urls import patterns, include, url + +from django.contrib import admin +admin.autodiscover() + +import badger +badger.autodiscover() + +urlpatterns = patterns('', + # Examples: + # url(r'^$', 'badger_example.views.home', name='home'), + # url(r'^badger_example/', include('badger_example.foo.urls')), + + url(r'^admin/', include(admin.site.urls)), + url(r'^badges/', include('badger.urls')), +) diff --git a/manage.py b/manage.py new file mode 100755 index 0000000..3aaaca9 --- /dev/null +++ b/manage.py @@ -0,0 +1,13 @@ +#!/usr/bin/env python +import os +import sys + +os.environ.setdefault("DJANGO_SETTINGS_MODULE", "test_settings") + +def nose_collector(): + import nose + return nose.collector() + +if __name__ == "__main__": + from django.core.management import execute_from_command_line + execute_from_command_line(sys.argv) diff --git a/runtests.py b/runtests.py index dcaa592..0ee304e 100644 --- a/runtests.py +++ b/runtests.py @@ -3,61 +3,7 @@ import os, sys from django.conf import settings import nose - -settings.configure( - SITE_ID = 1, - DEBUG = True, - TEST_RUNNER = 'django_nose.NoseTestSuiteRunner', - ROOT_URLCONF = 'badger.tests.urls', - DATABASES = { - 'default': { - 'NAME': 'test-badger.db', - 'ENGINE': 'django.db.backends.sqlite3', - } - }, - SUPPORTED_NONLOCALES = ['media', 'admin'], - INSTALLED_APPS = [ - 'django.contrib.auth', - 'django.contrib.contenttypes', - 'django.contrib.sessions', - 'django.contrib.admin', - 'django.contrib.sites', - 'django.contrib.messages', - 'django_nose', - 'tower', - 'funfactory', - 'badger', - ], - MIDDLEWARE_CLASSES = ( - 'django.middleware.common.CommonMiddleware', - 'django.contrib.sessions.middleware.SessionMiddleware', - 'django.contrib.auth.middleware.AuthenticationMiddleware', - 'django.contrib.messages.middleware.MessageMiddleware', - 'badger.middleware.RecentAwardsMiddleware', - ), - TEMPLATE_DIRS = ( - 'badger/tests/badger_example/templates', - ), - TEMPLATE_LOADERS = ( - 'jingo.Loader', - 'django.template.loaders.filesystem.Loader', - 'django.template.loaders.app_directories.Loader', - ), - TEMPLATE_CONTEXT_PROCESSORS = ( - 'django.contrib.auth.context_processors.auth', - 'django.core.context_processors.debug', - 'django.core.context_processors.media', - 'django.core.context_processors.request', - 'session_csrf.context_processor', - 'django.contrib.messages.context_processors.messages', - 'funfactory.context_processors.i18n', - 'funfactory.context_processors.globals', - ), - MESSAGE_STORAGE = 'django.contrib.messages.storage.cookie.CookieStorage', - BADGER_TEMPLATE_BASE = 'badger_playdoh', - LANGUAGE_URL_MAP = {'en-US': 'en_US'} -) - +os.environ.setdefault("DJANGO_SETTINGS_MODULE", "test_settings") def runtests(): from django.core.management import call_command diff --git a/setup.py b/setup.py index fc6d3d0..fafd11e 100755 --- a/setup.py +++ b/setup.py @@ -33,19 +33,10 @@ setup( 'PIL', ], tests_require=[ - 'django-setuptest', - 'funfactory', - 'tower', - 'django-session-csrf', - 'jinja2', - 'jingo', 'nose', 'django-nose', 'pyquery', 'feedparser', - 'django-runtests', ], - #test_suite='runtests.collector', - #test_suite='nose.collector', - test_suite='runtests.runtests', + test_suite='manage.nose_collector', ) diff --git a/test_settings.py b/test_settings.py new file mode 100644 index 0000000..ebe8c14 --- /dev/null +++ b/test_settings.py @@ -0,0 +1,160 @@ +# Django settings for badger_example project. + +DEBUG = True +TEMPLATE_DEBUG = DEBUG + +SITE_ID = 1 + +ADMINS = ( + # ('Your Name', 'your_email@example.com'), +) + +TEST_RUNNER = 'django_nose.NoseTestSuiteRunner' + +MANAGERS = ADMINS + +DATABASES = { + 'default': { + 'NAME': 'test-badger.db', + 'ENGINE': 'django.db.backends.sqlite3', + } +} + +# Local time zone for this installation. Choices can be found here: +# http://en.wikipedia.org/wiki/List_of_tz_zones_by_name +# although not all choices may be available on all operating systems. +# In a Windows environment this must be set to your system time zone. +TIME_ZONE = 'America/Chicago' + +# Language code for this installation. All choices can be found here: +# http://www.i18nguy.com/unicode/language-identifiers.html +LANGUAGE_CODE = 'en-us' + +SITE_ID = 1 + +# If you set this to False, Django will make some optimizations so as not +# to load the internationalization machinery. +USE_I18N = True + +# If you set this to False, Django will not format dates, numbers and +# calendars according to the current locale. +USE_L10N = True + +# If you set this to False, Django will not use timezone-aware datetimes. +USE_TZ = False # True + +# Absolute filesystem path to the directory that will hold user-uploaded files. +# Example: "/home/media/media.lawrence.com/media/" +MEDIA_ROOT = '' + +# URL that handles the media served from MEDIA_ROOT. Make sure to use a +# trailing slash. +# Examples: "http://media.lawrence.com/media/", "http://example.com/media/" +MEDIA_URL = '' + +# Absolute path to the directory static files should be collected to. +# Don't put anything in this directory yourself; store your static files +# in apps' "static/" subdirectories and in STATICFILES_DIRS. +# Example: "/home/media/media.lawrence.com/static/" +STATIC_ROOT = '' + +# URL prefix for static files. +# Example: "http://media.lawrence.com/static/" +STATIC_URL = '/static/' + +# Additional locations of static files +STATICFILES_DIRS = ( + # Put strings here, like "/home/html/static" or "C:/www/django/static". + # Always use forward slashes, even on Windows. + # Don't forget to use absolute paths, not relative paths. +) + +# List of finder classes that know how to find static files in +# various locations. +STATICFILES_FINDERS = ( + 'django.contrib.staticfiles.finders.FileSystemFinder', + 'django.contrib.staticfiles.finders.AppDirectoriesFinder', +# 'django.contrib.staticfiles.finders.DefaultStorageFinder', +) + +# Make this unique, and don't share it with anybody. +SECRET_KEY = 'e-=ohaa)s7s3+qeye9^l2!qb&^-ak5o4sty69=vhv@fnxjn7_q' + +# List of callables that know how to import templates from various sources. +TEMPLATE_LOADERS = ( + #'jingo.Loader', + 'django.template.loaders.filesystem.Loader', + 'django.template.loaders.app_directories.Loader', +# 'django.template.loaders.eggs.Loader', +) + +TEMPLATE_CONTEXT_PROCESSORS = ( + 'django.contrib.auth.context_processors.auth', + 'django.core.context_processors.debug', + 'django.core.context_processors.media', + 'django.core.context_processors.request', + 'django.contrib.messages.context_processors.messages', +) + +MIDDLEWARE_CLASSES = ( + 'django.middleware.common.CommonMiddleware', + 'django.contrib.sessions.middleware.SessionMiddleware', + 'django.middleware.csrf.CsrfViewMiddleware', + 'django.contrib.auth.middleware.AuthenticationMiddleware', + 'django.contrib.messages.middleware.MessageMiddleware', + 'badger.middleware.RecentAwardsMiddleware', +) + +ROOT_URLCONF = 'badger_example.urls' + +TEMPLATE_DIRS = ( + # Put strings here, like "/home/html/django_templates" or "C:/www/django/templates". + # Always use forward slashes, even on Windows. + # Don't forget to use absolute paths, not relative paths. +) + +INSTALLED_APPS = [ + 'django.contrib.auth', + 'django.contrib.contenttypes', + 'django.contrib.sessions', + 'django.contrib.sites', + 'django.contrib.messages', + 'django.contrib.staticfiles', + 'django.contrib.admin', + 'django_nose', + 'south', + 'badger_example', + 'badger', +] + +MESSAGE_STORAGE = 'django.contrib.messages.storage.cookie.CookieStorage' +BADGER_TEMPLATE_BASE = 'badger' + +# A sample logging configuration. The only tangible logging +# performed by this configuration is to send an email to +# the site admins on every HTTP 500 error when DEBUG=False. +# See http://docs.djangoproject.com/en/dev/topics/logging for +# more details on how to customize your logging configuration. +LOGGING = { + 'version': 1, + 'disable_existing_loggers': False, + 'filters': { + 'require_debug_false': { + '()': 'django.utils.log.RequireDebugFalse' + } + }, + 'handlers': { + 'mail_admins': { + 'level': 'ERROR', + 'filters': ['require_debug_false'], + 'class': 'django.utils.log.AdminEmailHandler' + } + }, + 'loggers': { + 'django.request': { + 'handlers': ['mail_admins'], + 'level': 'ERROR', + 'propagate': True, + }, + } +}