How to generate unique filename for django model.FileField
<p>I am working on a django/python project.
This project uses a model that contains a FileField.
This model is fed by a web form. Everything works great: Django automatically renames the file if an existing file with the same name already exists.</p>

<p>I have a second Model that also contains a FileField. But this file is not uploaded via a web form. This file content is generated on the file by a python program. What I want to do is provide a file name when inserting it. And I want Django/Python to rename automatically as it does no the web form.
How should I do ?</p>

<p>Thanks.</p>