Merge remote-tracking branch 'origin/master'

This commit is contained in:
Weblate 2018-05-19 17:54:00 +00:00
commit d5762d071f
8 changed files with 148 additions and 2 deletions

View File

@ -10,11 +10,16 @@ Kickass map for the Ojuso Project
## Install System Dependencies
### Debian
```bash
$ cat system-requirements.txt | sudo apt-get install -y
$ cat system-requirements-debian.txt | sudo apt-get install -y
```
Please note, the system dependencies have only been tested on Debian Stretch.
### Fedora
```bash
$ cat system-requirements-fedora.txt | sudo dnf install
## Bootstrap the Virtual Environment

View File

@ -0,0 +1,96 @@
# -*- coding: utf-8 -*-
# Generated by Django 1.11.6 on 2018-05-19 17:46
from __future__ import unicode_literals
from django.db import migrations, models
import multiselectfield.db.fields
class Migration(migrations.Migration):
dependencies = [
('map', '0058_auto_20180429_2205'),
]
operations = [
migrations.AlterField(
model_name='casestudy',
name='biomass_detail',
field=models.CharField(blank=True, default=None, help_text='If you selected biogas or biomass, please describe the feedstock (where the fuel came from e.g. corn, algae, anaerobic digestion, commercial waste etc)', max_length=200, null=True, verbose_name='Description of feedstock'),
),
migrations.AlterField(
model_name='casestudy',
name='community_voices',
field=models.TextField(blank=True, default=None, help_text='Add any direct quotes from members of the community that relate to this project', null=True, verbose_name='Community Voices'),
),
migrations.AlterField(
model_name='casestudy',
name='energy_customers',
field=models.TextField(blank=True, default=None, help_text="List any wholesale energy customers that take energy from the development. E.g. 'national grids' or private energy suppliers.", null=True, verbose_name='Energy consumers'),
),
migrations.AlterField(
model_name='casestudy',
name='entry_name',
field=models.CharField(help_text='Enter the name of the entry. This should usually be the name of project.', max_length=128, verbose_name='Entry Name'),
),
migrations.AlterField(
model_name='casestudy',
name='full_description',
field=models.TextField(help_text='Describe the project in full. Separate paragraphs with a new line Please add as much detail as you feel is necessary here.', verbose_name='Full Description'),
),
migrations.AlterField(
model_name='casestudy',
name='generation_technology',
field=models.CharField(blank=True, choices=[('Wind energy', (('SSWE', 'Small-scale (less than 500kW)'), ('LSWE', 'Large-scale (more than 500kW)'))), ('Photovoltaic electricity', (('SSPV', 'Small-scale (less than 500kW)'), ('LSPV', 'Large-scale (more than 500kW)'))), ('Hydroelectric', (('SHYD', 'Small-scale (less than 1MW)'), ('MHYD', 'Medium-scale (between 1-20MW)'), ('LHYD', 'Large-scale (more than 20MW - often not considered renewable)'))), ('STHE', 'Solar thermal electricity (e.g using parabolic reflectors)'), ('GEOT', 'Geothermal electricity'), ('BIOG', 'Biogas turbine'), ('OTHB', 'Other biomass (including liquid/solid biofuel)'), ('OTHR', 'Other (tidal, wave etc)')], default=None, help_text='Select the type of renewable energy generation that most applies to this case study.', max_length=4, null=True, verbose_name='Generation technology'),
),
migrations.AlterField(
model_name='casestudy',
name='generation_technology_other',
field=models.CharField(blank=True, default=None, help_text='If you selected other, please specify the generation technology (e.g. tidal, wave etc)', max_length=200, null=True, verbose_name='Other generation type'),
),
migrations.AlterField(
model_name='casestudy',
name='land_ownership',
field=models.CharField(choices=[('PRI', 'Private Land'), ('PUB', 'Public Land'), ('COM', 'Community Land'), ('OTH', 'Other')], help_text='What type of ownership does the land fall under?', max_length=3, verbose_name='Land ownership'),
),
migrations.AlterField(
model_name='casestudy',
name='land_ownership_details',
field=models.CharField(blank=True, help_text="Please specify details about land ownership if you chose 'other'", max_length=256, null=True, verbose_name='Land ownership details'),
),
migrations.AlterField(
model_name='casestudy',
name='participation_mechanisms',
field=models.TextField(blank=True, default=None, help_text='e.g. direct action, local referendums, legal cases, letters or petitions etc', null=True, verbose_name='What mechanisms of participation have been used?'),
),
migrations.AlterField(
model_name='casestudy',
name='power_technology',
field=models.CharField(blank=True, choices=[('PT', 'Power transmission (grid lines, substations etc)'), ('ES', 'Energy storage (pumped storage, compressed air, battery systems etc'), ('OT', 'Others')], default=None, help_text='Select the related energy technology.', max_length=2, null=True, verbose_name='Power technology'),
),
migrations.AlterField(
model_name='casestudy',
name='project_status',
field=models.CharField(choices=[('EXSTNG', 'Existing Project'), ('UCONST', 'Under Construction'), ('PROJCD', 'Projected Project')], help_text='What is the status of the current project?', max_length=6, verbose_name='Status of Project'),
),
migrations.AlterField(
model_name='casestudy',
name='sector_of_economy',
field=models.CharField(choices=[('RN', 'Renewable Energy Generation'), ('PG', 'Power Grids'), ('SM', 'Supply of Minerals')], help_text='Which sector of the renewable energy economy is most relevant?', max_length=3, verbose_name='Sector of economy'),
),
migrations.AlterField(
model_name='casestudy',
name='shareholders',
field=models.TextField(blank=True, default=None, help_text="List shareholders of the project owners you've just listed. Separate with a comma.", null=True, verbose_name='Shareholders of the project owners'),
),
migrations.AlterField(
model_name='casestudy',
name='technical_or_economic_details',
field=models.TextField(blank=True, default=None, help_text='Specify any additional technical or economic details relating to the project.', null=True, verbose_name='Additional technical or economic details'),
),
migrations.AlterField(
model_name='casestudy',
name='type_of_ecosystem',
field=multiselectfield.db.fields.MultiSelectField(blank=True, choices=[('MARINE', 'Marine (e.g. Ocean, Sea)'), ('FRESH', 'Freshwater (e.g. Freshwater, Lake)'), ('FOREST', 'Forest/Jungle'), ('AGRI', 'Agricultural Land'), ('GRASS', 'Grassland'), ('DESERT', 'Desert (Tundra, Ice or Sand)'), ('WETLND', 'Wetland (Marsh, Mangrove, Peat Soil)'), ('URBAN', 'Urban')], default=None, help_text='Select the most relevant type(s).', max_length=56, null=True, verbose_name='Type(s) of ecosystem'),
),
]

View File

@ -0,0 +1,8 @@
$(function() {
$('#id-language-dropdown').change(function() {
window.location = ('/set_language/'
+ $('#id-language-dropdown').find(':selected').val()
+ "?from=" + encodeURI(window.location.href)
);
})
});

View File

@ -78,6 +78,22 @@
{% endfor %}
</ul>
<ul class="nav navbar-nav navbar-right">
<li class="form-group">
<form class="navbar-form navbar-left">
{# Global language selection dropdown #}
{% get_available_languages as LANGUAGES %}
{% get_current_language as LANGUAGE_CODE %}
<select id="id-language-dropdown" name="language-dropdown">
{% for language in LANGUAGES %}
{% if language.0 == LANGUAGE_CODE %}
<option value="{{ language.0 }}" selected="selected">{{ language.0|language_name_local|title }}</option>
{% else %}
<option value="{{ language.0 }}">{{ language.0|language_name_local|title }}</option>
{% endif %}
{% endfor %}
</select>
</form>
</li>
{% if user.is_authenticated %}
<a class="btn btn-primary navbar-btn" href="{% url 'create' %}"><i class="fa fa-plus" aria-hidden="true"></i> New Case Study</a>
<li class="dropdown">
@ -134,6 +150,7 @@
{# CDN Javascript #}
<script src="https://cdnjs.cloudflare.com/ajax/libs/jquery/3.0.0/jquery.min.js" integrity="sha256-JmvOoLtYsmqlsWxa7mDSLMwa6dZ9rrIdtrrVYRnDRH0=" crossorigin="anonymous"></script>
<script src="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/js/bootstrap.min.js" integrity="sha384-Tc5IQib027qvyjSMfHjOMaLkfuWVxZxUPnCJA7l2mCWNIpG9mGCD8wGNIcPD7Txa" crossorigin="anonymous"></script>
<script src="{% static "map/language.js" %}"></script>
{% block scripts %}{% endblock %}
</html>

View File

@ -22,6 +22,8 @@ from apps.map.models import CaseStudy
from rest_framework import routers, serializers, viewsets
from rest_framework_gis import serializers as gis_serializers
from .views import LanguageDropdownView
class UserSerializer(serializers.HyperlinkedModelSerializer):
class Meta:
model = User
@ -69,6 +71,7 @@ urlpatterns = [
url(r'^avatar/', include('avatar.urls')),
url(r'^cas/', include('cas_server.urls', namespace='cas_server')),
url(r'^files/', include('apps.files.urls')),
url(r'^set_language/(?P<language>[^/]+)$', LanguageDropdownView.as_view()),
# url(r'^contact/', include('apps.contact.urls'), name="contact"),
]

13
ojusomap/views.py Normal file
View File

@ -0,0 +1,13 @@
from django.utils import translation
from django.views.i18n import set_language
from django.views.generic import View
class LanguageDropdownView(View):
def get(self, request, *args, **kwargs):
lang_code = kwargs.get('language', None)
if lang_code is not None and translation.check_for_language(lang_code):
request.POST = request.POST.copy()
request.POST['language'] = lang_code
request.method = 'POST'
return set_language(request)

View File

@ -0,0 +1,4 @@
gdal-devel
python3-gdal
postgresql-devel
postgis