prevent deleting auto_created=True
styles
This commit is contained in:
parent
616428cf4d
commit
1d8be63834
@ -145,6 +145,12 @@ class MessageStyle(models.Model):
|
||||
verbose_name_plural = "message styles"
|
||||
get_latest_by = "id"
|
||||
|
||||
def delete(self, *args, **kwargs):
|
||||
if self.auto_created:
|
||||
raise ValidationError("Cannot delete 'MessageStyle' instance with 'auto_created=True'")
|
||||
|
||||
super().__init__(self)
|
||||
|
||||
def __str__(self):
|
||||
return self.name
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user