pep-un/Oxomium

Add a field to precise the language of the policy

Opened this issue · 1 comments

it may be usefull in international context, to display if the policy is writen in english or in a other language.

Some exemple code

import pycountry
from django.db import models

# Creat the list of languages with ISO 639-1 alpha 2 only
LANGUAGE_CHOICES = [
    (language.alpha_2, language.name) for language in pycountry.languages if hasattr(language, 'alpha_2')
]

class Document(models.Model):
    title = models.CharField(max_length=200)
    content = models.TextField()
    language = models.CharField(
        max_length=2,
        choices=LANGUAGE_CHOICES,
        default='en'
    )