{"id":15371400,"url":"https://github.com/codingjoe/django-dynamic-filenames","last_synced_at":"2025-04-12T18:44:57.606Z","repository":{"id":32957918,"uuid":"147511436","full_name":"codingjoe/django-dynamic-filenames","owner":"codingjoe","description":"Write advanced filename patterns using the Format Format String Syntax.","archived":false,"fork":false,"pushed_at":"2025-04-03T06:51:51.000Z","size":54,"stargazers_count":70,"open_issues_count":1,"forks_count":8,"subscribers_count":2,"default_branch":"main","last_synced_at":"2025-04-03T21:12:23.684Z","etag":null,"topics":["django","django-file-upload","django-storages","file-upload","hacktoberfest","python"],"latest_commit_sha":null,"homepage":"https://pypi.org/project/django-dynamic-filenames/","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/codingjoe.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":".github/FUNDING.yml","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},"funding":{"github":"codingjoe","buy_me_a_coffee":"codingjoe","custom":"https://www.paypal.me/codingjoe"}},"created_at":"2018-09-05T12:05:03.000Z","updated_at":"2025-04-03T06:51:54.000Z","dependencies_parsed_at":"2023-12-18T09:29:25.255Z","dependency_job_id":"6220d058-f094-45ee-ab2e-5e59a779af64","html_url":"https://github.com/codingjoe/django-dynamic-filenames","commit_stats":{"total_commits":99,"total_committers":6,"mean_commits":16.5,"dds":"0.26262626262626265","last_synced_commit":"9f8f46d6c0bfb5da3f321451957ca3cb19c738b3"},"previous_names":[],"tags_count":11,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/codingjoe%2Fdjango-dynamic-filenames","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/codingjoe%2Fdjango-dynamic-filenames/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/codingjoe%2Fdjango-dynamic-filenames/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/codingjoe%2Fdjango-dynamic-filenames/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/codingjoe","download_url":"https://codeload.github.com/codingjoe/django-dynamic-filenames/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":248617253,"owners_count":21134190,"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":["django","django-file-upload","django-storages","file-upload","hacktoberfest","python"],"created_at":"2024-10-01T13:46:48.740Z","updated_at":"2025-04-12T18:44:57.581Z","avatar_url":"https://github.com/codingjoe.png","language":"Python","funding_links":["https://github.com/sponsors/codingjoe","https://buymeacoffee.com/codingjoe","https://www.paypal.me/codingjoe"],"categories":[],"sub_categories":[],"readme":"# Django Dynamic Filenames\n\nWrite advanced filename patterns using the [Format String\nSyntax](https://docs.python.org/3/library/string.html#format-string-syntax).\n\n## Getting Started\n\n### Installation\n\n```bash\npip install django-dynamic-filenames\n```\n\n### Samples\n\nBasic example:\n\n```python\nfrom django.db import models\nfrom dynamic_filenames import FilePattern\n\nupload_to_pattern = FilePattern(\n    filename_pattern='{app_label:.25}/{model_name:.30}/{instance.created:%Y-%m-%d}/{uuid:base32}{ext}'\n)\n\nclass FileModel(models.Model):\n    my_file = models.FileField(upload_to=upload_to_pattern)\n    created = models.DateTimeField(auto_now_add=True)\n```\n\nAuto slug example:\n\n## Features\n\n### Field names\n\n`ext`\n\n:   File extension including the dot.\n\n`name`\n\n:   Filename excluding the folders.\n\n`model_name`\n\n:   Name of the Django model.\n\n`app_label`\n\n:   App label of the Django model.\n\n`instance`\n\n:   Instance of the model before it has been saved. You may not have a\n    primary key at this point.\n\n`uuid`\n\n:   UUID version 4 that supports multiple type specifiers. The UUID will\n    be the same should you use it twice in the same string, but\n    different on each invocation of the `upload_to` callable.\n\n    The type specifiers allow you to format the UUID in different ways,\n    e.g. `{uuid:x}` will give you a with a hexadecimal UUID.\n\n    The supported type specifiers are:\n\n    `s`\n\n    :   String representation of a UUID including dashes.\n\n    `i`\n\n    :   Integer representation of a UUID. Like to `UUID.int`.\n\n    `x`\n\n    :   Hexadecimal (Base16) representation of a UUID. Like to\n        `UUID.hex`.\n\n    `X`\n\n    :   Upper case hexadecimal representation of a UUID. Like to\n        `UUID.hex`.\n\n    `base32`\n\n    :   Base32 representation of a UUID without padding.\n\n    `base64`\n\n    :   Base64 representation of a UUID without padding.\n\n        :::: warning\n        ::: title\n        Warning\n        :::\n\n        Not all file systems support Base64 file names.\n        ::::\n\n    All type specifiers also support precisions to cut the string, e.g.\n    `{{uuid:.2base32}}` would only return the first 2 characters of a\n    Base32 encoded UUID.\n\n### Type specifiers\n\nYou can also use a special slug type specifier, that slugifies strings.\n\nExample:\n\n```python\nfrom django.db import models\nfrom dynamic_filenames import FilePattern\n\nupload_to_pattern = FilePattern(\n    filename_pattern='{app_label:.25}/{model_name:.30}/{instance.title:.40slug}{ext}'\n)\n\nclass FileModel(models.Model):\n    title = models.CharField(max_length=100)\n    my_file = models.FileField(upload_to=upload_to_pattern)\n```\n\nSlug type specifiers also support precisions to cut the string. In the\nexample above the slug of the instance title will be cut at 40\ncharacters.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fcodingjoe%2Fdjango-dynamic-filenames","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fcodingjoe%2Fdjango-dynamic-filenames","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fcodingjoe%2Fdjango-dynamic-filenames/lists"}