From 1512962003ff50a0df129a10dd0c1434861ae2a1 Mon Sep 17 00:00:00 2001
From: Tor-Einar Skog <tor-einar.skog@bioforsk.no>
Date: Thu, 8 Jan 2015 17:50:12 +0100
Subject: [PATCH] Adding information app

---
 VIPSWeb/settings.py                           |   2 +
 VIPSWeb/urls.py                               |   2 +
 information/admin.py                          |  38 ++++++++++++++
 information/locale/bg/LC_MESSAGES/django.mo   | Bin 0 -> 421 bytes
 information/locale/bg/LC_MESSAGES/django.po   |  29 +++++++++++
 information/locale/bs/LC_MESSAGES/django.mo   | Bin 0 -> 495 bytes
 information/locale/bs/LC_MESSAGES/django.po   |  30 +++++++++++
 information/locale/hr/LC_MESSAGES/django.mo   | Bin 0 -> 493 bytes
 information/locale/hr/LC_MESSAGES/django.po   |  30 +++++++++++
 information/locale/nb/LC_MESSAGES/django.mo   | Bin 0 -> 677 bytes
 information/locale/nb/LC_MESSAGES/django.po   |  31 +++++++++++
 information/models.py                         |  49 ++++++++++++++++++
 information/templates/information/detail.html |  11 ++++
 information/templates/information/index.html  |   7 +++
 information/tests.py                          |   3 ++
 information/urls.py                           |  28 ++++++++++
 information/views.py                          |  37 +++++++++++++
 messages/views.py                             |   2 +-
 requirements.txt                              |   3 +-
 19 files changed, 300 insertions(+), 2 deletions(-)
 create mode 100644 information/admin.py
 create mode 100644 information/locale/bg/LC_MESSAGES/django.mo
 create mode 100644 information/locale/bg/LC_MESSAGES/django.po
 create mode 100644 information/locale/bs/LC_MESSAGES/django.mo
 create mode 100644 information/locale/bs/LC_MESSAGES/django.po
 create mode 100644 information/locale/hr/LC_MESSAGES/django.mo
 create mode 100644 information/locale/hr/LC_MESSAGES/django.po
 create mode 100644 information/locale/nb/LC_MESSAGES/django.mo
 create mode 100644 information/locale/nb/LC_MESSAGES/django.po
 create mode 100644 information/models.py
 create mode 100644 information/templates/information/detail.html
 create mode 100644 information/templates/information/index.html
 create mode 100644 information/tests.py
 create mode 100644 information/urls.py
 create mode 100644 information/views.py

diff --git a/VIPSWeb/settings.py b/VIPSWeb/settings.py
index 6b8a5c9d..bc667ae5 100644
--- a/VIPSWeb/settings.py
+++ b/VIPSWeb/settings.py
@@ -131,9 +131,11 @@ INSTALLED_APPS = (
     'django.contrib.admin',
     # Uncomment the next line to enable admin documentation:
     # 'django.contrib.admindocs',
+    'tinymce',
     'forecasts',
     'messages',
     'organisms',
+    'information',
     'VIPSWeb'
 )
 
