'Refresh UUID on model object save
so I have a model and I am using a UUID field. I just simply want to change the UUID(refresh the UUID) to a new UUID every time a model object is saved.
import uuid
from django.db import models
class MyUUIDModel(models.Model):
id = models.UUIDField(default=uuid.uuid4, unique=True)
# other fields
def save(self, *args, **kwargs):
//refresh the uuid. what do i do here?
super(MyUUIDModel, self).save(*args, **kwargs)
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|
