Commit 39ae1a85 authored by Janez K's avatar Janez K
Browse files

lazje nastavljanje private in public workflowov

parent 9e4fc6b1
......@@ -18,7 +18,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><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="#">Make public</a>{% else %}<a href="#">Make private</a>{% 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 %}
</tbody>
......
......@@ -6,6 +6,9 @@ urlpatterns = patterns('',
url(r'^existing-workflows/', 'website.views.workflows', name='existing workflows'),
url(r'^your-workflows/', 'website.views.your_workflows', name='your workflows'),
url(r'^make-private/(?P<workflow_id>[0-9]+)/$', 'website.views.make_private', name='make private'),
url(r'^make-public/(?P<workflow_id>[0-9]+)/$', 'website.views.make_public', name='make public'),
url(r'^workflow/(?P<workflow_id>[0-9]+)/$', 'website.views.workflow_information', name='workflow information'),
)
......@@ -75,6 +75,20 @@ def workflow_information(request,workflow_id):
def your_workflows(request):
return render(request, 'website/yourworkflows.html', {'workflows':request.user.workflows.all()})
def make_public(request,workflow_id):
workflow = get_object_or_404(Workflow,pk=workflow_id)
if request.user == workflow.user:
workflow.public = True
workflow.save()
return redirect('your workflows')
def make_private(request,workflow_id):
workflow = get_object_or_404(Workflow,pk=workflow_id)
if request.user == workflow.user:
workflow.public = False
workflow.save()
return redirect('your workflows')
def workflows(request):
wflows = Workflow.objects.filter(public=True)
min_x = 10000
......
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