from datetime import timedelta

def save(self, *args, **kwargs):
    if self.warranty_period_type == 'm':
        self.warranty_end_date = self.purchase_date + timedelta(days=self.
            warranty_period_number * 31)
Django Custom Save Model