diff --git a/VIPSWeb/urls.py b/VIPSWeb/urls.py
index 472f81d8..e0bb25f3 100644
--- a/VIPSWeb/urls.py
+++ b/VIPSWeb/urls.py
@@ -43,9 +43,11 @@ urlpatterns = patterns('',
     url(r'^forecasts/', include('forecasts.urls', namespace = "forecasts")),
     url(r'^messages/', include('messages.urls', namespace = "messages")),
     url(r'^organisms/', include('organisms.urls', namespace = "organisms")),
+    url(r'^information/', include('information.urls', namespace = "information")),
     
     # Uncomment the next line to enable the admin:
     url(r'^admin/', include(admin.site.urls)),
+    url(r'^tinymce/', include('tinymce.urls')),
     # Static serving of media files
     url(r'^media/(?P<path>.*)$', 'django.views.static.serve', {'document_root': settings.MEDIA_ROOT}),
     # Enabling translation in JavaScript files
diff --git a/information/admin.py b/information/admin.py
new file mode 100644
index 00000000..a42af2da
--- /dev/null
+++ b/information/admin.py
@@ -0,0 +1,38 @@
+#
+# Copyright (c) 2014 Bioforsk <http://www.bioforsk.no/>. 
+# 
+# This file is part of VIPSWeb.
+# VIPSWeb is free software: you can redistribute it and/or modify
+# it under the terms of the Bioforsk Open Source License as published by 
+# Bioforsk, either version 1 of the License, or (at your option) any
+# later version.
+# 
+# VIPSWeb is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+# Bioforsk Open Source License for more details.
+#
+# You should have received a copy of the Bioforsk Open Source License
+# along with VIPSWeb.  If not, see <http://www.bioforsk.no/licenses/>.
+# 
+
+from django.contrib import admin
+from information.models import Information, InformationLocale
+# Register your models here.
+class InformationLocaleInline(admin.TabularInline):
+    model = InformationLocale
+    fields = ['language_code', 'headline', 'lead_paragraph', 'body']
+    """
+    # This actually works, but CSS overrides the size attribute...
+    def formfield_for_dbfield(self, db_field, **kwargs):
+        field = super(InformationLocaleInline, self).formfield_for_dbfield(db_field, **kwargs) # Get the default field
+        if db_field.name == "language_code": # Check if it's the one you want
+            field.widget.attrs['size'] = "2" # Poke in the new 
+        return field
+    """
+
+class InformationAdmin(admin.ModelAdmin):
+    inlines = [
+        InformationLocaleInline,
+    ]
+admin.site.register(Information, InformationAdmin)
\ No newline at end of file
diff --git a/information/locale/bg/LC_MESSAGES/django.mo b/information/locale/bg/LC_MESSAGES/django.mo
new file mode 100644
index 0000000000000000000000000000000000000000..a0586f48938da2dbd96baba9eb0ae0f86818006d
GIT binary patch
literal 421
zcmca7#4?qEfq{XMfq_AWfq_AVfq{XUfq_8>B*?(PV8Ot^kj==zU<p+N6=q-vD9X=D
zO)k;(OwkQXEh^5;&$ChpaCG)|bazz<a}5gi^!MWmN-fAQD$(^VPR~rybt+9S)(y$G
zQs4^k57BilN=+=u%+J$xNi0dVQZO<wG}SdQ)HSeBFf_L^G14|LG%(-_@YfAWEz1NM
z4pkTF>KLT!>#ytLsNmsm<?E>(<?rXp<&#)kq8n0_m{**WSdw34rQjCo<D=l`=<BLr
z<Lc|^>Eqz&;u7Q<9BjwslbDxYnwXxd8<LusYo*}h=;s~^a<Yw&k3&wTUVc$JLXDLI
zm#?R<E5d(<dInt1`FSO&c_q3bl?AC*3MHu(CHe(9iJ5uU3dtFXMa8KlwxJ<zx)um^
zAZMke7U{a?CFiGP=A~OHSR`eZa0TR)7A5BBy5$$;7F#Lg6@a<Lwno+p5T>n0o`RyS
Kf}y507Xtt!$8<*k

literal 0
HcmV?d00001

