{"id":17004147,"url":"https://github.com/zerc/sorl_hacks","last_synced_at":"2025-08-21T16:25:22.709Z","repository":{"id":20227377,"uuid":"23499224","full_name":"zerc/sorl_hacks","owner":"zerc","description":"Some hacks for sorl.thumbnail","archived":false,"fork":false,"pushed_at":"2014-09-03T20:22:43.000Z","size":176,"stargazers_count":5,"open_issues_count":2,"forks_count":0,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-07-28T08:14:14.762Z","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/zerc.png","metadata":{"files":{"readme":"README.rst","changelog":"CHANGELOG","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":"2014-08-30T19:34:31.000Z","updated_at":"2018-12-14T22:53:09.000Z","dependencies_parsed_at":"2022-09-06T12:02:32.970Z","dependency_job_id":null,"html_url":"https://github.com/zerc/sorl_hacks","commit_stats":null,"previous_names":[],"tags_count":1,"template":false,"template_full_name":null,"purl":"pkg:github/zerc/sorl_hacks","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/zerc%2Fsorl_hacks","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/zerc%2Fsorl_hacks/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/zerc%2Fsorl_hacks/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/zerc%2Fsorl_hacks/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/zerc","download_url":"https://codeload.github.com/zerc/sorl_hacks/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/zerc%2Fsorl_hacks/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":271507452,"owners_count":24771824,"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-21T02:00:08.990Z","response_time":74,"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":[],"created_at":"2024-10-14T04:42:50.669Z","updated_at":"2025-08-21T16:25:21.999Z","avatar_url":"https://github.com/zerc.png","language":"Python","funding_links":[],"categories":[],"sub_categories":[],"readme":"==================\ndjango-sorl-hacks\n==================\n\ncreate_thumbs template tag\n--------------------------\nParse your text on fly, finds images urls and replace it by thumb url:\n\n::\n\n    {% load sorl_hacks %}\n\n    {% for text_block in post.blocks.all %}\n        \u003ch4\u003e{{ text_block }}\u003c/h4\u003e\n        \u003cp\u003e{{ text_block.body|create_thumbs|safe }}\u003c/p\u003e\n        \u003chr\u003e\n    {% endfor %}\n\n\n\nThumbedCkeditorImages\n---------------------\n\nAdmin model mixin with post_save replacing.\n\nadmin.py:\n\n.. code:: python\n\n    from sorl_hacks.admin import ThumbedCkeditorImages\n\n    class BlogPostAdmin(ThumbedCkeditorImages):\n        ...\n\n\nThumbMixin\n-----------\nUsefull in stadart Django templates. Add property ``my_model.get_thumb_WIDTHxHEIGHT`` to yours models.\n\nExample of ``my_model_detail.html``:\n\n::\n\n    {{ my_model.get_thumb_200x200.html }}\n\n    {{ my_model.get_thumb_small.html }}\n\n\ninstead of:\n\n::\n\n    {% thumbnail my_model.pic \"56x56\" crop=\"center\" as im %}\n        \u003cimg src=\"{{ im.url }}\" width=\"56\" height=\"56\"\u003e\n    {% empty %}\n        \u003cimg src=\"{{ MISSING_IMAGE }}\" width=\"56\" height=\"56\"\u003e\n    {% endthumbnail %}\n\n\n**INSTALL**\n\nYour ``models.py``:\n\n.. code:: python\n\n    from django.db import models\n    from sorl.thumbnail import ImageField\n    from sorl_hacks.models import ThumbMixin\n\n    class Post(ThumbMixin, models.Model):\n        image = ImageField('image', upload_to='posts', **nullable)\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fzerc%2Fsorl_hacks","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fzerc%2Fsorl_hacks","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fzerc%2Fsorl_hacks/lists"}