Commit 7863e599 authored by Janez K's avatar Janez K

widget inputs

parent ec4ba64b
......@@ -170,6 +170,7 @@ INSTALLED_APPS_DEFAULT = (
'workflows',
'picklefield',
'streams',
#'rest_framework',
#'djcelery',
#'kombu.transport.django',
)
......@@ -192,6 +193,11 @@ INSTALLED_APPS = \
INSTALLED_APPS_DEFAULT +\
INSTALLED_APPS_WORKFLOWS_SUB
#REST_FRAMEWORK = {
# 'DEFAULT_PERMISSION_CLASSES': ('rest_framework.permissions.IsAdminUser',),
# 'PAGINATE_BY': 10
#}
TEMPLATE_CONTEXT_PROCESSORS = DEFAULT_SETTINGS.TEMPLATE_CONTEXT_PROCESSORS
TEMPLATES_FOLDER = os.path.join(PROJECT_DIR, 'templates')
......
......@@ -17,6 +17,7 @@ urlpatterns = patterns('',
# Uncomment the next line to enable the admin:
url(r'^', include('signuplogin.urls')),
url(r'^', include('website.urls')),
#url(r'^api-auth/', include('rest_framework.urls', namespace='rest_framework')),
url(r'^workflows/', include('workflows.urls')),
url(r'^streams/', include('streams.urls')),
url(r'^admin/', include(admin.site.urls)),
......
......@@ -9,3 +9,5 @@ django-picklefield==0.2.1
httplib2==0.7.5
wsgiref==0.1.2
unidecode==0.04.13
django-jsonview==0.3.0
......@@ -69,4 +69,7 @@ urlpatterns += patterns('',
url(r'^reset-workflow/', 'workflows.views.reset_workflow', name='reset workflow'),
url(r'^export-package/(?P<packages>.+)/$', 'workflows.views.export_package', name='export_package'),
url(r'^widget-inputs/(?P<widget_id>[0-9]+)/$', 'workflows.views.widget_inputs', name='widget inputs'),
)
......@@ -11,6 +11,8 @@ import workflows.visualization_views
import sys
import traceback
from jsonview.decorators import json_view
# modeli
from workflows.models import *
from django.contrib.auth.models import User
......@@ -1318,6 +1320,27 @@ def export_package(request, packages):
response = HttpResponse(mimetype='text/plain',content=content)
return response
@json_view
def widget_inputs(request, widget_id):
w = get_object_or_404(Widget, pk=widget_id)
input_dict = {}
for i in w.inputs.all():
if not i.parameter:
if i.connections.count() > 0:
i.value = i.connections.all()[0].output.value
#i.save()
else:
i.value = None
#i.save()
if i.multi_id == 0:
input_dict[i.variable]=i.value
else:
if not i.variable in input_dict:
input_dict[i.variable]=[]
if not i.value == None:
input_dict[i.variable].append(i.value)
return input_dict
@login_required
def widget_iframe(request, widget_id):
w = get_object_or_404(Widget, pk=widget_id)
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment