Answer the question
In order to leave comments, you need to log in
Complex query in Django?
models.py
class Design(models.Model):
object = models.ForeignKey(Object)
company = models.ForeignKey(Company)
number = models.CharField(max_length=32, verbose_name=u'Шифр проекта')
class Specification(models.Model):
design = models.ForeignKey(Design)
name = models.CharField(verbose_name=u'Название спецификации', max_length=32)
construction_type = models.ForeignKey(ConstructionType, verbose_name=u'Тип конструкций')
drawings = models.ManyToManyField(Drawing, verbose_name=u'Листы проекта')
amount = models.FloatField(verbose_name=u'Количество', default=1)
unit_measure = models.ForeignKey(UnitMeasure, verbose_name=u'Ед. изм.')
class SpecificationMaterial(models.Model):
specification = models.ForeignKey(Specification)
material = models.ForeignKey(Material)
amount = models.FloatField(verbose_name=u'Количество')
class Construction(models.Model):
object = models.ForeignKey(Object, verbose_name=u'Объект')
type = models.ForeignKey(ConstructionType, verbose_name=u'Тип конструкции')
name = models.CharField(max_length=128, verbose_name=u'Название конструкции')
class ConstructionSpecification(models.Model):
construction = models.ForeignKey(Construction)
specification = models.ForeignKey(Specification)
amount = models.FloatField(verbose_name=u'Количество', default=1)
class Material(models.Model):
group = models.ForeignKey(MaterialGroup)
code = models.CharField(max_length=48, verbose_name=u'Артикул', blank=True)
name = models.CharField(max_length=128, verbose_name=u'Название материала')
unit_measure = models.ForeignKey(UnitMeasure)
price = models.FloatField(verbose_name=u'Цена', blank=True)
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