update data on url change
This commit is contained in:
parent
fccc67fba9
commit
06f10fd479
1 changed files with 2 additions and 1 deletions
|
@ -36,7 +36,7 @@ class Item(models.Model):
|
||||||
user = models.ForeignKey(User, null=True, related_name='items', on_delete=models.CASCADE)
|
user = models.ForeignKey(User, null=True, related_name='items', on_delete=models.CASCADE)
|
||||||
|
|
||||||
def save(self, *args, **kwargs):
|
def save(self, *args, **kwargs):
|
||||||
if self.url and not self.data:
|
if self.url and not self.data.get("url") == self.url:
|
||||||
self.update_data()
|
self.update_data()
|
||||||
super().save(*args, **kwargs)
|
super().save(*args, **kwargs)
|
||||||
|
|
||||||
|
@ -99,6 +99,7 @@ class Item(models.Model):
|
||||||
continue
|
continue
|
||||||
key = key.replace('og:', '')
|
key = key.replace('og:', '')
|
||||||
data[key] = value
|
data[key] = value
|
||||||
|
data["url"] = self.url
|
||||||
return data
|
return data
|
||||||
|
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue