def dashboard(request): context = {} # active projects... projects = Project.list(username=request.user) context['active_projects'] = [p for p in projects \ if p.source == 'Chameleon' and \ any(a.status in ['Active', 'Approved', 'Pending'] for a in p.allocations)] # open tickets... rt = rtUtil.DjangoRt() context['open_tickets'] = rt.getUserTickets(request.user.email) # ongoing outages... outages = [o for o in Outage.objects.order_by('-end_date', '-start_date') if not o.resolved] # silly ORM quirk context['outages'] = outages webinars = Webinar.objects.filter(end_date__gte=timezone.now()) context['webinars'] = webinars # federation status... if 'openid' in request.session: on_geni_project, on_chameleon_project = _check_geni_federation_status(request) context['geni_federation'] = { 'on_geni_project': on_geni_project, 'on_chameleon_project': on_chameleon_project, 'geni_project_name': settings.GENI_FEDERATION_PROJECTS['geni']['name'], 'chameleon_project_name': settings.GENI_FEDERATION_PROJECTS['chameleon']['name'], } return render(request, 'dashboard.html', context)
def user_projects(request): context = {} tas = TASClient() user = tas.get_user(username=request.user) context['is_pi_eligible'] = user['piEligibility'] == 'Eligible' projects = Project.list(username=request.user) projects = list(p for p in projects if p.source == 'Chameleon') context['projects'] = projects return render(request, 'projects/user_projects.html', context)
def user_projects(request): context = {} tas = TASClient() user = tas.get_user(username=request.user) context['is_pi_eligible'] = user['piEligibility'] == 'Eligible' projects = Project.list(username=request.user) projects = list(p for p in projects if p.source == 'Chameleon') for proj in projects: try: extras = ProjectExtras.objects.get(tas_project_id=proj.id) proj.__dict__['nickname'] = extras.nickname except ProjectExtras.DoesNotExist: project_nickname = None context['projects'] = projects return render(request, 'projects/user_projects.html', context)
def dashboard(request): context = {} # active projects... projects = Project.list(username=request.user) context['active_projects'] = [p for p in projects \ if p.source == 'Chameleon' and \ any(a.status in ['Active', 'Approved', 'Pending'] for a in p.allocations)] # open tickets... rt = rtUtil.DjangoRt() context['open_tickets'] = rt.getUserTickets(request.user.email) # ongoing outages... outages = [ o for o in Outage.objects.order_by('-end_date', '-start_date') if not o.resolved ] # silly ORM quirk context['outages'] = outages webinars = Webinar.objects.filter(end_date__gte=timezone.now()) context['webinars'] = webinars # federation status... if 'openid' in request.session: on_geni_project, on_chameleon_project = _check_geni_federation_status( request) context['geni_federation'] = { 'on_geni_project': on_geni_project, 'on_chameleon_project': on_chameleon_project, 'geni_project_name': settings.GENI_FEDERATION_PROJECTS['geni']['name'], 'chameleon_project_name': settings.GENI_FEDERATION_PROJECTS['chameleon']['name'], } return render(request, 'dashboard.html', context)