Beispiel #1
0
def designer(request, cid):
    con = get_construct(request.user, cid)
    if con:
        t = loader.get_template("gibson/designer.html")
        c = RequestContext(request, {"title": "Construct Designer", "id": cid, "construct": con})
        return HttpResponse(t.render(c))
    else:
        raise Http404()
Beispiel #2
0
def design_tab(request, cid):
    con = get_construct(request.user, cid)
    if con:
        t = loader.get_template("gibson/designtab.html")
        c = RequestContext(request, {"id": cid, "construct": con})
        return HttpResponse(t.render(c))
    else:
        return HttpResponseNotFound()
def design_tab(request, cid):
	con = get_construct(request.user, cid)
	if con:
		t = loader.get_template('gibson/designtab.html')
		c = RequestContext(request,{
			#'id': cid,
			'construct':con,
		})
		return HttpResponse(t.render(c))
	else:
		return HttpResponseNotFound()
def designer(request,cid):
	con = get_construct(request.user, cid)
	if con:
		t = loader.get_template('gibson/designer.html')
		c = RequestContext(request,{
			#'title':'Construct Designer',
			#'id': cid,
			#'construct':con,
		})
		return HttpResponse(t.render(c))
	else:
		raise Http404()
Beispiel #5
0
def design_tab(request, cid):
    con = get_construct(request.user, cid)
    if con:
        t = loader.get_template('gibson/designtab.html')
        c = RequestContext(
            request,
            {
                #'id': cid,
                'construct': con,
            })
        return HttpResponse(t.render(c))
    else:
        return HttpResponseNotFound()
Beispiel #6
0
def construct_settings(request, cid):
    con = get_construct(request.user, cid)
    if con:
        if request.method == "POST":
            form = SettingsForm(request.POST, instance=con.settings)
            if form.is_valid():
                form.save()
                return HttpResponse()
        t = loader.get_template("gibson/settings.html")
        s = con.settings
        c = RequestContext(request, {"cid": cid, "settings": s})
        return HttpResponse(t.render(c))
    else:
        return HttpResponseNotFound()
Beispiel #7
0
def update_settings(request, cid):
	if request.method == 'POST': #and request.is_ajax():
		con = get_construct(request.user, cid)
		if not con:
			return JsonResponse({'errors': {'all':"Construct with id '%s' not found",},} % cid, ERROR)
		form = SettingsForm(request.POST, instance=con.settings)
		if form.is_valid():
			form.save()
			data = {}
			for key,value in form.cleaned_data.items():
				data[key] = str(value);
			return JsonResponse({'modified': con.last_modified(), 'fields': data})
		return JsonResponse({'errors': form.errors,}, ERROR)
	raise Http404
Beispiel #8
0
def designer(request, cid):
    con = get_construct(request.user, cid)
    if con:
        t = loader.get_template('gibson/designer.html')
        c = RequestContext(
            request,
            {
                #'title':'Construct Designer',
                #'id': cid,
                #'construct':con,
            })
        return HttpResponse(t.render(c))
    else:
        raise Http404()
Beispiel #9
0
def update_meta(request, cid): # 'saveMeta/'
	if request.method == 'POST': #and request.is_ajax():
		con = get_construct(request.user, cid)
		if not con:
			return JsonResponse({'errors': {'all': "Construct with id '%s' not found" % cid,}}, ERROR)
		name = request.POST.get('name', con.name)
		desc = request.POST.get('desc', con.description)
		if (name != con.name) or (desc != con.description):
			con.name = name
			con.description = desc
			con.save()
		
		return JsonResponse({'modified': con.last_modified(), 'fields': {'name': name, 'desc': desc}});
		
	raise Http404
Beispiel #10
0
def construct_settings(request, cid):
    con = get_construct(request.user, cid)
    if con:
        if request.method == 'POST':
            form = SettingsForm(request.POST, instance=con.settings)
            if form.is_valid():
                form.save()
                return HttpResponse()
        t = loader.get_template('gibson/settings.html')
        s = con.settings
        c = RequestContext(request, {
            'cid': cid,
            'settings': s,
        })
        return HttpResponse(t.render(c))
    else:
        return HttpResponseNotFound()