V
V
vader6662014-10-01 21:41:15
Django
vader666, 2014-10-01 21:41:15

Is there a table plugin (price list) for Django-CMS?

We need a plugin with which you can show tables in Django-CMS.
You need something with which you can organize the management of the price list. What would be possible to do groups, so that it would be possible to display a separate group on a single page and display the entire price list on one page with all groups. There is another nuance - in some price lists, how many columns with the price (for example, "retail, from 10 pcs., From 100 pcs.)

Answer the question

In order to leave comments, you need to log in

1 answer(s)
R
Raido, 2014-12-11
@Raido

You can do this (pulled from your project):

#models.py
class PageImage(models.Model):
    title = models.CharField(max_length=200, blank=False, verbose_name='Заголовок')
    text = models.TextField(max_length=1000, blank=True, verbose_name='Текст')


class PriceField(models.Model):
    st = (
        ('ST', 'шт.'),
        ('SE', 'ед.'),
    )
    property = models.ForeignKey(Price, related_name='fields')
    name = models.CharField(max_length=1000, blank=True, verbose_name='Название')
    kolv = models.DecimalField(max_digits=100, decimal_places=0, default='0', verbose_name='Количество')
    price = models.DecimalField(max_digits=100, decimal_places=2, default='0', verbose_name='Цена за шт.')


#admin.py
class PriceFieldsInline(admin.TabularInline):
    model = PageImage
    extra = 3

class PriceAdmin(admin.ModelAdmin):
    inlines = [PriceFieldsInline, ]

admin.site.register(Page, PriceAdmin)

Then, by iteration in the template or custom tag, output the entire price table.
"retail, from 10pcs, from 100pcs." and groups, too, with the help of this model, I think you can solve. Just ask a more specific question.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question