Created
December 4, 2012 09:58
-
-
Save bmispelon/4202313 to your computer and use it in GitHub Desktop.
potential django bug
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| # found by frequant on #django | |
| class BaseRatingModel(models.Model): | |
| """ | |
| Base rating model | |
| """ | |
| content_type = models.ForeignKey(ContentType) | |
| object_id = models.PositiveIntegerField() | |
| content_object = generic.GenericForeignKey() | |
| user = models.ForeignKey(settings.AUTH_USER_MODEL) | |
| class Meta: | |
| abstract = True | |
| unique_together = (('content_type', 'object_id', 'user'),) | |
| class Helpful(BaseRatingModel): | |
| """ | |
| Model for registering helpful votes | |
| """ | |
| rating = models.SmallIntegerField(_('helpful'), choices=CHOICES) | |
| # Then, if I create two Helpful objects for the same content_object, no errors are thrown |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment