Skip to content

timotta/django-template-stub

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

7 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

django-template-stub

An app to support your javascript tests stubing your django templates.

Why?

On javascript tests, unless creating html fixtures representing your django templates, you can obtain these fixtures requesting by ajax. It avoids code duplication and fake green tests, integrating your javascript tests with the templates that it works with.

Example

/templatestub/ ?t=my_template.html &tt=one_template_tag &tt=other_template_tag:<span>template_tag_result</span> &f=a_filter:filter_result &f=other_filter &c={“person”:{“name”:“Tiago”},“country”:{“nome”:“Brasil”}}

Parameters

Parameter that cannot be repeated: t - Template path, relative to one of TEMPLATE_DIRS c - Json representing the objects in template context Parameter that can be repeated: tt - Template tag that you want to replace in the follow format tag_name:tag_return f - Filter that you want to replate in the follow format filter_name:filter_return The tag_return ans filter_return aren’t required

Installing

Put the templatestub folder in your project and add this line to your urls.py:

(r’^‘, include(’templatestub.urls’)),

Thanks

@hltbra for the original idea

@igorsobreira for helping with python and django

@everton_carpes for helping with ideas on how to do

About

An app to support your javascript tests stubing your django templates.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Languages