Skip to content
This repository was archived by the owner on Nov 25, 2017. It is now read-only.

Commit 35e43b6

Browse files
committed
Added documentation for the PJAXResponseMixin class.
1 parent 75e0a3d commit 35e43b6

File tree

1 file changed

+16
-0
lines changed

1 file changed

+16
-0
lines changed

README.rst

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -57,4 +57,20 @@ the decorator::
5757
def my_view(request):
5858
return TemplateResponse(request, "template.html", {'my': 'context'})
5959

60+
If you'd like to use Django 1.3's class-based views instead, a PJAX Mixin class
61+
is provided as well. Simply use ``PJAXResponseMixin`` where you would normally have
62+
used ``TemplateResponseMixin``, and your ``template_name`` will be treated the same
63+
way as above. You can alternately provide a ``pjax_template_name`` class variable
64+
if you want a specific template used for PJAX responses::
65+
66+
from django.views.generic import View
67+
from djpjax import PJAXResponseMixin
68+
69+
class MyView(PJAXResponseMixin, View):
70+
template_name = "template.html"
71+
pjax_template_name = "pjax.html"
72+
73+
def get(self, request):
74+
return self.render_to_response({'my': 'context'})
75+
6076
That's it!

0 commit comments

Comments
 (0)