Commit 9fd995cc authored by Janez K's avatar Janez K

only one stream per workflow now

parent 659e0f19
......@@ -175,13 +175,14 @@ INSTALLED_APPS_DEFAULT = (
'django.contrib.humanize',
'orderable_inlines',
'workflows',
'picklefield'
'picklefield',
'streams',
)
INSTALLED_APPS_CONCUR = (
'djcelery',
) if USE_CONCURRENCY else (
'streams',
)
INSTALLED_APPS_WORKFLOWS_SUB = (
......
......@@ -12,7 +12,7 @@ class HaltStream(Exception):
class Stream(models.Model):
user = models.ForeignKey(User,related_name="streams")
workflow = models.ForeignKey(Workflow, related_name="streams")
workflow = models.OneToOneField(Workflow, related_name="stream")
last_executed = models.DateTimeField(auto_now_add=True)
period = models.IntegerField(default=60)
active = models.BooleanField(default=False)
......
......@@ -9,6 +9,7 @@
<tr>
<th>Workflow title</th>
<th>Public URL</th>
<th style="width:15%;">Streaming</th>
<th style="width:30%;">Action</th>
</tr>
......@@ -18,6 +19,7 @@
<tr>
<td class="name">{{w}}</td>
<td>{% if w.public %}<a href="{{w.get_info_url}}">{{w.get_info_url}}</a>{% else %}This workflow is private.{% endif %}</td>
<td>{% if w.can_be_streaming %}{% if w.streams.count > 0 %}<i class="icon-ok"></i>{% else %}Make into stream{% endif %}{% else %}<span class="label label-info"><i class="icon-remove icon-white"></i> No streaming widgets</span>{% endif %}</td>
<td><a href="{{w.get_absolute_url}}">Edit</a> | <a href="{{w.get_copy_url}}">Open as new</a> | <a href="javascript:;" rel="{{w.pk}}" class="delete_workflow">Delete</a> | {% if not w.public %}<a href="{% url 'make public' w.pk %}">Make public</a>{% else %}<a href="{% url 'make private' w.pk %}">Make private</a>{% endif %}</td>
</tr>
{% endfor %}
......@@ -25,6 +27,7 @@
</table>
<script type="text/javascript">
$(function() {
......
......@@ -52,6 +52,11 @@ class Workflow(models.Model):
widget = models.OneToOneField('Widget',related_name="workflow_link",blank=True,null=True)
template_parent = models.ForeignKey('Workflow',blank=True,null=True,default=None,on_delete=models.SET_NULL)
def can_be_streaming(self):
if self.widgets.filter(abstract_widget__is_streaming=True).count()>0:
return True
else:
return False
def is_for_loop(self):
if self.widgets.filter(type='for_input').count()>0:
......
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