mozilla / django-badger

django-badger is a reusable Django app for creating and awarding badges. See also badges.mozilla.org
https://github.com/mozilla/django-badger
BSD 3-Clause "New" or "Revised" License
117 stars 61 forks source link

Multiplayer nominations_accepted field in badger should have blank=True #122

Closed askvictor closed 11 years ago

askvictor commented 11 years ago

The nominations_accepted field in the Badge model (which should be used only if multiplayer is also in play) causes problems when multiplayer is not being used. Django still creates the field if multiplayer is not being used, and creating an instance of a badge fails as the field is not present, but can't be blank - the error generated is:

DatabaseError at /admin/badger/badge/add/ 
(1364, "Field 'nominations_accepted' doesn't have a default value")

Existing code is at line 353 of models.py:

    if badger_multiplayer:
        # HACK: This belongs in the badger_multiplayer model, ugh
        # https://github.com/lmorchard/django-badger/issues/15
        nominations_accepted = models.BooleanField(default=True,
                help_text="Should this badge accept nominations from "
                          "other users?")
askvictor commented 11 years ago

Actually, this might have to do with the migration present in the package rather than the model