[Django]-Django – dynamic text in admin form

2👍

Solved this problem by a simple change in my model save(), totally forgot about string formatting in python…

models.py

    def save(self, *args, **kwargs):
        try:
            self.description = self.description % self.name
        except TypeError:
            pass
        self.slug = self.name
        super(Survey, self).save(*args, **kwargs)

simple enough for accomplishing what I wanted, I will declare a new field in the model to make this more extensible.

Leave a comment