Add creating and basic editing of translation

This commit is contained in:
Thelonius Kort
2023-01-04 14:42:13 +01:00
parent f4b5abef5a
commit d589d84b40
15 changed files with 235 additions and 47 deletions

View File

@ -24,7 +24,7 @@ defmodule Outlook.Translations.Translation do
def changeset(translation, attrs) do
translation
|> cast(attrs, [:lang, :title, :teaser, :date, :public, :unauthorized, :article_id])
|> cast(attrs, [:content], force_changes: true)
|> cast(attrs, [:content])
|> validate_required([:lang, :title, :content, :date, :public, :unauthorized, :article_id])
|> unique_constraint([:lang, :article_id],
message: "translation for this language already exists",