Permalink
Browse files

changed add_flag to take content_type/object_id

git-svn-id: http://django-flag.googlecode.com/svn/trunk@9 6223c904-8705-11dd-a5c9-f1483cedc3eb
  • Loading branch information...
jtauber committed Sep 20, 2008
1 parent 44978d2 commit bd9e5a7f20572295b63ebd74758ead91dd83a6aa
Showing with 4 additions and 4 deletions.
  1. +4 −4 flag/models.py
View
@@ -35,14 +35,14 @@ class FlagInstance(models.Model):
when_recalled = models.DateTimeField(null=True) # if recalled at all
comment = models.TextField() # comment by the flagger
-def add_flag(flagger, content_object, content_creator, comment):
+
+def add_flag(flagger, content_type, object_id, content_creator, comment):
# check if it's already been flagged
try:
- flagged_content = FlaggedContent.objects.get(content_object=content_object)
+ flagged_content = FlaggedContent.objects.get(content_type=content_type, object_id=object_id)
except FlaggedContent.DoesNotExist:
- creator = content_creator
- flagged_content = FlaggedContent(content_object=content_object, creator=creator)
+ flagged_content = FlaggedContent(content_type=content_type, object_id=object_id, creator=content_creator)
flagged_content.save()
flag_instance = FlagInstance(flagged_content=flagged_content, user=flagger, comment=comment)

0 comments on commit bd9e5a7

Please sign in to comment.