Permalink
Browse files

protect against the possibility of a race condition when creating a n…

…ew flag on content
  • Loading branch information...
1 parent ca218dd commit ff0681543677e8d4548ce6ce89899c925bfbacbc @brosner brosner committed May 8, 2010
Showing with 4 additions and 1 deletion.
  1. +3 −0 flag/models.py
  2. +1 −1 setup.py
View
@@ -29,6 +29,9 @@ class FlaggedContent(models.Model):
creator = models.ForeignKey(User, related_name="flagged_content") # user who created flagged content -- this is kept in model so it outlives content
status = models.CharField(max_length=1, choices=STATUS, default="1")
moderator = models.ForeignKey(User, null=True, related_name="moderated_content") # moderator responsible for last status change
+
+ class Meta:
+ unique_together = [("content_type", "object_id")]
class FlagInstance(models.Model):
View
@@ -3,7 +3,7 @@
setup(
name = "django-flag",
- version = "0.2.dev6",
+ version = "0.2.dev7",
description = "flagging of inapproriate/spam content",
author = "Greg Newman",
author_email = "greg@20seven.org",

0 comments on commit ff06815

Please sign in to comment.