mirror of
https://github.com/nottinghamtec/PyRIGS.git
synced 2026-01-25 17:32:16 +00:00
Tidied up python
This commit is contained in:
@@ -48,26 +48,30 @@ class WebCalendar(generic.TemplateView):
|
|||||||
class EventDetail(generic.DetailView):
|
class EventDetail(generic.DetailView):
|
||||||
model = models.Event
|
model = models.Event
|
||||||
|
|
||||||
|
|
||||||
class EventOembed(generic.View):
|
class EventOembed(generic.View):
|
||||||
model = models.Event
|
model = models.Event
|
||||||
|
|
||||||
def get(self, request, pk=None):
|
def get(self, request, pk=None):
|
||||||
|
|
||||||
base_url = request.scheme + '://' + request.META['HTTP_HOST']
|
embed_url = reverse('event_embed', args=[pk])
|
||||||
full_url = base_url+reverse('event_embed', args=[pk])
|
|
||||||
|
full_url = "{0}://{1}{2}".format(request.scheme, request.META['HTTP_HOST'], embed_url)
|
||||||
|
|
||||||
data = {
|
data = {
|
||||||
'html': '<iframe src="{0}" frameborder="0" width="100%" height="300"></iframe>'.format(full_url),
|
'html': '<iframe src="{0}" frameborder="0" width="100%" height="300"></iframe>'.format(full_url),
|
||||||
'version': '1.0',
|
'version': '1.0',
|
||||||
'type': 'rich',
|
'type': 'rich',
|
||||||
}
|
}
|
||||||
# need to do this: @xframe_options_exempt
|
|
||||||
json = simplejson.JSONEncoderForHTML().encode(data)
|
json = simplejson.JSONEncoderForHTML().encode(data)
|
||||||
return HttpResponse(json, content_type="application/json")
|
return HttpResponse(json, content_type="application/json")
|
||||||
|
|
||||||
|
|
||||||
class EventEmbed(EventDetail):
|
class EventEmbed(EventDetail):
|
||||||
template_name = 'RIGS/event_embed.html'
|
template_name = 'RIGS/event_embed.html'
|
||||||
|
|
||||||
|
|
||||||
class EventCreate(generic.CreateView):
|
class EventCreate(generic.CreateView):
|
||||||
model = models.Event
|
model = models.Event
|
||||||
form_class = forms.EventForm
|
form_class = forms.EventForm
|
||||||
|
|||||||
Reference in New Issue
Block a user