djangosnippets.org: Latest snippets tagged with 'command-line'https://djangosnippets.org/tags/command-line/2017-07-19T13:58:26.925809-05:00Place a file in an object from command-line (Python 3.x only)
2017-07-19T13:58:26.925809-05:00mpasternakhttps://djangosnippets.org/snippets/10614/<p>You can place this snippet in management/commands/ and have it upload files from disk into objects in your database. </p>
<p>Usage:
<code>python manage.py upload_file_to_model myapp mymodel myfield 1 field_name /some/file/path</code></p>
Freely redistributable