When saving, how can you check if a field has changed?

前端 未结 25 2291
鱼传尺愫
鱼传尺愫 2020-11-22 07:15

In my model I have :

class Alias(MyBaseModel):
    remote_image = models.URLField(max_length=500, null=True, help_text=\"A URL that is downloaded and cached          


        
25条回答
  •  情书的邮戳
    2020-11-22 07:25

    This works for me in Django 1.8

    def clean(self):
        if self.cleaned_data['name'] != self.initial['name']:
            # Do something
    

提交回复
热议问题