summaryrefslogtreecommitdiff
path: root/archaeological_context_records
diff options
context:
space:
mode:
Diffstat (limited to 'archaeological_context_records')
-rw-r--r--archaeological_context_records/migrations/0049_auto_20190711_1401.py75
-rw-r--r--archaeological_context_records/templates/ishtar/sheet_contextrecord.html10
-rw-r--r--archaeological_context_records/tests.py24
-rw-r--r--archaeological_context_records/urls.py2
-rw-r--r--archaeological_context_records/views.py8
5 files changed, 97 insertions, 22 deletions
diff --git a/archaeological_context_records/migrations/0049_auto_20190711_1401.py b/archaeological_context_records/migrations/0049_auto_20190711_1401.py
new file mode 100644
index 000000000..7b9ec7f28
--- /dev/null
+++ b/archaeological_context_records/migrations/0049_auto_20190711_1401.py
@@ -0,0 +1,75 @@
+# -*- coding: utf-8 -*-
+# Generated by Django 1.11.18 on 2019-07-11 14:01
+from __future__ import unicode_literals
+
+from django.db import migrations, models
+import ishtar_common.models
+
+
+class Migration(migrations.Migration):
+
+ dependencies = [
+ ('archaeological_context_records', '0048_auto_20190704_1526'),
+ ]
+
+ operations = [
+ migrations.RemoveField(
+ model_name='contextrecord',
+ name='relation_bitmap_image_bellow',
+ ),
+ migrations.RemoveField(
+ model_name='contextrecord',
+ name='relation_dot_bellow',
+ ),
+ migrations.RemoveField(
+ model_name='contextrecord',
+ name='relation_image_bellow',
+ ),
+ migrations.RemoveField(
+ model_name='historicalcontextrecord',
+ name='relation_bitmap_image_bellow',
+ ),
+ migrations.RemoveField(
+ model_name='historicalcontextrecord',
+ name='relation_dot_bellow',
+ ),
+ migrations.RemoveField(
+ model_name='historicalcontextrecord',
+ name='relation_image_bellow',
+ ),
+ migrations.AddField(
+ model_name='contextrecord',
+ name='relation_bitmap_image_below',
+ field=models.FileField(blank=True, help_text='La taille maximale supportée pour le fichier est de 100 Mo.', null=True, upload_to=ishtar_common.models.get_image_path, verbose_name='Generated below relation image (PNG)'),
+ ),
+ migrations.AddField(
+ model_name='contextrecord',
+ name='relation_dot_below',
+ field=models.FileField(blank=True, help_text='La taille maximale supportée pour le fichier est de 100 Mo.', null=True, upload_to=ishtar_common.models.get_image_path, verbose_name='Generated below relation image (DOT)'),
+ ),
+ migrations.AddField(
+ model_name='contextrecord',
+ name='relation_image_below',
+ field=models.FileField(blank=True, help_text='La taille maximale supportée pour le fichier est de 100 Mo.', null=True, upload_to=ishtar_common.models.get_image_path, verbose_name='Generated below relation image (SVG)'),
+ ),
+ migrations.AddField(
+ model_name='historicalcontextrecord',
+ name='relation_bitmap_image_below',
+ field=models.TextField(blank=True, help_text='La taille maximale supportée pour le fichier est de 100 Mo.', max_length=100, null=True, verbose_name='Generated below relation image (PNG)'),
+ ),
+ migrations.AddField(
+ model_name='historicalcontextrecord',
+ name='relation_dot_below',
+ field=models.TextField(blank=True, help_text='La taille maximale supportée pour le fichier est de 100 Mo.', max_length=100, null=True, verbose_name='Generated below relation image (DOT)'),
+ ),
+ migrations.AddField(
+ model_name='historicalcontextrecord',
+ name='relation_image_below',
+ field=models.TextField(blank=True, help_text='La taille maximale supportée pour le fichier est de 100 Mo.', max_length=100, null=True, verbose_name='Generated below relation image (SVG)'),
+ ),
+ migrations.AlterField(
+ model_name='relationtype',
+ name='logical_relation',
+ field=models.CharField(blank=True, choices=[('above', 'Au-dessus'), ('below', 'Below'), ('equal', 'Égal')], max_length=10, null=True, verbose_name='Relation logique'),
+ ),
+ ]
diff --git a/archaeological_context_records/templates/ishtar/sheet_contextrecord.html b/archaeological_context_records/templates/ishtar/sheet_contextrecord.html
index 0643a40fc..811a80fc4 100644
--- a/archaeological_context_records/templates/ishtar/sheet_contextrecord.html
+++ b/archaeological_context_records/templates/ishtar/sheet_contextrecord.html
@@ -276,11 +276,11 @@
{% include "ishtar/blocks/sheet_relation_image.html" %}
{% endwith %}{% endwith %}{% endwith %}{% endwith %}
- <h3>{% trans "Diagram of statigraphic relations - bellow" %}</h3>
- {% with relation_type="bellow" %}
- {% with relation_image=item.relation_image_bellow %}
- {% with relation_png=item.relation_bitmap_image_bellow %}
- {% with relation_dot=item.relation_dot_bellow %}
+ <h3>{% trans "Diagram of statigraphic relations - below" %}</h3>
+ {% with relation_type="below" %}
+ {% with relation_image=item.relation_image_below %}
+ {% with relation_png=item.relation_bitmap_image_below %}
+ {% with relation_dot=item.relation_dot_below %}
{% include "ishtar/blocks/sheet_relation_image.html" %}
{% endwith %}{% endwith %}{% endwith %}{% endwith %}
diff --git a/archaeological_context_records/tests.py b/archaeological_context_records/tests.py
index 9e16603de..496613f86 100644
--- a/archaeological_context_records/tests.py
+++ b/archaeological_context_records/tests.py
@@ -875,8 +875,8 @@ class GraphGenerationTest(ContextRecordInit, TestCase):
def setUp(self):
self.sym_rel_type, __ = models.RelationType.objects.get_or_create(
symmetrical=True, txt_idx='sym', logical_relation='equal')
- self.rel_type_bellow, __ = models.RelationType.objects.get_or_create(
- symmetrical=False, txt_idx='bellow', logical_relation='bellow')
+ self.rel_type_below, __ = models.RelationType.objects.get_or_create(
+ symmetrical=False, txt_idx='below', logical_relation='below')
self.rel_type_above, __ = models.RelationType.objects.get_or_create(
symmetrical=False, txt_idx='above', logical_relation='above')
self.create_context_record({"label": u"CR 1"})
@@ -905,17 +905,17 @@ class GraphGenerationTest(ContextRecordInit, TestCase):
models.RecordRelations.objects.create(
left_record=cr_1, right_record=cr_2,
- relation_type=self.rel_type_bellow)
+ relation_type=self.rel_type_below)
models.RecordRelations.objects.create(
left_record=cr_3, right_record=cr_2,
relation_type=self.rel_type_above)
models.RecordRelations.objects.create(
left_record=cr_3, right_record=cr_4,
- relation_type=self.rel_type_bellow)
+ relation_type=self.rel_type_below)
models.RecordRelations.objects.create(
left_record=cr_1B, right_record=cr_2B,
- relation_type=self.rel_type_bellow)
+ relation_type=self.rel_type_below)
models.RecordRelations.objects.create(
left_record=cr_3B, right_record=cr_2B,
relation_type=self.rel_type_above)
@@ -924,7 +924,7 @@ class GraphGenerationTest(ContextRecordInit, TestCase):
relation_type=self.rel_type_above)
models.RecordRelations.objects.create(
left_record=cr_2D, right_record=cr_3B,
- relation_type=self.rel_type_bellow)
+ relation_type=self.rel_type_below)
def test_gen_relation(self):
generate_relation_graph(self.cr_2)
@@ -978,13 +978,13 @@ class GraphGenerationTest(ContextRecordInit, TestCase):
self.assertNotIn('"CR 2C"', content)
self.assertNotIn('"CR 2D"', content)
- def test_gen_relation_bellow(self):
- generate_relation_graph(self.cr_2, render_bellow=False)
+ def test_gen_relation_below(self):
+ generate_relation_graph(self.cr_2, render_below=False)
cr_2 = models.ContextRecord.objects.get(pk=self.cr_2.pk)
- self.assertIsNotNone(cr_2.relation_image_bellow)
- self.assertIsNotNone(cr_2.relation_bitmap_image_bellow)
- self.assertIsNotNone(cr_2.relation_dot_bellow)
- content = open(cr_2.relation_dot_bellow.path).read()
+ self.assertIsNotNone(cr_2.relation_image_below)
+ self.assertIsNotNone(cr_2.relation_bitmap_image_below)
+ self.assertIsNotNone(cr_2.relation_dot_below)
+ content = open(cr_2.relation_dot_below.path).read()
self.assertNotIn('"CR 1"', content)
self.assertNotIn('"CR 1B"', content)
self.assertIn('"CR 2B"', content)
diff --git a/archaeological_context_records/urls.py b/archaeological_context_records/urls.py
index 96882e20d..0b46f4de8 100644
--- a/archaeological_context_records/urls.py
+++ b/archaeological_context_records/urls.py
@@ -54,7 +54,7 @@ urlpatterns = [
url(r'revert-contextrecord/(?P<pk>.+)/(?P<date>.+)$',
views.revert_contextrecord, name='revert-contextrecord'),
url(r'generate-relation-image-contextrecord/(?P<pk>.+)/('
- r'?P<type>(bellow)|(above)|(full))?',
+ r'?P<type>(below)|(above)|(full))?',
views.GenerateRelationImage.as_view(),
name='generate-relation-image-contextrecord'),
url(r'get-contextrecord/own/(?P<type>.+)?$', views.get_contextrecord,
diff --git a/archaeological_context_records/views.py b/archaeological_context_records/views.py
index e27aacb41..a1232b138 100644
--- a/archaeological_context_records/views.py
+++ b/archaeological_context_records/views.py
@@ -194,15 +194,15 @@ class GenerateRelationImage(IshtarMixin, LoginRequiredMixin, RedirectView):
self.item = self.model.objects.get(pk=kwargs['pk'])
except self.model.DoesNotExist:
raise Http404()
- render_above, render_bellow, full = True, True, False
+ render_above, render_below, full = True, True, False
if render_type == "above":
- render_bellow = False
- elif render_type == "bellow":
+ render_below = False
+ elif render_type == "below":
render_above = False
elif render_type == "full":
full = True
self.item.generate_relation_image(
- render_bellow=render_bellow, render_above=render_above, full=full)
+ render_below=render_below, render_above=render_above, full=full)
return super(GenerateRelationImage, self).get(request, *args, **kwargs)