{"id":16540439,"url":"https://github.com/grokzen/popyo","last_synced_at":"2025-06-16T02:08:10.903Z","repository":{"id":6501000,"uuid":"7741507","full_name":"Grokzen/POPyO","owner":"Grokzen","description":"Plain Old Python Object - For Django","archived":false,"fork":false,"pushed_at":"2013-10-06T13:31:10.000Z","size":128,"stargazers_count":1,"open_issues_count":0,"forks_count":0,"subscribers_count":3,"default_branch":"master","last_synced_at":"2025-04-12T06:36:23.159Z","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":"other","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/Grokzen.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"License.txt","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2013-01-21T22:17:21.000Z","updated_at":"2015-11-08T13:02:44.000Z","dependencies_parsed_at":"2022-08-26T04:01:33.022Z","dependency_job_id":null,"html_url":"https://github.com/Grokzen/POPyO","commit_stats":null,"previous_names":[],"tags_count":1,"template":false,"template_full_name":null,"purl":"pkg:github/Grokzen/POPyO","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Grokzen%2FPOPyO","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Grokzen%2FPOPyO/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Grokzen%2FPOPyO/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Grokzen%2FPOPyO/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/Grokzen","download_url":"https://codeload.github.com/Grokzen/POPyO/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Grokzen%2FPOPyO/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":260083863,"owners_count":22956409,"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-10-11T18:52:27.607Z","updated_at":"2025-06-16T02:08:10.887Z","avatar_url":"https://github.com/Grokzen.png","language":"Python","funding_links":[],"categories":[],"sub_categories":[],"readme":"# POPO\n\nPlain Old Python Object - For Django\n\n\n## What is it?\n\nThis is a small helper function that can be used to make it easier to bind values from a form to a object or model in Django.\n\nThe idea is from Play Frameworks implementation of POJO bindings in their Controllers where it is possible to automaticly bind form attributes to object properties.\n\n\n## How do it work?\n\nThis is a minimal working example. Irellevant imports is omitted.\n\nWhen calling the popo decorator you should bind a name to a class, the decorator will try to create a new object of that type and bind each attribute from the form to the corosponding attributes on that instance. In the HTML part each input in the form should bind to the set name in the popo decorator and then the attribute name. Example: name=\"foo.url\" and it will bind to the object foo and its attribute url.\n\nNo consideration is taken if that attribute works there that is up to the author to ensure they fit.\n\n\n## Limitations\n\nCurrently it only supports one level of objects and nested objects is not supported. It is not possible to specify in the html: name=\"foo.bar.RandomAttrib\"\n\n\n## Usage example\n\n```\n##############\n# Django view Class\n\ndef formrender(request):\n    return render_to_response(\"form.html\", getContext({}), context_instance=RequestContext(request) )\n\nclass Foobar(models.Model):\n    self.a = models.CharField(max_length=100)\n    self.b = models.CharField(max_length=100)\n\nclass Barfoo(models.Model):\n    self.url = models.CharField(max_length=100)\n    self.verbosity = models.CharField(max_length=100)\n\nfrom popo import popo\n\n@popo(foo=Barfoo, bar=Foobar)\ndef formtest(request, *args, **kwargs):\n    print(kwargs[\"foo\"].url)\n    print(kwargs[\"foo\"].verbosity)\n    print(kwargs[\"bar\"].a)\n    print(kwargs[\"bar\"].b)\n    return HttpResponse(simplejson.dumps({}), \"application/json\")\n\n\n################\n# HTML part\n\n\u003chtml\u003e\n    \u003chead\u003e\n    \u003c/head\u003e\n\u003cbody\u003e\n    \u003cform action=\"/formtest/\" method=\"post\"\u003e\n        {% csrf_token %}\n        \u003cinput type=\"text\" id=\"a\" name=\"foo.url\"\u003e \u003cbr\u003e\n        \u003cinput type=\"text\" id=\"b\" name=\"foo.processor\"\u003e \u003cbr\u003e\n        \u003cinput type=\"text\" id=\"c\" name=\"foo.verbosity\"\u003e \u003cbr\u003e \n        \u003cbr\u003e\n        \u003cinput type=\"text\" id=\"d\" name=\"bar.a\"\u003e \u003cbr\u003e\n        \u003cinput type=\"text\" id=\"e\" name=\"bar.b\"\u003e \u003cbr\u003e\n        \u003cinput type=\"submit\" value=\"Send\"\u003e \n    \u003c/form\u003e\n\u003c/body\u003e\n```\n\n\n## How to install\n\nNote: It is recomended allways to use a virtual-enviroment when using POPyO\n\n1. Download the release you want to install from a tag, latest stable build or the dev branch.\n2. Run \"pip install popo-x.x.x.tar.gz\"\n3. To use popo see the \n\n\n## Build from source\n\n1. Download the release you want to install from a tag, latest stable build or the dev branch.\n2. Run \"make sdist\"\n3. To install run \"pip install dist/popo-x.x.x.tar.gz\"\n\n\n## Install from source\n\n1. Download the release you want to install from a tag, latest stable build or the dev branch.\n2. Run \"make install\"\n\n\n## POPO python dependencies\n\nNo dependencies\n\n\n## Supported python version\n\n - Python 2.7.x - Yes\n - Python 3.1.x - (Not yet tested)\n - Python 3.2.x - (Not yet tested\n - Python 3.3.x - (Not yet tested)\n\n\n## Contributing\n\n1. Fork it\n2. Create your feature branch (`git checkout -b my-new-feature`)\n3. Commit your changes (`git commit -am 'Added some features'`)\n4. Push to the branch (`git push origin my-new-feature`)\n5. Create new Pull Request\n\n\n## License\n\nMIT.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fgrokzen%2Fpopyo","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fgrokzen%2Fpopyo","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fgrokzen%2Fpopyo/lists"}