Implemented erb101 menu
This commit is contained in:
BIN
db.sqlite3
BIN
db.sqlite3
Binary file not shown.
@@ -81,11 +81,11 @@ class Sample(CommonInfo):
|
|||||||
self.viewed_count += 1
|
self.viewed_count += 1
|
||||||
|
|
||||||
if cat.name == 'Fossils':
|
if cat.name == 'Fossils':
|
||||||
return 'three_d_viewer:fossil_detail'
|
return 'fossil_detail'
|
||||||
elif cat.name == 'Rocks':
|
elif cat.name == 'Rocks':
|
||||||
return 'three_d_viewer:rock_detail'
|
return 'rock_detail'
|
||||||
else:
|
else:
|
||||||
return 'three_d_viewer:sample_detail'
|
return 'sample_detail'
|
||||||
|
|
||||||
|
|
||||||
class Mineral(Sample):
|
class Mineral(Sample):
|
||||||
@@ -107,7 +107,7 @@ class Mineral(Sample):
|
|||||||
@property
|
@property
|
||||||
def url(self):
|
def url(self):
|
||||||
self.viewed_count += 1
|
self.viewed_count += 1
|
||||||
return 'three_d_viewer:mineral_detail'
|
return 'mineral_detail'
|
||||||
|
|
||||||
|
|
||||||
class Question(models.Model):
|
class Question(models.Model):
|
||||||
|
|||||||
@@ -31,9 +31,11 @@
|
|||||||
<ul>
|
<ul>
|
||||||
<li class='has-sub'><a><span>Theory</span></a>
|
<li class='has-sub'><a><span>Theory</span></a>
|
||||||
<ul>
|
<ul>
|
||||||
|
{% block theory %}
|
||||||
<li><a href="{% url 'three_d_viewer:theory_structure' %}"><span>Structure of Earth</span></a></li>
|
<li><a href="{% url 'three_d_viewer:theory_structure' %}"><span>Structure of Earth</span></a></li>
|
||||||
<li><a href="{% url 'three_d_viewer:theory_pt' %}"><span>Pressure and temperature</span></a></li>
|
<li><a href="{% url 'three_d_viewer:theory_pt' %}"><span>Pressure and temperature</span></a></li>
|
||||||
<li class='last'><a href="{% url 'three_d_viewer:theory_bowen' %}"><span>Bowen's reaction series</span></a></li>
|
<li class='last'><a href="{% url 'three_d_viewer:theory_bowen' %}"><span>Bowen's reaction series</span></a></li>
|
||||||
|
{% endblock %}
|
||||||
</ul>
|
</ul>
|
||||||
</li>
|
</li>
|
||||||
{% block mineral_practice %}<li><a href="{% url 'three_d_viewer:minerals_practice' %}"><span>Practice</span></a></li>{% endblock %}
|
{% block mineral_practice %}<li><a href="{% url 'three_d_viewer:minerals_practice' %}"><span>Practice</span></a></li>{% endblock %}
|
||||||
|
|||||||
@@ -15,3 +15,13 @@
|
|||||||
|
|
||||||
{% block fossil_menu %}
|
{% block fossil_menu %}
|
||||||
{% endblock %}
|
{% endblock %}
|
||||||
|
|
||||||
|
{% block theory %}
|
||||||
|
<li><a href="{% url 'three_d_viewer:erb101_theory_structure' %}"><span>Structure of Earth</span></a></li>
|
||||||
|
<li><a href="{% url 'three_d_viewer:erb101_theory_pt' %}"><span>Pressure and temperature</span></a></li>
|
||||||
|
<li class='last'><a href="{% url 'three_d_viewer:erb101_theory_bowen' %}"><span>Bowen's reaction series</span></a></li>
|
||||||
|
{% endblock %}
|
||||||
|
|
||||||
|
<script type="text/javascript">
|
||||||
|
alert("Hello world");
|
||||||
|
</script>
|
||||||
@@ -3,9 +3,19 @@
|
|||||||
{% block content %}
|
{% block content %}
|
||||||
<div id="pushDownTwo"></div>
|
<div id="pushDownTwo"></div>
|
||||||
<div id="mainText">
|
<div id="mainText">
|
||||||
<h3 class="headings">ERB101 home page</h3><br><br>
|
<h3 class="headings">ERB101 - Earth Systems</h3><br><br>
|
||||||
<p>
|
<p>
|
||||||
blah blah blah
|
Earth Science impacts every aspect of modern life. Hence, the concepts of Earth Science
|
||||||
|
are fundamental not only to the field of Geology, but also to Environmental Science, natural
|
||||||
|
resource management, civil engineering and society at large. Earth Systems provides an
|
||||||
|
introduction to Earth Science, including earth materials, geologic history, geological and
|
||||||
|
physical geography process at the Earth's surface, and the complex interplay between the
|
||||||
|
lithosphere and landscapes. Additionally, the unit provides readily accessible examples of
|
||||||
|
the use of scientific reasoning for understanding complex natural systems. Hence, Earth
|
||||||
|
Systems is a foundation unit for further studies in Geology and Environmental Science, but
|
||||||
|
more importantly, serves as a broad introduction to the very world we live on and to the ways
|
||||||
|
of science in general. Such a background is highly desirable for any informed citizenry for
|
||||||
|
understanding complex issues of resource, environment, and societal development.
|
||||||
</p>
|
</p>
|
||||||
</div>
|
</div>
|
||||||
{% endblock %}
|
{% endblock %}
|
||||||
@@ -0,0 +1 @@
|
|||||||
|
{% extends "three_d_viewer/mineral_detail.html" %}
|
||||||
@@ -0,0 +1 @@
|
|||||||
|
{% extends "three_d_viewer/minerals_practice.html" %}
|
||||||
@@ -0,0 +1,3 @@
|
|||||||
|
{% extends "three_d_viewer/rock_detail.html" %}
|
||||||
|
|
||||||
|
|
||||||
@@ -1,3 +1 @@
|
|||||||
{% extends "three_d_viewer/rock_practice.html" %}
|
{% extends "three_d_viewer/rock_practice.html" %}
|
||||||
|
|
||||||
{% block base %}{% extends "three_d_viewer/erb101/base.html" %}{% endblock %}
|
|
||||||
@@ -0,0 +1,26 @@
|
|||||||
|
{% extends "three_d_viewer/base.html" %}
|
||||||
|
{% load static %}
|
||||||
|
|
||||||
|
{% block content %}
|
||||||
|
<div id="pushDownTwo"></div>
|
||||||
|
<div id="mainText">
|
||||||
|
<h1 class="subHeadings">Theory</h1>
|
||||||
|
<h2 class="theoryHeadings" id="bowensreactionseries">Bowen's Reaction Series</h2>
|
||||||
|
<p>
|
||||||
|
Bowen's Reaction Series arranges the silicate minerals in the order that they crystallise from a magma. The minerals at the top of the series crystallise from the melt at higher temperature than those
|
||||||
|
lower down. It contains a continuous series, (right hand limb), discontinuous series (left hand limb), and the residual phases that describe the reaction pathway of different silicate minerals.
|
||||||
|
The discontinuous series crystallises different minerals, with abrupt changes separating the different minerals due to a mineral reacting with the melt to form a different mineral (eg. Olivine reacting to crystallise pyroxene).
|
||||||
|
The continuous series always crystallises plagioclase, but the composition of the plagioclase varies from more calcic at higher temperatures and more sodic as the temperature decreases.
|
||||||
|
with the minerals at the bottom of the series being more stable, and less susceptible to weathering.
|
||||||
|
The residual phases are the minerals at the bottom and crystallise last. Bowen's reaction series also predicts the stability of minerals in the low pressure conditions at the Earth's surface,
|
||||||
|
<br /><br />
|
||||||
|
It should be noted that all reactions do not start crystallising olivine/anorthite-rich plagioclase and continue through until they crystallise quartz.
|
||||||
|
The actual reactions depend on many factors, such as the chemical composition of the melt, temperature, pressure, and amount of fractional crystallisation.
|
||||||
|
For example, basalts form from the crystallisation of olivine, pyroxene and calcic plagioclase meaning that crystallisation stopped without the series progressing.
|
||||||
|
If more fractional crystallisation were to occur, more intermediate and felsic minerals can crystallise.
|
||||||
|
<br/>
|
||||||
|
<img src="{% static "three_d_viewer/images/bowen.jpg" %}" style="padding-top:20px; text-align: left;" width="600px" height="auto">
|
||||||
|
</p>
|
||||||
|
<div id="pushDownThree"></div>
|
||||||
|
</div>
|
||||||
|
{% endblock %}
|
||||||
@@ -0,0 +1,56 @@
|
|||||||
|
{% extends "three_d_viewer/base.html" %}
|
||||||
|
{% load static %}
|
||||||
|
|
||||||
|
{% block content %}
|
||||||
|
<div id="pushDownTwo"></div>
|
||||||
|
<div id="mainText">
|
||||||
|
<h1 class="subHeadings">Theory</h1>
|
||||||
|
<h2 class="theoryHeadings" id="pressureandtemp">Pressure and Temperature</h2>
|
||||||
|
<p>
|
||||||
|
The heat contained within the Earth is generated by two main sources: the formation of the Earth,
|
||||||
|
and the decay of radioactive isotopes. The Earth was formed by the accretion of a large number of
|
||||||
|
planitesimals as it cleared its orbit. The impact of those planitesimals generated a large amount
|
||||||
|
of heat which is still being lost from the Earth’s core today. The other source of heat comes
|
||||||
|
from the radioactive decay of elements within the crust and mantle of the Earth.
|
||||||
|
The primary radioactive isotopes in the Earth are uranium-235, uranium-238, thorium-232,
|
||||||
|
and potassium-40. Radioactive decay is the dominant form of heat flow at the surface of the Earth,
|
||||||
|
providing approximately 80% of the heat budget.
|
||||||
|
<br /><br />
|
||||||
|
The temperature of the Earth changes from around 0°C at the surface to over 5000°C in the core.
|
||||||
|
The geothermal gradient in the crust is approximately 30°C per kilometre in the crust on average,
|
||||||
|
however there is significant local variation due to things such as the conductive abilities of the
|
||||||
|
rocks at particular locations, as well as the presence of nearby magmatic intrusions.
|
||||||
|
The geothermal gradient in the mantle reduces significantly, down to approximately 0.3°C/km.
|
||||||
|
The base of the lithosphere is defined by the 1000°C isotherm. The base of the mantle is at
|
||||||
|
approximately 2800°C.
|
||||||
|
<br /><br />
|
||||||
|
The method of heat transfer changes throughout the Earth. There are three main mechanisms for
|
||||||
|
heat transfer in the Earth: conduction, convection, and radiation. Starting in the inner core,
|
||||||
|
the main method of heat transfer is by conduction through the solid material. In the liquid,
|
||||||
|
outer core heat transfer is by both conduction and convection. The mantle is dominated by convection,
|
||||||
|
which is the driver of plate tectonics. The crust is again dominated by conduction, and finally
|
||||||
|
energy escapes the Earth to the atmosphere by radiation.
|
||||||
|
<br /><br />
|
||||||
|
Pressure in the Earth continually increases with depth, according to the formula P = gρz,
|
||||||
|
where g is the gravitation field strength, ρ is the density and z is the depth. The main
|
||||||
|
difference in the pressure gradient is cause by the different lithologies in the layers
|
||||||
|
of the Earth. The average density of continental crust is approximately 2.7g/cm3 and
|
||||||
|
is ~3.0 g/cm3 in oceanic crust, and increases to about 3.3 g/cm3 in the mantle.
|
||||||
|
The increase of pressure with depth in the Earth affects the dominant mineralogy, as
|
||||||
|
well as the increase of the melting point of different minerals.
|
||||||
|
<br /><br />
|
||||||
|
The structure of minerals, such as olivine becomes unstable as pressure increases.
|
||||||
|
Below about 410km olivine becomes unstable and transforms into wadsleyite, which has the
|
||||||
|
same chemical composition as olivine, but has a different crystal structure. As depth
|
||||||
|
increases, wadsleyite transforms to ringwoodite, which subsequently transforms into
|
||||||
|
perovskite at about 600km.
|
||||||
|
<br /><br />
|
||||||
|
At higher pressure, minerals have a higher melting point. The effect is this phenomenon
|
||||||
|
is that the dominant method of melting in the mantle is not by increasing the temperature
|
||||||
|
past its melting point, but by decompression. Due to convective processes in the mantle,
|
||||||
|
as parts of the mantle rise the decrease in pressure lowers the melting temperature and
|
||||||
|
can cause the mantle to melt.
|
||||||
|
</p>
|
||||||
|
<div id="pushDownThree"></div>
|
||||||
|
</div>
|
||||||
|
{% endblock %}
|
||||||
@@ -0,0 +1,37 @@
|
|||||||
|
{% extends "three_d_viewer/base.html" %}
|
||||||
|
{% load static %}
|
||||||
|
|
||||||
|
{% block content %}
|
||||||
|
<div id="pushDownTwo"></div>
|
||||||
|
<div id="mainText">
|
||||||
|
<h1 class="subHeadings">Theory</h1>
|
||||||
|
<h2 class="theoryHeadings" id="structureofearth">Structure of Earth</h2>
|
||||||
|
<p>
|
||||||
|
The Earth's structure is differentiated in three distinct layers: the core, mantle, and crust. The layers are distinguished by a change in the velocity of seismic waves at their boundaries.
|
||||||
|
The crust is the upper most part of the earth, with depths ranging from an average of 7km in in the oceans, to an average of 38km in continental crust.
|
||||||
|
The crust thickens underneath mountain ranges, and can reach depths of 90km underneath the Himalayas. The composition of the crust also differs between oceanic and
|
||||||
|
continental environments. Ocean crust is young mafic crust dominated by basalts and gabbros that is recycled regularly(~300Ma) due to subduction processes.
|
||||||
|
Continental crust is much more varied in structure and composition than oceanic, but has an overall average composition of granodiorite.
|
||||||
|
<br /><br />
|
||||||
|
The boundary of the crust and mantle is defined by the Mohorovi?i? discontinuity, commonly referred to as the Moho.
|
||||||
|
It is defined by a sharp increase in seismic wave velocity, due to a change in material properties between crustal rocks and mantle rocks. The mantle is dominated by
|
||||||
|
silicate minerals that are rich in iron and magnesium, chiefly pyroxenes and polymorphs of olivine, forming peridotite. The mantle, while solid, behaves plastically,
|
||||||
|
allowing to flow at very slow rates.
|
||||||
|
<br /><br />
|
||||||
|
The core is distinguished by the absence of S waves, leading to the inference that the core is liquid. The core is separated into the outer core and the inner core.
|
||||||
|
The outer core is liquid dominated by iron and nickel. The inner core is solid, as determined by the strong refraction of P waves at the inner core-outer core boundary,
|
||||||
|
and was formed by crystalizing minerals from the liquid part of the core as the Earth cools.
|
||||||
|
<br /><br />
|
||||||
|
The crust and mantle are also further distinguished by material properties into the lithosphere, asthenosphere, and mesosphere. The chemical composition is
|
||||||
|
uniform throughout the mantle though, but changes in pressure and temperature determine which polymorphs will exist at different depths.
|
||||||
|
The lithosphere contains the crust, and the upper part of the mantle down to ~100km under oceanic crust, and 200-300km under continental crust (Twiss & Moores, 2007).
|
||||||
|
The lithosphere-asthenosphere boundary is defined by the 1300K isotherm, which is the temperature where olivine starts to behave viscously.
|
||||||
|
The rocks in the mesosphere are under more pressure than those in the asthenosphere, so no longer behave viscously.</p>
|
||||||
|
<figure>
|
||||||
|
<img src="{% static "three_d_viewer/images/structure - usgs.gif" %}" style="padding-top:20px;">
|
||||||
|
<figcaption><p>Image sourced from <a href="http://pubs.usgs.gov/gip/dynamic/graphics/FigS1-1.gif">USGS</a>.</p></figcaption>
|
||||||
|
</figure>
|
||||||
|
</div>
|
||||||
|
<div id="pushDownThree"></div>
|
||||||
|
</div>
|
||||||
|
{% endblock %}
|
||||||
@@ -28,8 +28,9 @@ function load(){
|
|||||||
}
|
}
|
||||||
request.send();
|
request.send();
|
||||||
}
|
}
|
||||||
|
|
||||||
{% endblock load %}
|
{% endblock load %}
|
||||||
|
|
||||||
{% block menu_header %}Select a rock{% endblock %}
|
{% block menu_header %}Select a rock {% endblock %}
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -403,4 +403,5 @@ function resizeCanvas() {
|
|||||||
<canvas id="canvas" class="example"></canvas>
|
<canvas id="canvas" class="example"></canvas>
|
||||||
<div><br><span id="progress" style="color: red"></span></div>
|
<div><br><span id="progress" style="color: red"></span></div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
{% endblock %}
|
{% endblock %}
|
||||||
@@ -7,7 +7,11 @@
|
|||||||
<li class="has-sub mainitem"><a href="#">{% block menu_header %}Select a sample{% endblock %}</a>
|
<li class="has-sub mainitem"><a href="#">{% block menu_header %}Select a sample{% endblock %}</a>
|
||||||
<ul>
|
<ul>
|
||||||
{% for sample in active_samples %}
|
{% for sample in active_samples %}
|
||||||
<li><a href={% url sample.url sample.id %}>{{ sample.name }}</a></li>
|
{% if base_template == 'three_d_viewer/base.html' %}
|
||||||
|
<li><a href={% url 'three_d_viewer:'|add:sample.url sample.id %}>{{ sample.name }}</a></li>
|
||||||
|
{% else %}
|
||||||
|
<li><a href={% url 'three_d_viewer:erb101_'|add:sample.url sample.id %}>{{ sample.name }}</a></li>
|
||||||
|
{% endif %}
|
||||||
{% endfor %}
|
{% endfor %}
|
||||||
</ul>
|
</ul>
|
||||||
</li>
|
</li>
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
{% extends "three_d_viewer/base.html" %}
|
{% extends base_template %}
|
||||||
{% load static %}
|
{% load static %}
|
||||||
|
|
||||||
{% block content %}
|
{% block content %}
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
{% extends "three_d_viewer/base.html" %}
|
{% extends base_template %}
|
||||||
{% load static %}
|
{% load static %}
|
||||||
|
|
||||||
{% block content %}
|
{% block content %}
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
{% extends "three_d_viewer/base.html" %}
|
{% extends base_template %}
|
||||||
{% load static %}
|
{% load static %}
|
||||||
|
|
||||||
{% block content %}
|
{% block content %}
|
||||||
|
|||||||
@@ -7,9 +7,12 @@ urlpatterns = patterns(
|
|||||||
'',
|
'',
|
||||||
url(r'^$', views.HomeView.as_view(), name='home'),
|
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'^$', generic.TemplateView.as_view(template_name="three_d_viewer/home.html"), name='home'),
|
||||||
url(r'^theory/structure/$', generic.TemplateView.as_view(template_name="three_d_viewer/theory/structure.html"), name='theory_structure'),
|
url(r'^theory/structure/$', views.TheoryTemplateView.as_view(template_name="three_d_viewer/theory/structure.html"), name='theory_structure'),
|
||||||
url(r'^theory/bowen/$', generic.TemplateView.as_view(template_name="three_d_viewer/theory/bowen.html"), name='theory_bowen'),
|
url(r'^theory/erb101_structure/$', views.ERB101TheoryTemplateView.as_view(template_name="three_d_viewer/theory/structure.html"), name='erb101_theory_structure'),
|
||||||
url(r'^theory/pressure_temp/$', generic.TemplateView.as_view(template_name="three_d_viewer/theory/pressure_temp.html"), name='theory_pt'),
|
url(r'^theory/bowen/$', views.TheoryTemplateView.as_view(template_name="three_d_viewer/theory/bowen.html"), name='theory_bowen'),
|
||||||
|
url(r'^theory/erb101_bowen/$', views.ERB101TheoryTemplateView.as_view(template_name="three_d_viewer/theory/bowen.html" ), name='erb101_theory_bowen'),
|
||||||
|
url(r'^theory/pressure_temp/$', views.TheoryTemplateView.as_view(template_name="three_d_viewer/theory/pressure_temp.html"), name='theory_pt'),
|
||||||
|
url(r'^theory/erb101_pressure_temp/$', views.ERB101TheoryTemplateView.as_view(template_name="three_d_viewer/theory/pressure_temp.html"), name='erb101_theory_pt'),
|
||||||
url(r'^minerals_practice/$', views.MineralPracticeView.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/(?P<pk>\d+)/$', views.MineralDetailView.as_view(), name='mineral_detail'),
|
url(r'^minerals/(?P<pk>\d+)/$', views.MineralDetailView.as_view(), name='mineral_detail'),
|
||||||
url(r'^minerals_selftest/$', generic.TemplateView.as_view(template_name="three_d_viewer/minerals_selftest.html"), name='minerals_selftest'),
|
url(r'^minerals_selftest/$', generic.TemplateView.as_view(template_name="three_d_viewer/minerals_selftest.html"), name='minerals_selftest'),
|
||||||
@@ -23,6 +26,8 @@ urlpatterns = patterns(
|
|||||||
url(r'^erb101/$', generic.TemplateView.as_view(template_name="three_d_viewer/erb101/home.html"), name='erb101_home'),
|
url(r'^erb101/$', generic.TemplateView.as_view(template_name="three_d_viewer/erb101/home.html"), name='erb101_home'),
|
||||||
url(r'^erb101_rock_practice/$', views.ERB101RockPracticeView.as_view(), name='erb101_rocks_practice'),
|
url(r'^erb101_rock_practice/$', views.ERB101RockPracticeView.as_view(), name='erb101_rocks_practice'),
|
||||||
url(r'^erb101_minerals_practice/$', views.ERB101MineralPracticeView.as_view(), name='erb101_minerals_practice'),
|
url(r'^erb101_minerals_practice/$', views.ERB101MineralPracticeView.as_view(), name='erb101_minerals_practice'),
|
||||||
|
url(r'^erb101_minerals/(?P<pk>\d+)/$', views.ERB101MineralDetailView.as_view(), name='erb101_mineral_detail'),
|
||||||
|
url(r'^erb101_rocks/(?P<pk>\d+)/$', views.ERB101RockDetailView.as_view(), name='erb101_rock_detail'),
|
||||||
url(r'^media/(?P<path>.*)$', 'django.views.static.serve',
|
url(r'^media/(?P<path>.*)$', 'django.views.static.serve',
|
||||||
{'document_root': settings.MEDIA_ROOT}),
|
{'document_root': settings.MEDIA_ROOT}),
|
||||||
)
|
)
|
||||||
|
|||||||
@@ -39,6 +39,7 @@ class MineralPracticeView(generic.ListView):
|
|||||||
result = chain(result, child.active_samples)
|
result = chain(result, child.active_samples)
|
||||||
|
|
||||||
context['active_samples'] = sorted(result, key=attrgetter('name'))
|
context['active_samples'] = sorted(result, key=attrgetter('name'))
|
||||||
|
context['base_template'] = 'three_d_viewer/base.html'
|
||||||
return context
|
return context
|
||||||
|
|
||||||
class MineralDetailView(generic.DetailView):
|
class MineralDetailView(generic.DetailView):
|
||||||
@@ -61,6 +62,7 @@ class MineralDetailView(generic.DetailView):
|
|||||||
result = chain(result, child.active_samples)
|
result = chain(result, child.active_samples)
|
||||||
|
|
||||||
context['active_samples'] = sorted(result, key=attrgetter('name'))
|
context['active_samples'] = sorted(result, key=attrgetter('name'))
|
||||||
|
context['base_template'] = 'three_d_viewer/base.html'
|
||||||
return context
|
return context
|
||||||
|
|
||||||
def get_object(self, queryset=None):
|
def get_object(self, queryset=None):
|
||||||
@@ -132,6 +134,7 @@ class FossilPracticeView(generic.ListView):
|
|||||||
result = chain(result, child.active_samples)
|
result = chain(result, child.active_samples)
|
||||||
|
|
||||||
context['active_samples'] = sorted(result, key=attrgetter('name'))
|
context['active_samples'] = sorted(result, key=attrgetter('name'))
|
||||||
|
context['base_template'] = 'three_d_viewer/base.html'
|
||||||
return context
|
return context
|
||||||
|
|
||||||
class FossilDetailView(generic.DetailView):
|
class FossilDetailView(generic.DetailView):
|
||||||
@@ -151,6 +154,7 @@ class FossilDetailView(generic.DetailView):
|
|||||||
result = chain(result, child.active_samples)
|
result = chain(result, child.active_samples)
|
||||||
|
|
||||||
context['active_samples'] = sorted(result, key=attrgetter('name'))
|
context['active_samples'] = sorted(result, key=attrgetter('name'))
|
||||||
|
context['base_template'] = 'three_d_viewer/base.html'
|
||||||
return context
|
return context
|
||||||
|
|
||||||
def get_object(self, queryset=None):
|
def get_object(self, queryset=None):
|
||||||
@@ -185,7 +189,7 @@ class ERB101HomeView(generic.ListView):
|
|||||||
|
|
||||||
class ERB101MineralPracticeView(generic.ListView):
|
class ERB101MineralPracticeView(generic.ListView):
|
||||||
model = Mineral
|
model = Mineral
|
||||||
template_name = 'three_d_viewer/minerals_practice.html'
|
template_name = 'three_d_viewer/erb101/minerals_practice.html'
|
||||||
|
|
||||||
def get_context_data(self, **kwargs):
|
def get_context_data(self, **kwargs):
|
||||||
context = super(ERB101MineralPracticeView, self).get_context_data(**kwargs)
|
context = super(ERB101MineralPracticeView, self).get_context_data(**kwargs)
|
||||||
@@ -196,11 +200,41 @@ class ERB101MineralPracticeView(generic.ListView):
|
|||||||
result = chain(result, child.active_101_samples)
|
result = chain(result, child.active_101_samples)
|
||||||
|
|
||||||
context['active_samples'] = sorted(result, key=attrgetter('name'))
|
context['active_samples'] = sorted(result, key=attrgetter('name'))
|
||||||
|
context['base_template'] = 'three_d_viewer/erb101/base.html'
|
||||||
return context
|
return context
|
||||||
|
|
||||||
|
class ERB101MineralDetailView(generic.DetailView):
|
||||||
|
"""
|
||||||
|
Add extra functionality for mineral details
|
||||||
|
"""
|
||||||
|
|
||||||
|
model = Mineral
|
||||||
|
template_name = 'three_d_viewer/erb101/mineral_detail.html'
|
||||||
|
|
||||||
|
parent_categories = Category.objects.filter(parent=None). \
|
||||||
|
filter(active=True).order_by("name")
|
||||||
|
|
||||||
|
def get_context_data(self, **kwargs):
|
||||||
|
context = super(ERB101MineralDetailView, self).get_context_data(**kwargs)
|
||||||
|
cat = Category.objects.get(name='Minerals')
|
||||||
|
result = cat.active_samples
|
||||||
|
|
||||||
|
for child in cat.active_children:
|
||||||
|
result = chain(result, child.active_samples)
|
||||||
|
|
||||||
|
context['active_samples'] = sorted(result, key=attrgetter('name'))
|
||||||
|
context['base_template'] = 'three_d_viewer/erb101/base.html'
|
||||||
|
return context
|
||||||
|
|
||||||
|
def get_object(self, queryset=None):
|
||||||
|
object = super(ERB101MineralDetailView, self).get_object()
|
||||||
|
object.viewed_count += 1
|
||||||
|
object.save()
|
||||||
|
return object
|
||||||
|
|
||||||
class ERB101RockPracticeView(generic.ListView):
|
class ERB101RockPracticeView(generic.ListView):
|
||||||
model = Sample
|
model = Sample
|
||||||
template_name = 'three_d_viewer/rock_practice.html'
|
template_name = 'three_d_viewer/erb101/rock_practice.html'
|
||||||
|
|
||||||
parent_categories = Category.objects.filter(parent=None). \
|
parent_categories = Category.objects.filter(parent=None). \
|
||||||
filter(active=True).order_by("name")
|
filter(active=True).order_by("name")
|
||||||
@@ -218,3 +252,41 @@ class ERB101RockPracticeView(generic.ListView):
|
|||||||
context['base_template'] = 'three_d_viewer/erb101/base.html'
|
context['base_template'] = 'three_d_viewer/erb101/base.html'
|
||||||
return context
|
return context
|
||||||
|
|
||||||
|
|
||||||
|
class ERB101RockDetailView(generic.DetailView):
|
||||||
|
model = Sample
|
||||||
|
template_name = 'three_d_viewer/erb101/rock_detail.html'
|
||||||
|
|
||||||
|
parent_categories = Category.objects.filter(parent=None). \
|
||||||
|
filter(active=True).order_by("name")
|
||||||
|
|
||||||
|
|
||||||
|
def get_context_data(self, **kwargs):
|
||||||
|
context = super(ERB101RockDetailView, self).get_context_data(**kwargs)
|
||||||
|
cat = Category.objects.get(name='Rocks')
|
||||||
|
result = cat.active_samples
|
||||||
|
|
||||||
|
for child in cat.active_children:
|
||||||
|
result = chain(result, child.active_samples)
|
||||||
|
|
||||||
|
context['active_samples'] = sorted(result, key=attrgetter('name'))
|
||||||
|
context['base_template'] = 'three_d_viewer/erb101/base.html'
|
||||||
|
return context
|
||||||
|
|
||||||
|
def get_object(self, queryset=None):
|
||||||
|
object = super(ERB101RockDetailView, self).get_object()
|
||||||
|
object.viewed_count += 1
|
||||||
|
object.save()
|
||||||
|
return object
|
||||||
|
|
||||||
|
class TheoryTemplateView(generic.TemplateView):
|
||||||
|
def get_context_data(self, **kwargs):
|
||||||
|
context = super(TheoryTemplateView, self).get_context_data(**kwargs)
|
||||||
|
context['base_template'] = 'three_d_viewer/base.html'
|
||||||
|
return context
|
||||||
|
|
||||||
|
class ERB101TheoryTemplateView(generic.TemplateView):
|
||||||
|
def get_context_data(self, **kwargs):
|
||||||
|
context = super(ERB101TheoryTemplateView, self).get_context_data(**kwargs)
|
||||||
|
context['base_template'] = 'three_d_viewer/erb101/base.html'
|
||||||
|
return context
|
||||||
Reference in New Issue
Block a user