This is a pre-production deployment of Warehouse, however changes made here WILL affect the production instance of PyPI.
Latest Version Dependencies status unknown Test status unknown Test coverage unknown
Project Description

Badges are earned by users for meeting some conditions defined in the badge.json file

A Badge object (database model) is then created linking a user to a badge.

conditions

Condition is a sql check to be made for awarding a badge.

You have access to the variable NEW if you set the trigger_contition to “update” or “insert”. This is the database object after update or insert.

You have access to the variable OLD if you set the trigger_contition to “update” or “delete”. This is the database object after update or delete.

triggers

We want the badges to be given as soon as a condition is meet. Even if the event come from an event outside the Django application.

We do not want to relly on celery to periodicaly check for badges

  • Too often : this is a performance bootleneck
  • Too late : annoying for users

The check for each badge is checked when “something” change.

To create the database triggers that will be responsible for badge earning run:

>>> python manage.py create_badge_triggers

When you change badge.json (adding, updating or deleting badges) run this commande to reflect those changes in the database.

badge.json example

` [{"name": "Pionner", "code": "pionner", "condition": "age(NEW.date_joined) > interval '1 year'", "trigger_condition": "update", "trigger_table": "auth_user", "user_field": "id" }, {"name": "Collector", "code": "collector" "condition": "count(id) >= 5 from dummy_sketch where user_id = NEW.user_id", "trigger_condition": "insert", "trigger_table": "dummy_sketch", "user_field": "user_id" }, {"name": "Star", "code": "star", "condition": "hit_views > 1000 ", "trigger_condition": "update", "trigger_table": "dummy_sketch", "user_field": "user_id" }] ` name is the name of the badge as it will be displayed in the front or the API.

code is th unique code name of the badge

condition is the query that will be issued to check if the badge should be earned

trigger_contition tell when the check must be made. One of insert, update or delete

INSTALL

see INSTALL file for instructions.

Release History

Release History

0.1

This version

History Node

TODO: Figure out how to actually get changelog content.

Changelog content for this version goes here.

Donec et mollis dolor. Praesent et diam eget libero egestas mattis sit amet vitae augue. Nam tincidunt congue enim, ut porta lorem lacinia consectetur. Donec ut libero sed arcu vehicula ultricies a non tortor. Lorem ipsum dolor sit amet, consectetur adipiscing elit.

Show More

Download Files

Download Files

TODO: Brief introduction on what you do with files - including link to relevant help section.

File Name & Checksum SHA256 Checksum Help Version File Type Upload Date
django-pg-badges-0.1.linux-x86_64.tar.gz (11.0 kB) Copy SHA256 Checksum SHA256 any Dumb Binary Jan 24, 2016
django-pg-badges-0.1.tar.gz (6.2 kB) Copy SHA256 Checksum SHA256 Source Jan 24, 2016

Supported By

WebFaction WebFaction Technical Writing Elastic Elastic Search Pingdom Pingdom Monitoring Dyn Dyn DNS HPE HPE Development Sentry Sentry Error Logging CloudAMQP CloudAMQP RabbitMQ Heroku Heroku PaaS Kabu Creative Kabu Creative UX & Design Fastly Fastly CDN DigiCert DigiCert EV Certificate Rackspace Rackspace Cloud Servers DreamHost DreamHost Log Hosting