Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

wrote flag tag

git-svn-id: http://django-flag.googlecode.com/svn/trunk@12 6223c904-8705-11dd-a5c9-f1483cedc3eb
  • Loading branch information...
commit 078c18450c7aa901435a5d843a2fc225da3031b0 1 parent fddf3ba
@jtauber jtauber authored
Showing with 8 additions and 2 deletions.
  1. +8 −2 flag/templatetags/flagtags.py
View
10 flag/templatetags/flagtags.py
@@ -1,12 +1,18 @@
from django import template
+from django.contrib.contenttypes.models import ContentType
+
register = template.Library()
-def flag(context, obj):
+def flag(context, content_object, creator_field):
+ content_type = ContentType.objects.get(app_label=content_object._meta.app_label, model=content_object._meta.module_name)
return {
- 'object_id': obj,
+ 'content_type': content_type.id,
+ 'object_id': content_object.id,
+ 'creator_field': creator_field,
'request': context['request'],
'user': context['user'],
}
+
register.inclusion_tag('templates/flag_form.html', takes_context=True)(flag)
Please sign in to comment.
Something went wrong with that request. Please try again.