Answer the question
In order to leave comments, you need to log in
How to display two languages in a form in Django-modeltranslation?
There is a model:
class Cargo(models.Model):
"""Base model of cargo"""
company = models.ForeignKey(Profile, on_delete=models.CASCADE, verbose_name=_('Company'))
title = models.CharField(max_length=500, verbose_name=_('Title'))
slug = models.SlugField(unique=True, verbose_name=_('URL address'))
description = tinymce_models.HTMLField(verbose_name=_('Description'))
@register(Cargo )
class CargoTranslationOptions(TranslationOptions):
fields = ('title', 'description',)
class CargoAddForm(TranslationModelForm):
class Meta:
model = Cargo
fields = '__all__'
class CargoAdd(CreateView):
"""Add Cargo in profile"""
model = Cargo
form_class = CargoAddForm
Answer the question
In order to leave comments, you need to log in
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question