{"id":13849457,"url":"https://github.com/agconti/django-unique-upload","last_synced_at":"2025-04-25T12:31:56.728Z","repository":{"id":57422484,"uuid":"51458261","full_name":"agconti/django-unique-upload","owner":"agconti","description":"A django utility that creates unique file names for uploaded files via uuids. ","archived":false,"fork":false,"pushed_at":"2016-02-11T02:28:39.000Z","size":17,"stargazers_count":17,"open_issues_count":2,"forks_count":2,"subscribers_count":4,"default_branch":"master","last_synced_at":"2025-04-12T05:36:02.822Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/agconti.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2016-02-10T17:34:19.000Z","updated_at":"2022-02-13T04:33:01.000Z","dependencies_parsed_at":"2022-09-13T15:40:37.085Z","dependency_job_id":null,"html_url":"https://github.com/agconti/django-unique-upload","commit_stats":null,"previous_names":[],"tags_count":5,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/agconti%2Fdjango-unique-upload","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/agconti%2Fdjango-unique-upload/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/agconti%2Fdjango-unique-upload/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/agconti%2Fdjango-unique-upload/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/agconti","download_url":"https://codeload.github.com/agconti/django-unique-upload/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":250817817,"owners_count":21492228,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2024-08-04T19:01:18.605Z","updated_at":"2025-04-25T12:31:55.245Z","avatar_url":"https://github.com/agconti.png","language":"Python","funding_links":[],"categories":["Python"],"sub_categories":[],"readme":"# django-unique-upload\n[![Build Status](https://travis-ci.org/agconti/django-unique-upload.svg?branch=master)](https://travis-ci.org/agconti/django-unique-upload)\n\nA django utility that creates unique file names for uploaded files via uuids.\n\n## Why\nThis eliminates the need to check if the a file already exists with the same name. Checking incurs overhead. Removing the need to check boosts performance. Popular pacakges like django storages don't check if a file already exists with the same name by default. They instead overwrite the file. Using unique file names ensures that no file is over written.\n\n## Install\n```bash\npip install django-unique-upload\n```\n\n## Usage\nSimply use the `unique_upload` function as value for a model's `FileField` or `ImageField` `upload_to` argument:\n```python\nfrom __future__ import unicode_literals\n\nfrom django.db import models\nfrom django.utils.encoding import python_2_unicode_compatible\nfrom unique_upload import unique_upload\n\n\n@python_2_unicode_compatible\nclass MyModel(modles.Model):\n    image = models.ImageField(upload_to=unique_upload)\n    file = models.FileField(upload_to=unique_upload)\n```\nNow if we give save `MyModel` with two new files,  `cool-image.jpg` and `really-important.pdf`, Django will save the files to S3 with the values: `3fce8b21-5b0d-4f27-9d99-2bb202f211c7.jpg` and `50a44439-843e-4049-949d-b54cfcddff19.pdf`.\n\n## Tests\nRun the devepment tests with:\n```bash\npython -m unittest discover test\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fagconti%2Fdjango-unique-upload","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fagconti%2Fdjango-unique-upload","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fagconti%2Fdjango-unique-upload/lists"}