Changing Model field from 3rd party library in Django

I am wondering what would be the least dangerous way to change the Field Attribute of an imported library.

To be more specific, I am talking about drf-history.

This is the imported model:

class History(models.Model):
    """History model to store user actions"""

    table_name = models.CharField(max_length=255, blank=False, editable=False)
    user = models.ForeignKey(get_user_model(), on_delete=models.PROTECT)
    created_at = models.DateTimeField(auto_now_add=True, editable=False)
    instance_id = models.CharField(
        max_length=255, null=False, blank=False, editable=False
    action = models.CharField(
    path = models.CharField(max_length=255, default="", blank=False, editable=False)
    request_data = models.TextField(default="", editable=False)
    response_data = models.TextField(default="", editable=False)

    class Meta:
        verbose_name_plural = "History model"

I would like to change the user field attribute on_delete to models.CASCADE instead of models.PROTECT.

Since the project is already running and many users have been created, I really don't want to mess anything up.

What would be the best option? Thank you for all your help.

Read more here:

Content Attribution

This content was originally published by Bass-Ninja at Recent Questions - Stack Overflow, and is syndicated here via their RSS feed. You can read the original post over there.

%d bloggers like this: