Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- class Case(models.Model):
- ...
- def save(self,*args,**kwargs):
- if Consumer.objects.get(email__iexact=self.email):
- self.consumer = Consumer.objects.get(email__iexact=self.email)
- else:
- consumer = Consumer(first_name=self.first_name,last_name=self.last_name,email=self.email)
- consumer.save()
- return super().save(*args,**kwargs)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement