Commit a67bb6a1 by Őry Máté

school: group show add csrf, etc

parent 3b466b6c
......@@ -11,7 +11,7 @@
<ul>
{% for i in t.myshares %}
<li>{{i.name}} -&gt; {{i.group}} ({{i.get_running}}/{{i.instance_limit}} = {{i.get_instance_pc}}%)
<form style="display:inline" action="/vm/unshare/{{i.id}}/" method="post"><input type="submit" value="unshare"/></form>
<form style="display:inline" action="/vm/unshare/{{i.id}}/" method="post">{% csrf_token %}<input type="submit" value="unshare"/></form>
</li>
{% endfor %}
{% endif %}
......@@ -72,7 +72,7 @@
<ul>
{% for i in t.myshares %}
<li>{{i.name}} -&gt; {{i.group}} ({{i.get_running}}/{{i.instance_limit}} = {{i.get_instance_pc}}%)
<form style="display:inline" action="/vm/unshare/{{i.id}}/" method="post"><input type="submit" value="unshare"/></form>
<form style="display:inline" action="/vm/unshare/{{i.id}}/" method="post">{% csrf_token %}<input type="submit" value="unshare"/></form>
</li>
{% endfor %}
{% endif %}
......
......@@ -51,7 +51,7 @@
</div>
</div>
<div class="boxes">
{% if noshare %}
<div id="new-wm-tooltip" style="position:absolute">
<div id="new-wm-tooltip-container">
<p>
......@@ -63,6 +63,7 @@
<div id="new-wm-tooltip-tail"></div>
</div>
</div>
{% endif %}
{% include "box-templatelist.html" %}
</div>
{% endblock %}
......@@ -154,18 +154,24 @@ def group_show(request, gid):
user = request.user
group = get_object_or_404(Group, id=gid)
mytemplates = [t for t in Template.objects.filter(owner=request.user).all()]
noshare = True
for i, t in enumerate(mytemplates):
t.myshares = t.share_set.filter(group=group)
if t.myshares.exists():
noshare = False
mytemplates[i] = t
publictemplates = [t for t in Template.objects.filter(public=True, state='READY').all()]
for i, t in enumerate(publictemplates):
t.myshares = t.share_set.filter(group=group)
if t.myshares.exists():
noshare = False
publictemplates[i] = t
return render_to_response("show-group.html", RequestContext(request,{
'group': group,
'members': group.members.all(),
'mytemplates': mytemplates,
'publictemplates': publictemplates,
'noshare': noshare,
}))
@login_required
......
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 sign in to comment