[Answer]-Override field arguments in inherited django models

1👍

You can try using a property as the limit_choices_to argument, e.g.:

class InstalledModel(models.Model):
    @property    
    def another_model_choices(self):
        if isinstance(self, MyModel):
            return {'some_condition': True}
        return None

    base_field = models.ForeignKey(AnotherModel, limit_choices_to=another_model_choices)
👤knbk

Leave a comment