{"id":21731745,"url":"https://github.com/marcuswhybrow/django-modals","last_synced_at":"2026-05-16T20:33:53.783Z","repository":{"id":5611277,"uuid":"6818670","full_name":"marcuswhybrow/django-modals","owner":"marcuswhybrow","description":"Want multiple forms per page? Love abstraction? Make things easy with django-multi-form!","archived":false,"fork":false,"pushed_at":"2012-11-23T02:30:13.000Z","size":112,"stargazers_count":4,"open_issues_count":1,"forks_count":1,"subscribers_count":2,"default_branch":"master","last_synced_at":"2025-03-20T23:43:07.193Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":null,"has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":"beego/wetalk","license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/marcuswhybrow.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2012-11-22T20:33:15.000Z","updated_at":"2023-05-29T19:55:17.000Z","dependencies_parsed_at":"2022-09-22T03:51:01.734Z","dependency_job_id":null,"html_url":"https://github.com/marcuswhybrow/django-modals","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/marcuswhybrow/django-modals","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/marcuswhybrow%2Fdjango-modals","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/marcuswhybrow%2Fdjango-modals/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/marcuswhybrow%2Fdjango-modals/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/marcuswhybrow%2Fdjango-modals/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/marcuswhybrow","download_url":"https://codeload.github.com/marcuswhybrow/django-modals/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/marcuswhybrow%2Fdjango-modals/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":33117867,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-05-16T18:38:32.183Z","status":"ssl_error","status_checked_at":"2026-05-16T18:38:29.903Z","response_time":115,"last_error":"SSL_read: unexpected eof while reading","robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":false,"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-11-26T04:27:16.288Z","updated_at":"2026-05-16T20:33:53.766Z","avatar_url":"https://github.com/marcuswhybrow.png","language":null,"funding_links":[],"categories":[],"sub_categories":[],"readme":"Django Modals\n=============\n\nDo you want modal forms? Love abstraction? Make things easy with django-modals!\n\nI really love [Twitter's bootstrap][bootstrap], and use [modals][modals] all the time to display forms. Manually adding forms to a view is a giant pain. You've got to override `get_context_data()` and slip in your form, and then do the same with `post()` to grap the result.\n\nThat all sounds easy enough the first time. But then you add another form to the same view, and you find yourself distinuishing between forms by the submit button name, or a hidden field. **It's time to abstract!**\n\nDjango Modal's `ModalMixin` tidies up that messy code, and allows you to neatly define subclasses of `Modal`, instances of which are included in the template context. A `Modal` subclass defines a template to use for rendering the modal in HTML, only handles data from a specific modal form, and defines methods for valid and invalid form data handling:\n\n```\nimport modals\n\nclass MyThingModal(modals.Modal):\n    form_class = MyThingForm\n    template_name = 'app/my_thing_modal.html'\n\n    def valid(self, form):\n        form.save()\n        # Do other work here\n\n    def invalid(self, form):\n        # Take other action\n```\n\nI'm figuring out the best approach, and it's not functional yet. But I think this is a useful abstraction to make.\n\n\n[bootstrap]: http://twitter.github.com/bootstrap/\n[modals]: http://twitter.github.com/bootstrap/javascript.html#modals","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmarcuswhybrow%2Fdjango-modals","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fmarcuswhybrow%2Fdjango-modals","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmarcuswhybrow%2Fdjango-modals/lists"}