Answer the question
In order to leave comments, you need to log in
How to restrict selection in bound model in admin.TabularInline?
There are 4 models:
class Prop(models.Model):
"" Свойства
name = models.CharField()
class PropertyVariant(models.Model):
"""Служит для задания значений Свойств"""
property_product = models.ForeignKey(Prop)
class PropertyProduct(models.Model):
"""Справочник Свойство (товара)"""
product = models.ForeignKey(Product, verbose_name=_("Товар"), on_delete=models.CASCADE, blank=True, null=True)
prop = models.OneToOneField(Prop, verbose_name=_("Свойство"), on_delete=models.CASCADE)
value = models.OneToOneField(PropertyVariant, verbose_name=_("Значение"), on_delete=mode
class Product(models.Model):
"""Модель описания товара"""
inlines = [PropertyProductAdmin]
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