diff --git a/information/locale/bg/LC_MESSAGES/django.po b/information/locale/bg/LC_MESSAGES/django.po
new file mode 100644
index 00000000..060bf34a
--- /dev/null
+++ b/information/locale/bg/LC_MESSAGES/django.po
@@ -0,0 +1,29 @@
+# SOME DESCRIPTIVE TITLE.
+# Copyright (C) YEAR THE PACKAGE'S COPYRIGHT HOLDER
+# This file is distributed under the same license as the PACKAGE package.
+# FIRST AUTHOR <EMAIL@ADDRESS>, YEAR.
+#
+#, fuzzy
+msgid ""
+msgstr ""
+"Project-Id-Version: PACKAGE VERSION\n"
+"Report-Msgid-Bugs-To: \n"
+"POT-Creation-Date: 2015-01-08 17:42+0100\n"
+"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
+"Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
+"Language-Team: LANGUAGE <LL@li.org>\n"
+"Language: \n"
+"MIME-Version: 1.0\n"
+"Content-Type: text/plain; charset=UTF-8\n"
+"Content-Transfer-Encoding: 8bit\n"
+"Plural-Forms: nplurals=2; plural=(n != 1);\n"
+
+#: templates/information/index.html:3 templates/information/index.html.py:5
+msgid "Information"
+msgstr ""
+
+#: templates/information/index.html:6
+msgid ""
+"You haven't added any information pages yet. Please do so in the "
+"administration GUI."
+msgstr ""
diff --git a/information/locale/bs/LC_MESSAGES/django.mo b/information/locale/bs/LC_MESSAGES/django.mo
new file mode 100644
index 0000000000000000000000000000000000000000..510758a062cecb15d791cc5e54fb1719e1dcadf2
GIT binary patch
literal 495
zcmca7#4?qEfq{XMfq_AWfq_AVfq{XUfq_8>B*?(PV8Ot^u$7U4!4j$lD$KwTP?VpQ
znp~pmnW7t(T2!2wpJ$~I;OOk_=<ccz<{A|2>F>uClv<EqRHEx!oSvDY>r|RvtQ(SV
zrN9;7AEN7Al$uzQnV+ZYl30>zrC?-WXsT;qsB2)MU}$b-Vx(<gXkfq<;IA8$T9yei
z9I7tT)iFrd*I(DgQNhFC%GXmn%HPkG%O|n8L^q@;F|Rl$u_V99O2IAE$49}>(brYM
z#?{x+)5pQl#U;o!IM|NMCowO*G%-C@HzYMN*Gj?1(a${;<YXHkABUVwz5Jqdgc>Ua
zE?-YySA_oz^$fV2^Ycnl^Gb9>DhpDr6iQMnO7shI5;OCx6_PU&i;7cAY(qobbS)6-
zK+Z}_Ez)((OU_Tp%uBaYut>@*;R?tpElSMMb;~cxEw)m~D*$tgZH=uJAWU10JXJ#j
zTU$c~H8lkg(?HSI&``l%!9c+Z%(t^Of=Sufnt+&K9R@ar1`0JbU?m22wnhe;3ib+y
M3RVh6n$}zl0F)AgjsO4v

literal 0
HcmV?d00001

diff --git a/information/locale/bs/LC_MESSAGES/django.po b/information/locale/bs/LC_MESSAGES/django.po
new file mode 100644
index 00000000..b75ef886
--- /dev/null
+++ b/information/locale/bs/LC_MESSAGES/django.po
@@ -0,0 +1,30 @@
+# SOME DESCRIPTIVE TITLE.
+# Copyright (C) YEAR THE PACKAGE'S COPYRIGHT HOLDER
+# This file is distributed under the same license as the PACKAGE package.
+# FIRST AUTHOR <EMAIL@ADDRESS>, YEAR.
+#
+#, fuzzy
+msgid ""
+msgstr ""
+"Project-Id-Version: PACKAGE VERSION\n"
+"Report-Msgid-Bugs-To: \n"
+"POT-Creation-Date: 2015-01-08 17:42+0100\n"
+"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
+"Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
+"Language-Team: LANGUAGE <LL@li.org>\n"
+"Language: \n"
+"MIME-Version: 1.0\n"
+"Content-Type: text/plain; charset=UTF-8\n"
+"Content-Transfer-Encoding: 8bit\n"
+"Plural-Forms: nplurals=3; plural=(n%10==1 && n%100!=11 ? 0 : n%10>=2 && n"
+"%10<=4 && (n%100<10 || n%100>=20) ? 1 : 2);\n"
+
+#: templates/information/index.html:3 templates/information/index.html.py:5
+msgid "Information"
+msgstr ""
+
+#: templates/information/index.html:6
+msgid ""
+"You haven't added any information pages yet. Please do so in the "
+"administration GUI."
+msgstr ""
diff --git a/information/locale/hr/LC_MESSAGES/django.mo b/information/locale/hr/LC_MESSAGES/django.mo
new file mode 100644
index 0000000000000000000000000000000000000000..8212fbf1c5dd58a2b4c1c674cf0374e52da309f6
GIT binary patch
literal 493
zcmca7#4?qEfq{XMfq_AWfq_AVfq{XUfq_8>B*?(PV8Ot^u$hs8!4j$lD$KwTP?VpQ
znp~pmnW7t(T2!2wpJ$~I;OOk_=<ccz<{A|2>F>uClv<EqRHEx!oSvDY>r|RvtQ(SV
zrN9;7AEN7Al$uzQnV+ZYl30>zrC?-WXsT;qsB2)MU}$b-Vx(<gXkfq<;IA8$T9yei
z9I7tT)iFrd*I(DgQNhFC%GXmn%HPkG%O|n8L^q@;F|Rl$u_V99O2IAE$49}>(brYM
z#?{x+)5pQl#U;o!IM|NMCowO*G%-C@HzYMN*Gj?1(a${;<YXHkABUVwz5Jqdgc>Ua
zE?-YySA_oz^$fV2^Ycnl^Gb9>DhpDr6iQMnO7shI5;OCx6_PU&i;7cAY(qobbS)6-
zK+Z}_Ez)((OU_Tp%uBaYut>@*;R?tpElSMMb;~cxEw)m~D*$tgZH=uJAWYjlRYL<?
zTSEmkH3bmUK+)FFP{CfoK*0*kx3e{ZN!i$%fS4L!Wj2Ne3N<xgB?fl3Mh2P+_6mjy
KRtiSeTnqq=&VxGu

literal 0
HcmV?d00001

diff --git a/information/locale/hr/LC_MESSAGES/django.po b/information/locale/hr/LC_MESSAGES/django.po
new file mode 100644
index 00000000..f595021a
--- /dev/null
+++ b/information/locale/hr/LC_MESSAGES/django.po
@@ -0,0 +1,30 @@
+# SOME DESCRIPTIVE TITLE.
+# Copyright (C) YEAR THE PACKAGE'S COPYRIGHT HOLDER
+# This file is distributed under the same license as the PACKAGE package.
+# FIRST AUTHOR <EMAIL@ADDRESS>, YEAR.
+#
+#, fuzzy
+msgid ""
+msgstr ""
+"Project-Id-Version: PACKAGE VERSION\n"
+"Report-Msgid-Bugs-To: \n"
+"POT-Creation-Date: 2015-01-08 17:42+0100\n"
+"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
+"Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
+"Language-Team: LANGUAGE <LL@li.org>\n"
+"Language: \n"
+"MIME-Version: 1.0\n"
+"Content-Type: text/plain; charset=UTF-8\n"
+"Content-Transfer-Encoding: 8bit\n"
+"Plural-Forms: nplurals=3; plural=n%10==1 && n%100!=11 ? 0 : n%10>=2 && n"
+"%10<=4 && (n%100<10 || n%100>=20) ? 1 : 2;\n"
+
+#: templates/information/index.html:3 templates/information/index.html.py:5
+msgid "Information"
+msgstr ""
+
+#: templates/information/index.html:6
+msgid ""
+"You haven't added any information pages yet. Please do so in the "
+"administration GUI."
+msgstr ""
diff --git a/information/locale/nb/LC_MESSAGES/django.mo b/information/locale/nb/LC_MESSAGES/django.mo
new file mode 100644
index 0000000000000000000000000000000000000000..ac7c1bb2fc2f5b5e0cc997fff3c4b2201d4182e1
GIT binary patch
literal 677
zcmca7#4?qEfq{XUfq_AWfq}t<fq{XQfq}sXB*?(Pkifvez|FwGkjTKm5W>K~kjucp
zkj==za0n`{$Hc&p#lXN|#l*nC2-U*`H4n`7%uCBJ%1tcE%+F(p%r8~QNGwauQ!i0S
zOi4*iQAo_IRLDfAP$)=DPc2rcOfAt<2*^oIEKXHO$yX@OSIEp$D9K1wNKDDi%*!k;
zDFU0P;2!F!#}H7IpOu<iqU)KW8<tvBoSC0zr4Zog?Ct38su1QH6zu8m#}$-XkY7}y
z>sy?jnWF1dnqI6Ml5eHJ72qGD>s*uyHcZzgu_V<>!N|bSRM)^z*T6!-(A>(zNZY{B
zz<?{jUpFYVEE8lnR9&R2W00<|zpjg;f``AAucvmDzn?3YPhxS2Zb(sLUU5!hNq&))
zf?KGMkAk10ud9NMtFNP{kAtI&OOR`DupO6AVqSV_VtT4>NNQrPm4c6>pL;0C$u>Sd
z4mp{6`9<jnHC75-zMj6W2>%)C8E`r0=ar=9mFR|47NlA!l%!Ua=ojQ9X69KdBxfWR
z6{nWihK9K5S|HScoRyYZr0bfOoS%}Jmu{tCk(61&6_8U}l$fLImS2=xY^9J_0Ol6k
z8d)nqn6?^u3W~N0hMLw~4A96d&dSeYZ~?_-kwRv6cB(>7VtR=}NoI~hUVdsGEJ8u5
zii<N-Qi~K)^YRWa)l&#d&CAQlOfN1`NY6UFqevkowWK6fp)4~IDPqC8(u-2_ic^d8
LGD}KQOY|53vh&CZ

literal 0
HcmV?d00001

diff --git a/information/locale/nb/LC_MESSAGES/django.po b/information/locale/nb/LC_MESSAGES/django.po
new file mode 100644
index 00000000..4766aef7
--- /dev/null
+++ b/information/locale/nb/LC_MESSAGES/django.po
@@ -0,0 +1,31 @@
+# SOME DESCRIPTIVE TITLE.
+# Copyright (C) YEAR THE PACKAGE'S COPYRIGHT HOLDER
+# This file is distributed under the same license as the PACKAGE package.
+# FIRST AUTHOR <EMAIL@ADDRESS>, YEAR.
+#
+#, fuzzy
+msgid ""
+msgstr ""
+"Project-Id-Version: PACKAGE VERSION\n"
+"Report-Msgid-Bugs-To: \n"
+"POT-Creation-Date: 2015-01-08 17:42+0100\n"
+"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
+"Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
+"Language-Team: LANGUAGE <LL@li.org>\n"
+"Language: \n"
+"MIME-Version: 1.0\n"
+"Content-Type: text/plain; charset=UTF-8\n"
+"Content-Transfer-Encoding: 8bit\n"
+"Plural-Forms: nplurals=2; plural=(n != 1);\n"
+
+#: templates/information/index.html:3
+#: templates/information/index.html.py:5
+msgid "Information"
+msgstr "Informasjon"
+
+#: templates/information/index.html:6
+msgid ""
+"You haven't added any information pages yet. Please do so in the "
+"administration GUI."
+msgstr "Du har ikke lagt til noen informasjonssider ennå. Vennligst gjør dette via administrasjonsgrensesnittet."
+
diff --git a/information/models.py b/information/models.py
new file mode 100644
index 00000000..02dbdaa1
--- /dev/null
+++ b/information/models.py
@@ -0,0 +1,49 @@
+from django.db import models
+from django.conf import settings
+from django.utils import translation
+from tinymce import models as tinymce_models
+
+# Create your models here.
+
+class Information(models.Model):
+    def __unicode__(self):
+        return InformationLocale.get_heading_with_fallback(self.id)
+    parent_information = models.ForeignKey('self', blank=True, null=True, related_name='children')
+    illustration = models.ImageField(upload_to='images/information', blank=True)
+    
+class InformationLocale(models.Model):
+    information = models.ForeignKey(Information)
+    headline = models.CharField(max_length=200)
+    lead_paragraph = models.TextField()
+    body = tinymce_models.HTMLField()
+    language_code = models.CharField(max_length=2)
+    
+    @staticmethod
+    def get_information_locale_with_fallback(information_id, language_code=translation.get_language()):
+        # Try with user's preferred locale first
+        try:
+            return InformationLocale.objects.get(
+                                               information=Information.objects.get(pk=information_id),
+                                               language_code=language_code
+                                               )
+        except:
+            # Try with site's default language
+            try:
+                return InformationLocale.objects.get(
+                                                   information=Information.objects.get(pk=information_id),
+                                                   language_code=settings.LANGUAGE_CODE
+                                                   )
+            except:
+                # Try with English
+                try:
+                    return InformationLocale.objects.get(
+                                                       information=Information.objects.get(pk=information_id),
+                                                       language_code="en"
+                                                       )
+                except:
+                    # Use the first and best
+                    return InformationLocale.objects.all()[0]
+    
+    @staticmethod
+    def get_heading_with_fallback(information_id, language_code=translation.get_language()):
+        return InformationLocale.get_information_locale_with_fallback(information_id, language_code).headline
\ No newline at end of file
diff --git a/information/templates/information/detail.html b/information/templates/information/detail.html
new file mode 100644
index 00000000..b4f46c54
--- /dev/null
+++ b/information/templates/information/detail.html
@@ -0,0 +1,11 @@
+{% extends "base.html" %}
+{% load i18n staticfiles %}
+{% block title%}{{information_locale.headline}}{%endblock%}
+{% block content %}
+{% if information_locale.information.illustration %}
+<div class="messages_illustration"><img src="{{settings.MEDIA_URL}}{{information_locale.information.illustration}}" class="img-responsive"/></div>
+{% endif %}
+<h1>{{information_locale.headline}}</h1>
+<p class="lead">{{information_locale.lead_paragraph}}</p>
+{{information_locale.body | safe }}
+{% endblock %}
\ No newline at end of file
diff --git a/information/templates/information/index.html b/information/templates/information/index.html
new file mode 100644
index 00000000..997f1276
--- /dev/null
+++ b/information/templates/information/index.html
@@ -0,0 +1,7 @@
+{% extends "base.html" %}
+{% load i18n staticfiles %}
+{% block title%}{% trans "Information" %}{%endblock%}
+{% block content %}
+<h1>{% trans "Information" %}</h1>
+<p>{% trans "You haven't added any information pages yet. Please do so in the administration GUI." %}"</p>
+{% endblock %}
\ No newline at end of file
diff --git a/information/tests.py b/information/tests.py
new file mode 100644
index 00000000..7ce503c2
--- /dev/null
+++ b/information/tests.py
@@ -0,0 +1,3 @@
+from django.test import TestCase
+
+# Create your tests here.
diff --git a/information/urls.py b/information/urls.py
new file mode 100644
index 00000000..65788392
--- /dev/null
+++ b/information/urls.py
@@ -0,0 +1,28 @@
+#
+# Copyright (c) 2015 Bioforsk <http://www.bioforsk.no/>. 
+# 
+# This file is part of VIPSWeb.
+# VIPSWeb is free software: you can redistribute it and/or modify
+# it under the terms of the Bioforsk Open Source License as published by 
+# Bioforsk, either version 1 of the License, or (at your option) any
+# later version.
+# 
+# VIPSWeb is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+# Bioforsk Open Source License for more details.
+#
+# You should have received a copy of the Bioforsk Open Source License
+# along with VIPSWeb.  If not, see <http://www.bioforsk.no/licenses/>.
+# 
+
+from django.conf.urls import patterns, url
+
+from information import views
+
+urlpatterns = patterns('',
+    # ex: /messages/                   
+    url(r'^$', views.index, name='index'),
+    # ex: /messages/5/
+    url(r'^(?P<information_id>\d+)/$', views.detail, name='detail'),
+)
\ No newline at end of file
diff --git a/information/views.py b/information/views.py
new file mode 100644
index 00000000..e3eae166
--- /dev/null
+++ b/information/views.py
@@ -0,0 +1,37 @@
+#
+# Copyright (c) 2015 Bioforsk <http://www.bioforsk.no/>. 
+# 
+# This file is part of VIPSWeb.
+# VIPSWeb is free software: you can redistribute it and/or modify
+# it under the terms of the Bioforsk Open Source License as published by 
+# Bioforsk, either version 1 of the License, or (at your option) any
+# later version.
+# 
+# VIPSWeb is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+# Bioforsk Open Source License for more details.
+#
+# You should have received a copy of the Bioforsk Open Source License
+# along with VIPSWeb.  If not, see <http://www.bioforsk.no/licenses/>.
+# 
+
+from django.shortcuts import render
+from information.models import InformationLocale, Information
+
+
+def index(request):
+    # Check that root element exists
+    try:
+        root_information = Information.objects.get(parent_information=None)
+        return detail(request,root_information.id)
+    except:
+        # Fallback: Return an empty page
+        context = {}
+        return render(request, 'information/index.html', context)
+
+def detail(request, information_id):
+    information_locale = InformationLocale.get_information_locale_with_fallback(information_id)
+    
+    context = {'information_locale' : information_locale}
+    return render(request, 'information/detail.html', context)
\ No newline at end of file
diff --git a/messages/views.py b/messages/views.py
index 254c38e1..36cb0618 100644
--- a/messages/views.py
+++ b/messages/views.py
@@ -16,7 +16,7 @@
 # along with VIPSWeb.  If not, see <http://www.bioforsk.no/licenses/>.
 # 
 
-from django.shortcuts import render, get_object_or_404
+from django.shortcuts import render
 from django.utils import translation
 
 from messages.models import Message
diff --git a/requirements.txt b/requirements.txt
index ba09eec4..bf385cb3 100644
--- a/requirements.txt
+++ b/requirements.txt
@@ -20,4 +20,5 @@
 # Read docs for how this works: http://www.pip-installer.org/en/latest/cookbook.html
 Django==1.6.1
 PIL==1.1.7
-requests==2.0.1
\ No newline at end of file
+requests==2.0.1
+django-tinymce
\ No newline at end of file
-- 
GitLab