Added in support for user's specific Home Page
diff --git a/planetstack/core/plus/views.py b/planetstack/core/plus/views.py
index e5451ff..386f6b5 100644
--- a/planetstack/core/plus/views.py
+++ b/planetstack/core/plus/views.py
@@ -1,11 +1,34 @@
#views.py
from django.views.generic import TemplateView
+from core.models import Slice,SliceRole,SlicePrivilege,Site,Reservation
class DashboardWelcomeView(TemplateView):
template_name = 'admin/dashboard/welcome.html'
def get(self, request, *args, **kwargs):
context = self.get_context_data(**kwargs)
+ sliceList = Slice.objects.all()
+ try:
+ site = Site.objects.filter(id=request.user.site.id)
+ except:
+ site = Site.objects.filter(name="Princeton")
+ context['site'] = site[0]
+ slicePrivs = SlicePrivilege.objects.filter(user=request.user)
+ userSliceInfo = []
+ for entry in slicePrivs:
+
+ try:
+ reservationList = Reservation.objects.filter(slice=entry.slice)
+ reservations = (True,reservationList)
+
+ except:
+ reservations = None
+
+ userSliceInfo.append({'slice': Slice.objects.get(id=entry.slice.id),
+ 'role': SliceRole.objects.get(id=entry.role.id).role,
+ 'reservations': reservations})
+
+ context['userSliceInfo'] = userSliceInfo
return self.render_to_response(context=context)
diff --git a/planetstack/templates/admin/dashboard/welcome.html b/planetstack/templates/admin/dashboard/welcome.html
index 9ffb3e5..707ee96 100644
--- a/planetstack/templates/admin/dashboard/welcome.html
+++ b/planetstack/templates/admin/dashboard/welcome.html
@@ -1,3 +1,25 @@
{% extends "admin/base.html" %}
{% load admin_static %}
+{% block content %}
+<h1>Welcome <a href="core/user/{{user.id}}">{{user.email}}</a> from Site: <a href="core/site/{{site.id}}">{{site}}</a></h1>
+<table class="table table-striped table-bordered table-hover table-condensed">
+<thead><tr>
+<th class="sortable">Slices</th><th class="sortable">Privilege</th>
+<th class="sortable">Reservations</th>
+</tr></thead>
+{% for entry in userSliceInfo %}
+<tr><td> <a href="core/slice/{{entry.slice.id}}">{{entry.slice.name}}</a><br>
+</td><td>{{entry.role}}</td>
+{% if entry.reservations %}
+<td><a href="core/slice/{{entry.slice.id}}/#reservations">
+{% for resSlot in entry.reservations.1 %}
+{{resSlot}} <br>
+{% endfor %}
+</a></td></tr>
+{% else %}
+<td></td></tr>
+{% endif %}
+{% endfor %}
+</table>
+{% endblock %}