diff --git a/three_d_viewer/templates/three_d_viewer/home.html b/three_d_viewer/templates/three_d_viewer/home.html index 7ef81f3..6e658f5 100644 --- a/three_d_viewer/templates/three_d_viewer/home.html +++ b/three_d_viewer/templates/three_d_viewer/home.html @@ -1,28 +1,28 @@ {% extends "three_d_viewer/base.html" %} {% block content %} -
-
+
+

Welcome to 3DVOL – Minerals.



- This website contains a three-dimensional virtual object library of the most important rock-forming minerals making up planet Earth. You will find information on:
- - A mineral is typically defined as an inorganic solid with a particular chemical composition and a characteristic, periodic atomic structure. - This characteristic atomic make-up is often reflected in the macroscopic crystalline structure of a mineral. - The 3D models presented on this website will help you to visualise, study, and memorise these beautiful and often - complex crystal structures as well as other diagnostic features of minerals. -
- We hope that you enjoy using 3DVOL. -

- Your 3DVOL team -

- Acknowledgements -
- 3DVOL is funded by the QUT Teaching and Learning Unit and the School of Earth, Environmental, and Biological Sciences. QUT High Performance Computing provides technical support. -

-
+ This website contains a three-dimensional virtual object library of the most important rock-forming minerals making up planet Earth. You will find information on:
+ + A mineral is typically defined as an inorganic solid with a particular chemical composition and a characteristic, periodic atomic structure. + This characteristic atomic make-up is often reflected in the macroscopic crystalline structure of a mineral. + The 3D models presented on this website will help you to visualise, study, and memorise these beautiful and often + complex crystal structures as well as other diagnostic features of minerals. +
+ We hope that you enjoy using 3DVOL. +

+ Your 3DVOL team +

+ Acknowledgements +
+ 3DVOL is funded by the QUT Teaching and Learning Unit and the School of Earth, Environmental, and Biological Sciences. QUT High Performance Computing provides technical support. +

+
{% endblock %} \ No newline at end of file diff --git a/three_d_viewer/templates/three_d_viewer/minerals_practice.html b/three_d_viewer/templates/three_d_viewer/minerals_practice.html index 01909bf..ecae022 100644 --- a/three_d_viewer/templates/three_d_viewer/minerals_practice.html +++ b/three_d_viewer/templates/three_d_viewer/minerals_practice.html @@ -2,52 +2,50 @@ {% block content %} +
+ +
{% endblock %} \ No newline at end of file diff --git a/three_d_viewer/urls.py b/three_d_viewer/urls.py index 6f3068e..ec5eb61 100644 --- a/three_d_viewer/urls.py +++ b/three_d_viewer/urls.py @@ -8,10 +8,11 @@ urlpatterns = patterns( url(r'^$', views.HomeView.as_view(), name='home'), url(r'^$', generic.TemplateView.as_view(template_name="three_d_viewer/home.html"), name='home'), url(r'^minerals_theory/$', generic.TemplateView.as_view(template_name="three_d_viewer/minerals_theory.html"), name='minerals_theory'), - url(r'^minerals_practice/$', generic.TemplateView.as_view(template_name="three_d_viewer/minerals_practice.html"), name='minerals_practice'), + url(r'^minerals_practice/$', views.MineralPracticeView.as_view(template_name="three_d_viewer/minerals_practice.html"), name='minerals_practice'), url(r'^minerals_selftest/$', generic.TemplateView.as_view(template_name="three_d_viewer/minerals_selftest.html"), name='minerals_selftest'), - url(r'^(?P\d+)/$', views.DetailView.as_view(), name='detail'), - url(r'^minerals/(?P\d+)/$', views.MineralDetailView.as_view(), name='mineral_detail'), + url(r'^minerals/(?P\d+)/$', views.MineralPracticeView.as_view(), name='mineral_detail'), + #url(r'^(?P\d+)/$', views.DetailView.as_view(), name='detail'), + #url(r'^minerals/(?P\d+)/$', views.MineralDetailView.as_view(), name='mineral_detail'), url(r'^media/(?P.*)$', 'django.views.static.serve', {'document_root': settings.MEDIA_ROOT}), ) diff --git a/three_d_viewer/views.py b/three_d_viewer/views.py index 77db1c9..d1d8e93 100644 --- a/three_d_viewer/views.py +++ b/three_d_viewer/views.py @@ -4,6 +4,8 @@ Define the views for the Django MVC from django import template from django.views import generic +from itertools import chain +from operator import attrgetter from three_d_viewer.models import Sample, Category, Mineral register = template.Library() @@ -24,7 +26,21 @@ class HomeView(generic.ListView): filter(active=True).order_by('name') return context +class MineralPracticeView(generic.ListView): + model = Sample + template_name = 'three_d_viewer/minerals_practice.html' + def get_context_data(self, **kwargs): + context = super(MineralPracticeView, self).get_context_data(**kwargs) + cat = Category.objects.get(name='Minerals') + #context['active_samples'] = cat.active_samples + result = cat.active_samples + + for child in cat.active_children: + result = chain(result, child.active_samples) + + context['active_samples'] = sorted(result, key=attrgetter('name')) + return context class DetailView(generic.DetailView): """