Package: django-gamification
Django Gamification aims to fill the gamification sized hole in the
Django package ecosystem. In the current state, Django Gamification
provides a set of models that can be used to implement gamification
features in your application. These include a centralised interface for
keeping track of all gamification related objects including badges,
points, and unlockables.Example AppAn example app can be foundhere.InstallationDownload from PyPI:pip install django-gamificationAnd add to yourINSTALLED_APPS:INSTALLED_APPS=['django.contrib.admin','django.contrib.auth','django.contrib.contenttypes','django.contrib.sessions','django.contrib.messages','django.contrib.staticfiles',...'django_gamification']Features and ExamplesConceptsDjango Gamification requires the understanding of a few core concepts.BadgeDefinitions:A template used to create new Badges and update existing Badges.Badge:An object that represents some achievable objective in the system that can award points and track its own progression.UnlockableDefinition:A template used to create new Unlockables and update existing Unlockables.Unlockable:An object that is achieved by some accumulation of points.Category:An object used to label other objects like Badges via their BadgeDefinition.InterfacesCreating an interfacefromdjango.contrib.auth.modelsimportUserfromdjango.dbimportmodelsfromdjango_gamification.modelsimportGamificationInterfaceclassYourUserModel(User):# Your user fields here# The gamification interfaceinterface=models.ForeignKey(GamificationInterface)BadgeDefinitions and BadgesCreating a new badgeBy creating a newBadgeDefinition, Django Gamification will
automatically createBadgeinstances for all your currentGamificationInterfaceswithBadge.name,Badge.description,Badge.points,Badge.progressionandBadge.categorymimicking
the fields on theBadgeDefinition.fromdjango_gamification.modelsimportBadgeDefinition,CategoryBadgeDefinition.objects.create(name='Badge of Awesome',description='You proved your awesomeness',points=50,progression_target=100,category=Category.objects.create(name='Gold Badges',description='These are the top badges'),)Awarding a badgeYou can manually award aBadgeinstance usingBadge.award().fromdjango_gamification.modelsimportBadgebadge=Badge.objects.first()# badge.acquired = Falsebadge.award()# badge.acquired = TrueUnlockableDefinitions and UnlockablesCreating a new unlockableBy creating a newUnlockableDefinition, Django Gamification will
automatically createUnlockableinstances for all your currentGamificationInterfaceswithUnlockable.name,Unlockable.description,Unlockable.points_requiredmimicking the
fields on theUnlockableDefinition.fromdjango_gamification.modelsimportUnlockableDefinitionUnlockableDefinition.objects.create(name='Some super sought after feature',description='You unlocked a super sought after feature',points_required=100)ContributingSubmitting an issue or feature requestIf you find an issue or have a feature request please open an issue atGithub Django Gamification
Repo.Working on issuesIf you think that you can fix an issue or implement a feature, please
make sure that it isn’t assigned to someone or if it is you may ask for
an update.Once an issue is complete, open a pull request so that your contribution
can be reviewed. A TravisCI build will run and be attached to your pull
request. Your code must pass these checks.Get Started!Ready to contribute? Here’s how to set updjango-gamificationfor local
development.Fork thedjango-gamificationrepo on GitHub.Clone your fork locally:$ git clone git@github.com:your_name_here/django-gamification.gitInstall your local copy into a virtualenv. Assuming you have
virtualenvwrapper installed, this is how you set up your fork for local development:$ mkvirtualenv django-gamification
$ cd django-gamification/
$ python setup.py developCreate a branch for local development:$ git checkout -b name-of-your-bugfix-or-featureNow you can make your changes locally.When you’re done making changes, check that your changes pass flake8 and the
tests, including testing other Python versions with tox:$ py.test
$ toxTo get flake8 and tox, just pip install them into your virtualenv.Commit your changes and push your branch to GitHub:$ git add .
$ git commit -m "Your detailed description of your changes."
$ git push origin name-of-your-bugfix-or-featureSubmit a pull request through the GitHub website.Helping othersAt all times, please be polite with others who are working on issues. It
may be their first ever patch and we want to foster a friendly and
familiar open source environment.