Skip to content

Commit

Permalink
Merge pull request #489 from digitalfabrik/example-sentence
Browse files Browse the repository at this point in the history
Add possibility to set example sentence
  • Loading branch information
timobrembeck committed Jul 18, 2023
2 parents 50ab75a + 22f51eb commit 5da7d3f
Show file tree
Hide file tree
Showing 14 changed files with 2,577 additions and 1,269 deletions.
2 changes: 2 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
UNRELEASED
----------

* [ [#478](https://github.com/digitalfabrik/lunes-cms/issues/478) ] Add possibility to set example sentence


2023.5.0
--------
Expand Down
1 change: 1 addition & 0 deletions lunes_cms/api/v1/serializers/document_serializer.py
Original file line number Diff line number Diff line change
Expand Up @@ -28,4 +28,5 @@ class Meta:
"word_type",
"alternatives",
"document_image",
"example_sentence",
)
3 changes: 3 additions & 0 deletions lunes_cms/cms/fixtures/test_data.json
Original file line number Diff line number Diff line change
Expand Up @@ -103,6 +103,7 @@
"word": "Schere",
"article": 2,
"audio": "audio/schere.mp3",
"example_sentence": "Die Schnur mit einer Schere zerschneiden.",
"creation_date": "2021-04-13T15:58:10.468Z",
"created_by": null,
"creator_is_admin": true
Expand Down Expand Up @@ -844,6 +845,7 @@
"word": "Abdeckfolie",
"article": 2,
"audio": "audio/abdeckfolie.mp3",
"example_sentence": "Die Buchsenleiste wurde mit einer Abdeckfolie abgeklebt, um das Beschlagen der Kontakte im Steckbereich während des Lötvorgangs zu vermeiden.",
"creation_date": "2021-05-27T14:36:58.219Z",
"created_by": null,
"creator_is_admin": true
Expand Down Expand Up @@ -7955,6 +7957,7 @@
"word": "Eurostecker",
"article": 1,
"audio": "audio/eurostecker.mp3",
"example_sentence": "Das Netzteil ist versehen mit einem Eurostecker für den direkten Anschluss an eine Schuko-Steckdose und verfügt über eine 3m lange Zuleitung.",
"creation_date": "2021-08-26T10:25:22.812Z",
"created_by": null,
"creator_is_admin": true
Expand Down
17 changes: 17 additions & 0 deletions lunes_cms/cms/migrations/0011_document_example_sentence.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
# Generated by Django 3.2.18 on 2023-07-16 11:02

from django.db import migrations, models


class Migration(migrations.Migration):
dependencies = [
("cms", "0010_sponsor_url"),
]

operations = [
migrations.AddField(
model_name="document",
name="example_sentence",
field=models.TextField(blank=True, verbose_name="example sentence"),
),
]
1 change: 1 addition & 0 deletions lunes_cms/cms/models/document.py
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,7 @@ class Document(models.Model):
null=True,
verbose_name=_("audio"),
)
example_sentence = models.TextField(verbose_name=_("example sentence"), blank=True)
creation_date = models.DateTimeField(
auto_now_add=True, verbose_name=_("creation date")
)
Expand Down
16 changes: 10 additions & 6 deletions lunes_cms/locale/de/LC_MESSAGES/django.po
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ msgid ""
msgstr ""
"Project-Id-Version: PACKAGE VERSION\n"
"Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2023-05-03 14:15+0000\n"
"POT-Creation-Date: 2023-07-16 11:54+0000\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"
Expand Down Expand Up @@ -41,8 +41,8 @@ msgstr "Modulgruppen"
msgid "training sets"
msgstr "Module"

#: cms/admin.py:35 cms/forms.py:54 cms/forms.py:55 cms/models/document.py:114
#: cms/models/document.py:115
#: cms/admin.py:35 cms/forms.py:54 cms/forms.py:55 cms/models/document.py:115
#: cms/models/document.py:116
msgid "vocabulary"
msgstr "Vokabeln"

Expand Down Expand Up @@ -228,12 +228,12 @@ msgstr "Beschreibung"
msgid "icon"
msgstr "Icon"

