{ "info": { "author": "Li Meng", "author_email": "liokmkoil@gmail.com", "bugtrack_url": null, "classifiers": [ "Development Status :: 4 - Beta", "Environment :: Web Environment", "Framework :: Django", "Intended Audience :: Developers", "License :: OSI Approved :: MIT License", "Operating System :: OS Independent", "Programming Language :: Python", "Topic :: Software Development :: Libraries :: Python Modules" ], "description": "===============\r\ndjango-submodel\r\n===============\r\n\r\nA Django field which: works like a model instance, stores sub-model fields in single DB column, and supports smooth editing in Django admin. \r\n\r\ndjango-submodel works on Django 1.3+\r\n\r\nInstallation\r\n============\r\n#. ``pip install django-submodel``\r\n\r\nUsage\r\n=====\r\n\r\n::\r\n\r\n # in you_app/models.py\r\n\r\n from django.db import models\r\n from submodel.fields import SubModelField\r\n\r\n\r\n # Define (field_name, model_field_instance) tuples in \"fields\" parameter in SubModelField,\r\n # similar as normal Model definition\r\n # If SubModelField such as pref field is newly added to an existed model,\r\n # you may want to use south to migrate the schema\r\n class UserProfile(models.Model):\r\n realname = models.CharField(max_length=100)\r\n pref = SubModelField(u'user preference',\r\n fields=(\r\n ('title', models.CharField(max_length=10)),\r\n ('color', models.IntegerField(choices=((0, 'Black'), (1, 'White')))),\r\n ('birthday_day', models.DateTimeField()),\r\n ('feel_luck', models.BooleanField(default=True))))\r\n\r\n::\r\n\r\n # in you_app/admin.py, to enable editing of sub fields of pref in Django admin\r\n\r\n from submodel.admin import SubModelFieldInlineAdmin\r\n from . models import UserProfile\r\n\r\n class PrefInilneAdmin(SubModelFieldInlineAdmin):\r\n model = UserProfile._meta.get_field('pref').submodel # TODO improve\r\n\r\n class UserProfileAdmin(admin.ModelAdmin):\r\n inlines = [PrefInilneAdmin]\r\n\r\n admin.site.register(UserProfile, UserProfileAdmin)\r\n\r\n::\r\n\r\n >>> # TODO in Python shell, the value of pref field as a model instance\r\n\r\n\r\nTODO\r\n====\r\n - add tests\r\n - simpler API\r\n - dump and modify Deserializer to support missing subfields. schema policy?\r\n - better history\r\n - check compatibility w/ django-reversion and others ...\r\n - possible config\r\n - more strict check such as attname confliction, for example FK field user and field user_id", "description_content_type": null, "docs_url": null, "download_url": "", "downloads": { "last_day": -1, "last_month": -1, "last_week": -1 }, "home_page": "https://github.com/liokm/django-submodel", "keywords": "", "license": "MIT", "maintainer": "", "maintainer_email": "", "name": "django-submodel", "package_url": "https://pypi.org/project/django-submodel/", "platform": "UNKNOWN", "project_url": "https://pypi.org/project/django-submodel/", "project_urls": { "Homepage": "https://github.com/liokm/django-submodel" }, "release_url": "https://pypi.org/project/django-submodel/0.1/", "requires_dist": null, "requires_python": null, "summary": "A Django json field behaves as a model instance and supports seamless inline editing in Django admin.", "version": "0.1" }, "last_serial": 790794, "releases": { "0.1": [ { "comment_text": "", "digests": { "md5": "b52f3eb2ecc23055b40e443ddcd308cf", "sha256": "4c709b3a9f5809eb6231f8fb9f00f79684a1163584e970095d4eb78a3ea8d6b3" }, "downloads": -1, "filename": "django-submodel-0.1.tar.gz", "has_sig": false, "md5_digest": "b52f3eb2ecc23055b40e443ddcd308cf", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 3656, "upload_time": "2012-03-15T20:30:05", "url": "https://files.pythonhosted.org/packages/a9/99/cf64277fb85ee42f511831c01137ecb2e4a66f39b12115dfbaf5992d1530/django-submodel-0.1.tar.gz" } ] }, "urls": [ { "comment_text": "", "digests": { "md5": "b52f3eb2ecc23055b40e443ddcd308cf", "sha256": "4c709b3a9f5809eb6231f8fb9f00f79684a1163584e970095d4eb78a3ea8d6b3" }, "downloads": -1, "filename": "django-submodel-0.1.tar.gz", "has_sig": false, "md5_digest": "b52f3eb2ecc23055b40e443ddcd308cf", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 3656, "upload_time": "2012-03-15T20:30:05", "url": "https://files.pythonhosted.org/packages/a9/99/cf64277fb85ee42f511831c01137ecb2e4a66f39b12115dfbaf5992d1530/django-submodel-0.1.tar.gz" } ] }