Skip to content
Snippets Groups Projects
Commit 56d8f4f4 authored by Andrew Waterhouse's avatar Andrew Waterhouse
Browse files

Single biounit page built

parent 69aac5de
No related branches found
No related tags found
No related merge requests found
......@@ -17,5 +17,6 @@ from django.conf.urls import include, url
from django.contrib import admin
urlpatterns = [
url(r'^biounits/', include('annotator.urls')),
url(r'^admin/', include(admin.site.urls)),
]
{% extends 'base.html' %}
<h2>All Biounits</h2>
\ No newline at end of file
{% block maincontainer %}
<h2>All Biounits</h2>
<table class="table table-striped">
<tr>
<th nowrap="nowrap">SMTL ID</th>
<th>Title</th>
<th>Resolution</th>
<th>Ligands</th>
</tr>
{% for biounit in biounits %}
<tr>
<td><a href="{% url 'annotator.views.single_biounit' smtl_id=biounit.smtl_id %}">{{ biounit.smtl_id }}</a></td>
<td>{{ biounit.title }}</td>
<td>{{ biounit.resolution|floatformat:"2" }}</td>
<td>{% for ligand in biounit.ligand_set.all %}{% ifchanged ligand.shortname %}{% if not forloop.first %}, {% endif %}{{ ligand.shortname }}{% endifchanged %}{% endfor %}
</td>
</tr>
{% endfor %}
</table>
{% endblock %}
\ No newline at end of file
{% extends 'base.html' %}
{% block maincontainer %}
<h2>Biounit {{ biounit.smtl_id }}
<small><a href="{% url 'annotator.views.all_biounits' %}"><i class="glyphicon glyphicon-list-alt"></i> All Biounits</a></small>
</h2>
<hr>
<h4>{{ biounit.title }}</h4>
<h5>Resolution: {{ biounit.resolution|floatformat:"2" }}&Aring; </h5>
<img src="http://swissmodel.expasy.org/templates/{{ biounit.smtl_id }}_s500.png">
{% endblock %}
\ No newline at end of file
from django.conf.urls import url
from . import views
urlpatterns = [
url(r'^$', views.all_biounits),
url(r'^(?P<smtl_id>[a-zA-Z0-9\.]+)$', views.single_biounit)
]
\ No newline at end of file
from django.shortcuts import render
from models import Biounit, Ligand
# Create your views here.
def all_biounits(request):
biounits = Biounit.objects.all()
return render(request, 'allbiounits.html', {'biounits':biounits})
def single_biounit(request, smtl_id):
biounit = Biounit.objects.get(smtl_id=smtl_id)
return render(request, 'biounit.html', {'biounit':biounit})
......@@ -5,4 +5,5 @@ body,html{
#header{
background-color: #0c4b33;padding:16px;
color:white;
}
\ No newline at end of file
}
img { max-width:100%;}
\ No newline at end of file
File added
This diff is collapsed.
File added
File added
......@@ -12,9 +12,13 @@
<body>
<div id="header">
<h2>Django Tutorial <small>29th June 2015</small></h2>
<div class="container">
<h2>Django Tutorial <small>29th June 2015</small></h2>
</div>
</div>
<div class="container">
{% block maincontainer %}{% endblock %}
</div>
<script type="text/javascript" src="{% static 'js/jquery-1.11.1.min.js' %}"></script>
<script type="text/javascript" src="{% static 'js/bootstrap-3.3.1.min.js' %}"></script>
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment