summaryrefslogtreecommitdiffstats
path: root/equations/views.py
diff options
context:
space:
mode:
Diffstat (limited to 'equations/views.py')
-rw-r--r--equations/views.py16
1 files changed, 14 insertions, 2 deletions
diff --git a/equations/views.py b/equations/views.py
index 9ef1081..41309c1 100644
--- a/equations/views.py
+++ b/equations/views.py
@@ -2,11 +2,11 @@ from django.core import serializers
from models import Equation, Variable, Symbol
from django.http import HttpResponse
-def all_vars(request):
+def all_variables(request):
data = serializers.serialize("json", Variable.objects.all())
return HttpResponse(data, mimetype="text/javascript")
-def all_symbs(request):
+def all_symbols(request):
data = serializers.serialize("json", Symbol.objects.all())
return HttpResponse(data, mimetype="text/javascript")
@@ -27,3 +27,15 @@ def equs_by_vars(request, whichvars):
data = serializers.serialize("json", returnables)
return HttpResponse(data, mimetype="text/javascript")
+
+
+def vars_by_symbs(request, which_symbols):
+ vars = which_symbols.split(',')
+ if len(vars) < 1 or which_symbols == '':
+ return HttpResponse('[]', mimetype="text/javascript")
+ if vars[-1] == '/' or vars[-1] == '':
+ vars = vars[:-1]
+ returnables = Variable.objects.filter(symbol=vars[0])
+
+ data = serializers.serialize("json", returnables)
+ return HttpResponse(data, mimetype="text/javascript")