Commit a3923fe7 authored by Leonidas Poulopoulos's avatar Leonidas Poulopoulos
Browse files

Added initial views to insts, services, servers

parent 7051b4e7
# Create your views here.
# -*- coding: utf-8 -*- vim:encoding=utf-8:
# vim: tabstop=4:shiftwidth=4:softtabstop=4:expandtab
from django.shortcuts import render_to_response,get_object_or_404
from django.http import HttpResponse,HttpResponseRedirect,Http404
from django.template import RequestContext
from django.contrib.auth.decorators import login_required
from edumanage.models import *
def index(request):
return render_to_response('base.html', context_instance=RequestContext(request))
@login_required
def manage(request):
services_list = []
servers_list = []
inst_dets = Institution.objects.all()
for inst in inst_dets:
services = ServiceLoc.objects.filter(institutionid=inst)
services_list.extend([s for s in services])
for inst in inst_dets:
servers = InstServer.objects.filter(instid=inst)
servers_list.extend([s for s in servers])
return render_to_response('edumanage/welcome.html',
{
'institutions': inst_dets,
'services': services_list,
'servers': servers_list
},
context_instance=RequestContext(request))
@login_required
def institutions(request):
user = request.user
return render_to_response('edumanage/institutions.html',
{
'institutions': inst_dets,
'services': services_list,
'servers': servers_list
},
context_instance=RequestContext(request))
\ No newline at end of file
<!DOCTYPE html>
<html>
<head>
<title>Eduroam 101 Template</title>
<link href="/static/css/bootstrap.min.css" rel="stylesheet">
<style type="text/css">
body {
padding-top: 100px;
padding-bottom: 60px;
}
.sidebar-nav {
padding: 9px 0;
}
</style>
</head>
<body>
<div class="navbar navbar-fixed-top">
<div class="navbar-inner">
<div class="container-fluid">
<a class="brand" href="#"><img src="/static/img/eduroam.png"></a>
<p class="navbar-text pull-right">
<a class="brand" href="#">
<img src="/static/img/grnet_logo.png">
</a>
</p>
</div>
</div>
</div>
{% block content %}
<div class="container-fluid">
<div class="row-fluid">
<div class="span3">
<div class="well sidebar-nav">
<ul class="nav nav-list">
<li class="nav-header">Sidebar</li>
<li class="active"><a href="#">Link</a></li>
<li><a href="#">Link</a></li>
<li><a href="#">Link</a></li>
<li><a href="#">Link</a></li>
<li class="nav-header">Sidebar</li>
<li><a href="#">Link</a></li>
<li><a href="#">Link</a></li>
<li><a href="#">Link</a></li>
<li><a href="#">Link</a></li>
<li><a href="#">Link</a></li>
<li><a href="#">Link</a></li>
<li class="nav-header">Sidebar</li>
<li><a href="#">Link</a></li>
<li><a href="#">Link</a></li>
<li><a href="#">Link</a></li>
</ul>
</div><!--/.well -->
</div><!--/span-->
<div class="span9">
<div class="span6">
<h4>EduroamGR Tweets</h4>
<p><a class="twitter-timeline" href="https://twitter.com/eduroamGR" data-widget-id="247968968848056320" width="300" height="400">Tweets by @eduroamGR</a>
<script>!function(d,s,id){var js,fjs=d.getElementsByTagName(s)[0];if(!d.getElementById(id)){js=d.createElement(s);js.id=id;js.src="//platform.twitter.com/widgets.js";fjs.parentNode.insertBefore(js,fjs);}}(document,"script","twitter-wjs");</script>
</p>
</div>
<div class="row-fluid">
<!--/span-->
<div class="span4">
<h4>Heading</h4>
<p>Donec id elit non mi porta gravida at eget metus. Fusce dapibus, tellus ac cursus commodo, tortor mauris condimentum nibh, ut fermentum massa justo sit amet risus. Etiam porta sem malesuada magna mollis euismod. Donec sed odio dui. </p>
<p><a class="btn" href="#">View details &raquo;</a></p>
</div><!--/span-->
<div class="span4">
<h4>Heading</h4>
<p>Donec id elit non mi porta gravida at eget metus. Fusce dapibus, tellus ac cursus commodo, tortor mauris condimentum nibh, ut fermentum massa justo sit amet risus. Etiam porta sem malesuada magna mollis euismod. Donec sed odio dui. </p>
<p><a class="btn" href="#">View details &raquo;</a></p>
</div><!--/span-->
</div><!--/row-->
<div class="row-fluid">
<div class="span4">
<h4>Heading</h4>
<p>Donec id elit non mi porta gravida at eget metus. Fusce dapibus, tellus ac cursus commodo, tortor mauris condimentum nibh, ut fermentum massa justo sit amet risus. Etiam porta sem malesuada magna mollis euismod. Donec sed odio dui. </p>
<p><a class="btn" href="#">View details &raquo;</a></p>
</div><!--/span-->
<div class="span4">
<h2>Heading</h2>
<p>Donec id elit non mi porta gravida at eget metus. Fusce dapibus, tellus ac cursus commodo, tortor mauris condimentum nibh, ut fermentum massa justo sit amet risus. Etiam porta sem malesuada magna mollis euismod. Donec sed odio dui. </p>
<p><a class="btn" href="#">View details &raquo;</a></p>
</div><!--/span-->
<div class="span4">
<h2>Heading</h2>
<p>Donec id elit non mi porta gravida at eget metus. Fusce dapibus, tellus ac cursus commodo, tortor mauris condimentum nibh, ut fermentum massa justo sit amet risus. Etiam porta sem malesuada magna mollis euismod. Donec sed odio dui. </p>
<p><a class="btn" href="#">View details &raquo;</a></p>
</div><!--/span-->
</div><!--/row-->
</div><!--/span-->
</div><!--/row-->
<hr>
<footer>
<p>&copy; Company 2012</p>
</footer>
</div><!--/.fluid-container-->
{% endblock %}
<script src="http://code.jquery.com/jquery-latest.js"></script>
<script src="/static/js/bootstrap.min.js"></script>
</body>
</html>
\ No newline at end of file
{% extends "base.html"%}
{% block content %}
<div class="container-fluid">
<div class="row-fluid">
<div class="span3">
<div class="sidebar-nav">
<ul class="nav nav-tabs nav-stacked">
<li>
<a href="{% url manage %}">Home</a>
</li>
<li class="active">
<a href="#">Institution</a>
</li>
<li>
<a href="#">Services</a>
</li>
<li>
<a href="#">Servers</a>
</li>
</ul>
</div><!--/.well -->
</div><!--/span-->
<div class="span9">
<div class="row-fluid">
<!--/span-->
<div class="span12">
<h4>Institution</h4>
{% if services %}
{% for service in services %}<p>{{service}}</p>{% endfor %}
{% else %}
<p>No services defined!</p>
{% endif %}
<p><a class="btn" href="#">View details &raquo;</a></p>
</div><!--/span-->
</div><!--/row-->
</div><!--/span-->
</div><!--/row-->
<hr>
<footer>
<p>&copy; Company 2012</p>
</footer>
</div><!--/.fluid-container-->
{% endblock %}
\ No newline at end of file
{% extends "base.html"%}
{% block content %}
<div class="container-fluid">
<div class="row-fluid">
<div class="span3">
<div class="sidebar-nav">
<ul class="nav nav-tabs nav-stacked">
<li class="active">
<a href="#">Home</a>
</li>
<li>
<a href="{% url institutions %}">Institution</a>
</li>
<li>
<a href="#">Services</a>
</li>
<li>
<a href="#">Servers</a>
</li>
</ul>
</div><!--/.well -->
</div><!--/span-->
<div class="span9">
<div class="row-fluid">
<!--/span-->
<div class="span6">
<h4>Services</h4>
{% if services %}
{% for service in services %}<p>{{service}}</p>{% endfor %}
{% else %}
<p>No services defined!</p>
{% endif %}
<p><a class="btn" href="#">View details &raquo;</a></p>
</div><!--/span-->
<div class="span6">
<h4>Institution</h4>
{% if institutions %}
{% for inst in institutions %}
<p>{{inst}}</p>
{% endfor %}
{% else %}
<p>No institution defined!</p>
{% endif %}
</div><!--/span-->
</div><!--/row-->
<div class="row-fluid">
<div class="span6">
<h4>Servers</h4>
{% if servers %}
{% for server in servers %}<p>{{server}}</p>{% endfor %}
{% else %}
<p>No servers defined!</p>
{% endif %}
<p><a class="btn" href="#">View details &raquo;</a></p>
</div><!--/span-->
<div class="span6">
</div><!--/span-->
<div class="span6">
</div><!--/span-->
</div><!--/row-->
</div><!--/span-->
</div><!--/row-->
<hr>
<footer>
<p>&copy; Company 2012</p>
</footer>
</div><!--/.fluid-container-->
{% endblock %}
\ No newline at end of file
{% extends "base.html" %}
{% block content %}
<div class="container-fluid">
<div class="row-fluid">
<div class="span3"></div>
<div class="span6">
<div class="hero-unit">
<form class="form-horizontal" method="post" action="{% url django.contrib.auth.views.login %}">
{% if form.non_field_errors %}
{% for err in form.non_field_errors %}
<div class="control-group error ">
<div class="controls error">
<span style="color: #B94A48;">{{err}}</span>
</div>
</div>
{% endfor %}
{% endif %}
{% csrf_token %}
<div class="control-group {% if form.username.errors %} error {% endif %}">
<label class="control-label" for="id_username">Username</label>
<div class="controls">
{{ form.username }}
{% if form.username.errors %}
<span class="help-inline">
{{ form.username.errors|join:", " }}
</span>
{% endif %}
</div>
</div>
<div class="control-group {% if form.password.errors %} error {% endif %}">
<label class="control-label" for="id_password">Password</label>
<div class="controls">
{{ form.password }}
{% if form.password.errors %}
<span class="help-inline">
{{ form.password.errors|join:", " }}
</span>
{% endif %}
</div>
</div>
<div class="control-group">
<div class="controls">
<button type="submit" class="btn">Sign in</button><input type="hidden"
name="next" value="{% url manage %}" />
</div>
</div>
</form>
</div>
</div>
<div class="span3"></div>
</div>
</div>
{% endblock %}
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