Hello,
With Django models, I want to achieve this:
class Foo(models.Model):
name = models.CharField(max_length=50)
#wrapping the save function, including extra tasks
def save(self, *args, **kwargs):
super(Foo, self).save(*args, **kwargs)
if extra_param:
...do task 1
else:
...do task 2
And while crating Foo I want to pass such as
Foo(name="Bill Gates",extra_param=True).save() # now triggers the task 1
Foo(name="Bill Gates").save() # now triggers the task 2
How can this be done? I am also open to any other suggestions :)
Thanks