Giter VIP home page Giter VIP logo

django-badges's Introduction

JIAARO

…on life, the universe, and everything

django-badges's People

Contributors

giuband avatar igorkramaric avatar jiaaro avatar nezo avatar pmac avatar ryanwitt avatar seanhayes avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar

django-badges's Issues

Badge creation metaclasses don't play nicely with tests

I've been chasing down a problem with badges not being in my database when I run unit tests. It's related to the registered_badges dictionary.

The post_syncdb hook in listeners.py creates database objects based on MetaBadges and populates Badge._badge with a reference to the model. However, my transaction-wrapped unit tests truncate the database at the beginning and end of each test. Now the database is empty but the Badge believes it still has an object.

In the end, I've solved it by running this in my setUp method:

    from badges import listeners
    from badges.utils import registered_badges
    for badge in registered_badges.values():
        del badge._badge
    listeners.sync_badges_to_db()

My view is that a method like sync_badges_to_db should always create badges in the database, or maybe there should be a method to force this.

More generally the post_syncdb hook in listeners has been causing problems too - in fact, the django documentation for this hook explicitly says that it's not recommended to change the database in this hook: https://docs.djangoproject.com/en/1.7/ref/signals/#post-syncdb
I understand that it's a useful way of making sure the database reflects the MetaBadges, but it feels like magic that is a little bit unexplained. I prefer the current system to when badges were created in __new__, but I would like it more if badge creation was explicit. Maybe now django 1.7's AppConfig.ready could be something to look at.

Signals error

I can not receive the signal.
There are no errors, I see the saving of the BadgeToUser model, but the signal does not come

No templates in PyPi package

when package installed with pip and urlpatterns += [url(r'^badges/', include(badges.urls)),]
page fails with

TemplateDoesNotExist at /badges/
badges/overview.html

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    πŸ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. πŸ“ŠπŸ“ˆπŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❀️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.