Answer the question
In order to leave comments, you need to log in
Django: How to make a model with unique dependencies?
Such a situation. There are several simple models:
class TypeProfile(models.Model):
""" Модель профиля """
title = models.CharField(max_length=30, verbose_name='Название профиля', db_index=True)
description = models.CharField(max_length=300, verbose_name='Описание')
class TypeFacade(models.Model):
""" Вид фасада """
title = models.CharField(max_length=30, verbose_name='Вид фасада', db_index=True)
description = models.CharField(max_length=300, verbose_name='Описание')
class Price(models.Model):
""" Ценник """
name_profile = models.ForeignKey(TypeProfile, on_delete=models.PROTECT, verbose_name='Модель профиля')
type_facade = models.ForeignKey(TypeFacade, on_delete=models.PROTECT, verbose_name='Вид фасада')
stain_price = models.DecimalField(max_digits=8, decimal_places=2, blank=True, verbose_name='Цена морилка')
enamel_price = models.DecimalField(max_digits=8, decimal_places=2, blank=True, verbose_name='Цена эмаль')
description = models.CharField(max_length=300, verbose_name='Описание')
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