Skip to content
Browse files

Adding template tags for form rendering.

  • Loading branch information...
1 parent 6158fa5 commit 2d90905d2e05e104bb789bbd2a4ea63761a3bc73 @lukeman lukeman committed Dec 1, 2010
Showing with 18 additions and 0 deletions.
  1. +18 −0 mimesis/templatetags/mimesis_tags.py
View
18 mimesis/templatetags/mimesis_tags.py
@@ -3,6 +3,7 @@
from django.utils.encoding import smart_unicode
from mimesis.models import ImageAssociation, AudioAssociation, VideoAssociation
+from mimesis.forms import ImageForm, AudioForm
register = template.Library()
@@ -114,3 +115,20 @@ def get_audio_list(parser, token):
@register.tag
def get_videos_list(parser, token):
return MediaListNode.handle_token(parser, token, VideoAssociation)
+
+
+@register.inclusion_tag("mimesis/add_form.html", takes_context=True)
+def image_form(context, obj=None):
+ return {
+ "form": ImageForm(),
+ "next": context["request"].build_absolute_uri(),
+ }
+
+
+@register.inclusion_tag("mimesis/add_form.html", takes_context=True)
+def audio_form(context, obj=None):
+ return {
+ "form": AudioForm(),
+ "next": context["request"].build_absolute_uri(),
+ }
+

0 comments on commit 2d90905

Please sign in to comment.
Something went wrong with that request. Please try again.