[Fixed]-How to use opencv in Django?

1👍

You have to override save() method of model Visage to do some actions with data after saving.
Change your_project_name appropriately.

from your_project_name.settings import MEDIA_ROOT

class Visage(models.Model):
    ... 

    def save(self):
        super(Visage, self).save()
        filename = os.path.abspath(os.path.join(MEDIA_ROOT, self.image.name)
        traitement(filename)

Leave a comment