Answer the question
In order to leave comments, you need to log in
How to russify all fields in the django admin?
There is the following model:
class Work(models.Model):
photo = models.ImageField(upload_to='works_work_photos',
verbose_name='фото')
description = models.CharField(max_length=1500, null=True, blank=True,
verbose_name='описание')
def __str__(self):
return "Проект " + str(self.pk) + ": " + self.description[:100]
class Meta:
verbose_name = 'проект'
verbose_name_plural = 'проекты'
class WorkModelForm(forms.ModelForm):
description = forms.CharField(widget=forms.Textarea, required=False)
class Meta:
model = Work
fields = "__all__"
class WorkAdmin(admin.ModelAdmin):
form = WorkModelForm
admin.site.register(Work, WorkAdmin)
Answer the question
In order to leave comments, you need to log in
Of course "not translated", but for some reason you redefined the field in the form. If you really need it, then you should give it a label parameter:
class WorkModelForm(forms.ModelForm):
description = forms.CharField(label='описание', widget=forms.Textarea, required=False)
...
class WorkModelForm(forms.ModelForm):
class Meta:
model = Work
fields = "__all__"
widgets = {
'description': forms.Textarea,
}
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question