{"id":23081008,"url":"https://github.com/makinacorpus/django-paperclip","last_synced_at":"2025-08-24T19:21:17.980Z","repository":{"id":11004007,"uuid":"13327915","full_name":"makinacorpus/django-paperclip","owner":"makinacorpus","description":"Attach files to Django models","archived":false,"fork":false,"pushed_at":"2025-03-03T13:00:37.000Z","size":390,"stargazers_count":19,"open_issues_count":2,"forks_count":5,"subscribers_count":24,"default_branch":"master","last_synced_at":"2025-07-26T18:43:04.517Z","etag":null,"topics":["django","files","pictures"],"latest_commit_sha":null,"homepage":"","language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"lgpl-3.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/makinacorpus.png","metadata":{"files":{"readme":"README.rst","changelog":"CHANGES","contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null}},"created_at":"2013-10-04T15:41:23.000Z","updated_at":"2025-03-03T13:00:24.000Z","dependencies_parsed_at":"2024-06-20T00:06:36.628Z","dependency_job_id":"ebe76468-c892-4293-a62f-80458afbc50a","html_url":"https://github.com/makinacorpus/django-paperclip","commit_stats":{"total_commits":357,"total_committers":15,"mean_commits":23.8,"dds":0.7647058823529411,"last_synced_commit":"408fe305d8a95e7e96a1b02e6f208b7aa905d5c0"},"previous_names":[],"tags_count":41,"template":false,"template_full_name":null,"purl":"pkg:github/makinacorpus/django-paperclip","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/makinacorpus%2Fdjango-paperclip","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/makinacorpus%2Fdjango-paperclip/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/makinacorpus%2Fdjango-paperclip/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/makinacorpus%2Fdjango-paperclip/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/makinacorpus","download_url":"https://codeload.github.com/makinacorpus/django-paperclip/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/makinacorpus%2Fdjango-paperclip/sbom","scorecard":{"id":613644,"data":{"date":"2025-08-11","repo":{"name":"github.com/makinacorpus/django-paperclip","commit":"e0d74bfce285163f3f483f25783f6aab769a17b5"},"scorecard":{"version":"v5.2.1-40-gf6ed084d","commit":"f6ed084d17c9236477efd66e5b258b9d4cc7b389"},"score":4.2,"checks":[{"name":"Dangerous-Workflow","score":10,"reason":"no dangerous workflow patterns detected","details":null,"documentation":{"short":"Determines if the project's GitHub Action workflows avoid dangerous patterns.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#dangerous-workflow"}},{"name":"Maintained","score":0,"reason":"0 commit(s) and 0 issue activity found in the last 90 days -- score normalized to 0","details":null,"documentation":{"short":"Determines if the project is \"actively maintained\".","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#maintained"}},{"name":"Pinned-Dependencies","score":0,"reason":"dependency not pinned by hash detected -- score normalized to 0","details":["Warn: GitHub-owned GitHubAction not pinned by hash: .github/workflows/python-lint.yml:18: update your workflow using https://app.stepsecurity.io/secureworkflow/makinacorpus/django-paperclip/python-lint.yml/master?enable=pin","Warn: GitHub-owned GitHubAction not pinned by hash: .github/workflows/python-lint.yml:20: update your workflow using https://app.stepsecurity.io/secureworkflow/makinacorpus/django-paperclip/python-lint.yml/master?enable=pin","Warn: GitHub-owned GitHubAction not pinned by hash: .github/workflows/python-package.yml:23: update your workflow using https://app.stepsecurity.io/secureworkflow/makinacorpus/django-paperclip/python-package.yml/master?enable=pin","Warn: GitHub-owned GitHubAction not pinned by hash: .github/workflows/python-package.yml:25: update your workflow using https://app.stepsecurity.io/secureworkflow/makinacorpus/django-paperclip/python-package.yml/master?enable=pin","Warn: GitHub-owned GitHubAction not pinned by hash: .github/workflows/python-publish.yml:22: update your workflow using https://app.stepsecurity.io/secureworkflow/makinacorpus/django-paperclip/python-publish.yml/master?enable=pin","Warn: GitHub-owned GitHubAction not pinned by hash: .github/workflows/python-publish.yml:24: update your workflow using https://app.stepsecurity.io/secureworkflow/makinacorpus/django-paperclip/python-publish.yml/master?enable=pin","Warn: third-party GitHubAction not pinned by hash: .github/workflows/python-publish.yml:40: update your workflow using https://app.stepsecurity.io/secureworkflow/makinacorpus/django-paperclip/python-publish.yml/master?enable=pin","Warn: pipCommand not pinned by hash: .github/workflows/python-lint.yml:26","Warn: pipCommand not pinned by hash: .github/workflows/python-package.yml:31","Warn: pipCommand not pinned by hash: .github/workflows/python-package.yml:33","Warn: pipCommand not pinned by hash: .github/workflows/python-package.yml:35","Warn: pipCommand not pinned by hash: .github/workflows/python-package.yml:44","Warn: pipCommand not pinned by hash: .github/workflows/python-publish.yml:30","Info:   0 out of   6 GitHub-owned GitHubAction dependencies pinned","Info:   0 out of   1 third-party GitHubAction dependencies pinned","Info:   0 out of   6 pipCommand dependencies pinned"],"documentation":{"short":"Determines if the project has declared and pinned the dependencies of its build process.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#pinned-dependencies"}},{"name":"Code-Review","score":0,"reason":"Found 1/17 approved changesets -- score normalized to 0","details":null,"documentation":{"short":"Determines if the project requires human code review before pull requests (aka merge requests) are merged.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#code-review"}},{"name":"Binary-Artifacts","score":10,"reason":"no binaries found in the repo","details":null,"documentation":{"short":"Determines if the project has generated executable (binary) artifacts in the source repository.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#binary-artifacts"}},{"name":"Token-Permissions","score":0,"reason":"detected GitHub workflow tokens with excessive permissions","details":["Warn: no topLevel permission defined: .github/workflows/python-lint.yml:1","Warn: no topLevel permission defined: .github/workflows/python-package.yml:1","Warn: no topLevel permission defined: .github/workflows/python-publish.yml:1","Info: no jobLevel write permissions found"],"documentation":{"short":"Determines if the project's workflows follow the principle of least privilege.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#token-permissions"}},{"name":"CII-Best-Practices","score":0,"reason":"no effort to earn an OpenSSF best practices badge detected","details":null,"documentation":{"short":"Determines if the project has an OpenSSF (formerly CII) Best Practices Badge.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#cii-best-practices"}},{"name":"Security-Policy","score":0,"reason":"security policy file not detected","details":["Warn: no security policy file detected","Warn: no security file to analyze","Warn: no security file to analyze","Warn: no security file to analyze"],"documentation":{"short":"Determines if the project has published a security policy.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#security-policy"}},{"name":"Fuzzing","score":0,"reason":"project is not fuzzed","details":["Warn: no fuzzer integrations found"],"documentation":{"short":"Determines if the project uses fuzzing.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#fuzzing"}},{"name":"Vulnerabilities","score":10,"reason":"0 existing vulnerabilities detected","details":null,"documentation":{"short":"Determines if the project has open, known unfixed vulnerabilities.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#vulnerabilities"}},{"name":"License","score":10,"reason":"license file detected","details":["Info: project has a license file: LICENSE:0","Info: FSF or OSI recognized license: GNU Lesser General Public License v3.0: LICENSE:0"],"documentation":{"short":"Determines if the project has defined a license.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#license"}},{"name":"Packaging","score":10,"reason":"packaging workflow detected","details":["Info: Project packages its releases by way of GitHub Actions.: .github/workflows/python-publish.yml:11"],"documentation":{"short":"Determines if the project is published as a package that others can easily download, install, easily update, and uninstall.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#packaging"}},{"name":"Signed-Releases","score":-1,"reason":"no releases found","details":null,"documentation":{"short":"Determines if the project cryptographically signs release artifacts.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#signed-releases"}},{"name":"Branch-Protection","score":-1,"reason":"internal error: error during branchesHandler.setup: internal error: githubv4.Query: Resource not accessible by integration","details":null,"documentation":{"short":"Determines if the default and release branches are protected with GitHub's branch protection settings.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#branch-protection"}},{"name":"SAST","score":0,"reason":"SAST tool is not run on all commits -- score normalized to 0","details":["Warn: 0 commits out of 20 are checked with a SAST tool"],"documentation":{"short":"Determines if the project uses static code analysis.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#sast"}}]},"last_synced_at":"2025-08-21T03:17:38.496Z","repository_id":11004007,"created_at":"2025-08-21T03:17:38.496Z","updated_at":"2025-08-21T03:17:38.496Z"},"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":271930758,"owners_count":24845475,"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","status":"online","status_checked_at":"2025-08-24T02:00:11.135Z","response_time":111,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"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":["django","files","pictures"],"created_at":"2024-12-16T13:44:38.952Z","updated_at":"2025-08-24T19:21:17.937Z","avatar_url":"https://github.com/makinacorpus.png","language":"Python","funding_links":[],"categories":[],"sub_categories":[],"readme":"Paperclip\n=========\n\nAdd attachments to Django models, used in `MapEntity \u003chttps://github.com/makinacorpus/django-mapentity\u003e`_.\n\n\n|release-status| |master-status| |master-coverage|\n\n|python-versions| |django-versions|\n\n\n.. |release-status| image:: https://img.shields.io/pypi/v/paperclip.svg\n    :target: https://pypi.python.org/pypi/paperclip\n\n.. |master-status| image:: https://github.com/makinacorpus/django-paperclip/actions/workflows/python-package.yml/badge.svg\n\n.. |master-coverage| image:: https://codecov.io/gh/makinacorpus/django-paperclip/branch/master/graph/badge.svg?token=OB6f944vAt\n    :target: https://codecov.io/gh/makinacorpus/django-paperclip\n\n.. |python-versions| image:: https://img.shields.io/badge/python-%3E%3D%203.9-blue.svg\n\n.. |django-versions| image:: https://img.shields.io/badge/django-%3E%3D%204.2-blue.svg\n\n\n=======\nINSTALL\n=======\n\nInstalling from pypi (using pip)\n\n::\n\n    pip install paperclip\n\n\nInstalling from github\n\n::\n\n    pip install -e git://github.com/makinacorpus/django-paperclip.git#egg=django-paperclip\n\n\n=======\nUPGRADE\n=======\n\nAfter upgrade to 0.4.0, if you want to enable links to Youtube/Soundcloud media,\nyou have to add an additional column to the database:\n\n\n.. code-block:: postgresql\n\n    ALTER TABLE paperclip_attachment ADD COLUMN attachment_video VARCHAR(200) NOT NULL DEFAULT '';\n\n\n===========\nBASIC USAGE\n===========\n\n* Add ``easy_thumbnails``, ``embed_video`` and ``paperclip`` to ``INSTALLED_APPS``\n\n* Include urls\n\n::\n\n    urlpatterns = [\n        ...\n        url(r'^paperclip/', include('paperclip.urls')),\n        ...\n    ]\n\n* Include scripts in template\n\n::\n\n    \u003cscript src=\"{% static \"paperclip/bootstrap-confirm.js\" %}\" type=\"text/javascript\"\u003e\u003c/script\u003e\n    \u003cscript src=\"{% static \"paperclip/spin.min.js\" %}\" type=\"text/javascript\"\u003e\u003c/script\u003e\n    \u003cscript src=\"{% static \"paperclip/paperclip.js\" %}\" type=\"text/javascript\"\u003e\u003c/script\u003e\n\nIf you use bootstrap 3 or bootstrap 4, please include ``paperclip/bootstrap-3-confirm.js`` or ``paperclip/bootstrap-4-confirm.js`` instead of ``paperclip/bootstrap-confirm.js``.\n\n* Include list and form in template\n\n::\n\n    {% include 'paperclip/attachment_list.html' with object=my_instance attachment_form_next=my_instance.get_detail_url %}\n\n* Add paperclip models in one of your apps\n\n::\n\n    class FileType(paperclip.models.FileType):\n        pass\n\n    class Attachment(paperclip.models.Attachment):\n        pass\n\n* Configure\n\nDefine the following django setting:\n\n::\n\n    PAPERCLIP_ENABLE_VIDEO = False,\n    PAPERCLIP_FILETYPE_MODEL = 'myapp.FileType'\n    PAPERCLIP_LICENSE_MODEL = 'myapp.License'\n    PAPERCLIP_ATTACHMENT_MODEL = 'myapp.Attachment'\n    PAPERCLIP_ACTION_HISTORY_ENABLED = True\n\n* Make migration and migrate\n\n\n=========\nTEMPLATES\n=========\n\nThree templates are embeded and can easily be overriden :\n\n* ``paperclip/attachment_list.html`` : renders a table displaying attached files for an object and an upload form using the two following templates\n* ``paperclip/_attachment_table.html`` : renders a table displaying attached files for an object. You can add extra columns using ``block extra_column_header`` and ``block extra_column_data``\n* ``paperclip/_attachment_form.html`` : renders an upload form\n\n\n\n\n============\nTEMPLATETAGS\n============\n\nTwo templatetags are provided :\n\nget_attachments_for\n````````````````````\nResolves attachments that are attached to a given object. You can specify the variable name in the context the attachments are stored using the `as` argument. Default context variable name is `attachments`. You can filter on a specified FileType with the optional `only_type` argument.\n\nExamples\n\n::\n\n    {% get_attachments_for my_instance as \"my_attachments\" %}\n    {% get_attachments_for my_instance as \"my_attachments\" only_type my_filetype_instance %}\n\nattachment_form\n```````````````\nRenders a \"upload attachment\" form. `obj` argument is required and represents the instance to which you want to associate the file. A bound form can be given optionnaly with the argument ``form``. Important : a ``attachment_form_next`` variable is expected in context. If you want to use a custom form class, you can add ``attachment_form_class`` variable in context too\n\nExamples\n\n::\n\n    {% with object=my_instance attachment_form_next=my_instance.get_detail_url %}\n        {% attachment_form object %}\n    {% endwith %}\n\n    OR\n\n    # views.py\n    ...\n    context['object'] = my_instance\n    context['attachment_form_next'] = my_instance.get_detail_url(=)\n    context['attachment_form_class'] = MyAttachmentForm\n    ...\n\n    # template\n    {% attachment_form object %}\n\n==================\nUSE A CUSTOM FORM\n==================\n\nYou can use a custom django form by following this steps. Parenthetically, It's the recommended solution if you want to use django-crispy-forms or django-floppyforms.\n\n* Write your custom form :\n\n::\n\n    from paperclip.forms import AttachmentForm\n\n    class MyAttachmentForm(AttachmentForm):\n        ...\n\nNote: To be sure to not break the form logic, we recommend to inherit from the native ``paperclip.forms.AttachmentForm``.\n\n* Add your form class in a ``attachment_form_class`` variable of the main view context\n\n::\n\n    context['attachment_form_class'] = MyAttachmentForm\n\n* Override ``'add_attachment'`` and ``'update_attachment'`` URLs to provide your custom form class in arguments\n\n.. code-block:: python\n\n    from my_app.forms import MyAttachmentForm\n\n    urlpatterns = [\n        path('paperclip/', include('paperclip.urls')),\n        ...\n        path('add-for/\u003cstr:app_label\u003e/\u003cstr:model_name\u003e/\u003cint:pk\u003e/',\n            'paperclip.views.add_attachment',\n            kwargs={'attachment_form': MyAttachmentForm},\n            name=\"add_attachment\"),\n\n        path('update/\u003cint:attachment_pk\u003e/',\n            'paperclip.views.update_attachment',\n            kwargs={'attachment_form': MyAttachmentForm},\n            name=\"update_attachment\"),\n        ...\n    ]\n\n\nNote: Be sure to write these URLs after having included paperclip URLs.\n\n=======\nCLEANUP\n=======\n\nDeleting or changing an attachment does not remove the old attached file from disk.\nFrom time to time you can clean obsolete files by running:\n\n::\n\n    ./manage.py clean_attachments\n\n\n=======\nAUTHORS\n=======\n\n|makinacom|_\n\n.. |makinacom| image:: https://github.com/makinacorpus.png\n.. _makinacom:  https://www.makina-corpus.com\n\n\n=======\nLICENSE\n=======\n\n    * LGPL\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmakinacorpus%2Fdjango-paperclip","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fmakinacorpus%2Fdjango-paperclip","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmakinacorpus%2Fdjango-paperclip/lists"}