Fix a bug in meeting.ajax.constraint_json().

- Legacy-Id: 10294
This commit is contained in:
Henrik Levkowetz 2015-10-26 19:53:14 +00:00
parent e3ea4d8f37
commit c760822e04
2 changed files with 4 additions and 2 deletions

View file

@ -575,7 +575,7 @@ def constraint_json(request, num, constraintid):
status = 404,
content_type="application/json")
json1 = constraint.json_dict(request.get_host_protocol())
json1 = constraint.json_dict(request)
return HttpResponse(json.dumps(json1, sort_keys=True, indent=2),
content_type="application/json")

View file

@ -849,7 +849,9 @@ class Constraint(models.Model):
def json_url(self):
return "/meeting/%s/constraint/%s.json" % (self.meeting.number, self.id)
def json_dict(self, host_scheme):
def json_dict(self, request):
proto = 'https' if request.is_secure() else 'http'
host_scheme = "%s://%s" % (proto, request.get_host())
ct1 = dict()
ct1['constraint_id'] = self.id
ct1['href'] = urljoin(host_scheme, self.json_url())