Remove or Add New field in Django models (But not for All)

HI so i added a new field to my django models, its called price_2

price_2 = models.DecimalField(max_digits=10, decimal_places=2, blank=True, null=True)

Now everything works fine.

but i found out later is that Only One of my Shops has a price_2.

for example only Amazon has 2 prices, Nike and Walmart does not.

is there a way to add a new field in django models to only a Specific Shop ?

thanks

Please clarify, what exactly do you mean by this?

When you add a field, the field is added to the model, not to the instances.

You are allowing null=True on this field, so it’s likely that that field is null on those other two instances.

hi sorry for the Late reply.

yes i only want to add a field to an individual instance. is it possible ?

No, the field exists on the model, not on the individual instances of that model.

1 Like