disable csrf for api calls, best practices info template
This commit is contained in:
parent
d0661daf16
commit
bf9bf130c6
|
@ -28,7 +28,9 @@ from ox.django.http import HttpFileResponse
|
|||
import ox
|
||||
from actions import actions
|
||||
from user.models import get_user_json
|
||||
from django.views.decorators.csrf import csrf_exempt
|
||||
|
||||
@csrf_exempt
|
||||
def api(request):
|
||||
if request.META['REQUEST_METHOD'] == "OPTIONS":
|
||||
response = render_to_json_response({'status': {'code': 200,
|
||||
|
|
|
@ -57,6 +57,7 @@ class ItfModel(models.Model):
|
|||
qobjects.append(qobject)
|
||||
return qset.filter(reduce(operator.or_, qobjects))
|
||||
|
||||
|
||||
@classmethod
|
||||
def get_fk_objects(kls):
|
||||
ret = {}
|
||||
|
|
|
@ -27,13 +27,16 @@ class BestPractice(ItfModel):
|
|||
def __unicode__(self):
|
||||
return str(self.id) + ": " + self.title
|
||||
|
||||
|
||||
def info_dict(self):
|
||||
return {
|
||||
'id': self.id,
|
||||
'title': self.title,
|
||||
'story': self.story,
|
||||
'stories': map(lambda x: x.get_dict(), BestPracticeStory.objects.filter(bestpractice=self)),
|
||||
'guideline': self.guideline,
|
||||
'law': self.law,
|
||||
'law_image': self.law_image if self.law_image != None else '',
|
||||
'theatre': self.theatre,
|
||||
'quick_howto': self.quick_howto,
|
||||
'category': self.category.name,
|
||||
|
@ -74,6 +77,12 @@ class BestPracticeStory(models.Model):
|
|||
def __unicode__(self):
|
||||
return self.text
|
||||
|
||||
def get_dict(self):
|
||||
return {
|
||||
'text': self.text,
|
||||
'image': self.image.url,
|
||||
}
|
||||
|
||||
|
||||
class BestPracticeCategory(models.Model):
|
||||
name = models.CharField(max_length=256)
|
||||
|
|
|
@ -1,6 +1,15 @@
|
|||
<div class="itfInfo">
|
||||
<span class="itfInfoSub">Story: </span><span class="itfInfoInfo">{{html tmplToHtml(story)}}</span><br /><br />
|
||||
<span class="itfInfoSub">Law: </span><span class="itfInfoInfo">{{html tmplToHtml(law)}}</span><br /><br />
|
||||
{{each stories}}
|
||||
<span class="itfInfoSub">Story ${$index + 1}: </span><span class="ifInfoInfo">${value.text}</span>
|
||||
<img class="itfInfoImg" src="${value.image}" />
|
||||
<br /><br />
|
||||
{{/each}}
|
||||
<span class="itfInfoSub">Law: </span><span class="itfInfoInfo">{{html tmplToHtml(law)}}</span>
|
||||
{{if law_image}}
|
||||
<img class="itfInfoImg" src="${law_image}" />
|
||||
{{/if}}
|
||||
<br /><br />
|
||||
<span class="itfInfoSub">Relevance to Theatre: </span><span class="itfInfoInfo">{{html tmplToHtml(theatre)}}</span><br /><br />
|
||||
<span class="itfInfoSub">Quick Howto: </span><span class="itfInfoInfo">{{html tmplToHtml(quick_howto)}}</span><br /><br />
|
||||
</div>
|
||||
|
|
Loading…
Reference in New Issue
Block a user