Answer the question
In order to leave comments, you need to log in
How to add many records from a file at once in Django model?
There is a very simple model:
class Color(models.Model):
title = models.CharField(max_length=30, verbose_name="Название (код) ЛКМ", unique=True)
image = ThumbnailerImageField(default='img/thumb.png', resize_source=dict(quality=95, size=(512, 512), sharpen=True))
priority = models.IntegerField(default=0, verbose_name="Приоритет сортировки")
is_active = models.BooleanField(default=True)
class ColorForm(forms.ModelForm):
class Meta:
model = Color
fields = ['title', 'image', 'priority', 'is_active']
labels = {
'title': 'Название',
'image': 'Изображение',
'priority': 'Приоритет сортировки',
'is_active': 'Активен (включен)',
}
help_texts = {
'priority': 'используется для отображения порядка при выборе, чем больше число, тем выше в списке',
'is_active': 'если выключен, то не показывается в каталоге',
}
Answer the question
In order to leave comments, you need to log in
At first everything was fine, but today the client asks a question
Customize the admin panel, add a view with the desired template, post the url to it in templates/admin/{model}_change_list.html
https://docs.djangoproject.com/en/2.1/ref/contrib/...
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question