#: cms/models/discipline.py:34 cms/models/document.py:58
#: cms/models/discipline.py:34 cms/models/document.py:59
#: cms/models/training_set.py:39
msgid "created by"
msgstr "Erstellt von"

#: cms/models/discipline.py:37 cms/models/document.py:62
#: cms/models/discipline.py:37 cms/models/document.py:63
#: cms/models/training_set.py:41
msgid "admin"
msgstr "Admin"
Expand All @@ -250,7 +250,11 @@ msgstr "Wortart"
msgid "word"
msgstr "Wort"

#: cms/models/document.py:52 cms/models/group_api_key.py:66
#: cms/models/document.py:51
msgid "example sentence"
msgstr "Beispielsatz"

#: cms/models/document.py:53 cms/models/group_api_key.py:66
msgid "creation date"
msgstr "Erstellt am"

Expand Down
1 change: 1 addition & 0 deletions setup.cfg
Original file line number Diff line number Diff line change
Expand Up @@ -76,6 +76,7 @@ test =
pytest-circleci-parallelized==0.1.0
pytest-cov==4.1.0
pytest-django==4.5.2
pytest-icdiff==0.6
pytest-xdist==3.2.1

[bumpver]
Expand Down
18 changes: 12 additions & 6 deletions tests/api/expected-results/documents_by_training_set_108.json
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,8 @@
"id": 1370,
"image": "http://testserver/media/images/dachreling.jpg"
}
]
],
"example_sentence": ""
},
{
"id": 1735,
Expand All @@ -25,7 +26,8 @@
"id": 1372,
"image": "http://testserver/media/images/fahrzeugfront.jpg"
}
]
],
"example_sentence": ""
},
{
"id": 1736,
Expand All @@ -39,7 +41,8 @@
"id": 1373,
"image": "http://testserver/media/images/fahrzeugheck.jpg"
}
]
],
"example_sentence": ""
},
{
"id": 1815,
Expand All @@ -53,7 +56,8 @@
"id": 1463,
"image": "http://testserver/media/images/fuhrungslenker.jpg"
}
]
],
"example_sentence": ""
},
{
"id": 1739,
Expand All @@ -67,7 +71,8 @@
"id": 1377,
"image": "http://testserver/media/images/kotflugel.jpg"
}
]
],
"example_sentence": ""
},
{
"id": 1744,
Expand All @@ -81,6 +86,7 @@
"id": 1382,
"image": "http://testserver/media/images/schweller.jpg"
}
]
],
"example_sentence": ""
}
]
21 changes: 14 additions & 7 deletions tests/api/expected-results/documents_by_training_set_7.json
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,8 @@
"id": 764,
"image": "http://testserver/media/images/elektroinstallation.jpg"
}
]
],
"example_sentence": ""
},
{
"id": 1247,
Expand All @@ -25,7 +26,8 @@
"id": 769,
"image": "http://testserver/media/images/eurostecker.jpg"
}
]
],
"example_sentence": "Das Netzteil ist versehen mit einem Eurostecker für den direkten Anschluss an eine Schuko-Steckdose und verfügt über eine 3m lange Zuleitung."
},
{
"id": 1264,
Expand All @@ -44,7 +46,8 @@
"id": 787,
"image": "http://testserver/media/images/kuparohr.jpg"
}
]
],
"example_sentence": ""
},
{
"id": 1277,
Expand All @@ -58,7 +61,8 @@
"id": 811,
"image": "http://testserver/media/images/phasenprufer.jpg"
}
]
],
"example_sentence": ""
},
{
"id": 1297,
Expand All @@ -72,7 +76,8 @@
"id": 829,
"image": "http://testserver/media/images/schaltplan.jpg"
}
]
],
"example_sentence": ""
},
{
"id": 117,
Expand All @@ -91,7 +96,8 @@
"id": 122,
"image": "http://testserver/media/images/spannungsprufer.jpg"
}
]
],
"example_sentence": ""
},
{
"id": 284,
Expand All @@ -110,6 +116,7 @@
"id": 308,
"image": "http://testserver/media/images/zweipolige-phasenprufer.jpg"
}
]
],
"example_sentence": ""
}
]

0 comments on commit 5da7d3f

Please sign in to comment.