Commit d97f372d by Kálmán Viktor

dashboard: display corrent number of remaining vms on index

parent fe85e03a
...@@ -27,7 +27,11 @@ ...@@ -27,7 +27,11 @@
</div> </div>
</div> </div>
<div class="col-sm-6 text-right"> <div class="col-sm-6 text-right">
<a class="btn btn-primary btn-xs" href="{% url "dashboard.views.vm-list" %}"><i class="icon-chevron-sign-right"></i> <strong>13</strong> more </a> {% if more_instances > 0 %}
<a class="btn btn-primary btn-xs" href="{% url "dashboard.views.vm-list" %}">
<i class="icon-chevron-sign-right"></i> <strong>{{ more_instances }}</strong> more
</a>
{% endif %}
<a class="btn btn-success btn-xs"><i class="icon-plus-sign"></i> new </a> <a class="btn btn-success btn-xs"><i class="icon-plus-sign"></i> new </a>
</div> </div>
</div> </div>
......
...@@ -16,9 +16,14 @@ class IndexView(TemplateView): ...@@ -16,9 +16,14 @@ class IndexView(TemplateView):
else: else:
user = None user = None
instances = Instance.objects.filter(owner=user)
context = super(IndexView, self).get_context_data(**kwargs) context = super(IndexView, self).get_context_data(**kwargs)
context.update({ context.update({
'instances': Instance.objects.filter(owner=user)[:5], 'instances': instances[:5],
})
context.update({
'more_instances': instances.count() - len(instances[:5])
}) })
return context return context
......
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