{ "info": { "author": "Rishi Hindocha", "author_email": "rishi@linux.com", "bugtrack_url": null, "classifiers": [ "Development Status :: 4 - Beta", "Environment :: Web Environment", "Framework :: Django", "License :: OSI Approved :: MIT License", "Natural Language :: English", "Operating System :: OS Independent", "Programming Language :: Python :: 3", "Programming Language :: Python :: 3.5", "Programming Language :: Python :: 3.6", "Programming Language :: Python :: 3.7", "Topic :: Software Development :: Libraries :: Application Frameworks", "Topic :: Software Development :: Libraries :: Python Modules" ], "description": "django-user-fields\n==================\nA Django application that makes user creation of form fields simple, handling everything from form generation to data storage and retrieval.\n\nThis was initially built for `MUN Manager `_ to allow conferences to collect whatever information they wanted to during all parts of the registration process. django-user-fields allows conferences to easily add their own extra fields to various forms using a simple admin interface creating a tailored experience.\n\nSimple Installation and Usage Guide\n===================================\n\n1. Install ``django-user-fields``:\n\n.. code-block::\n\n $ pip install django-user-fields\n\n2. Add ``user_fields`` to your installed apps:\n\n.. code-block::\n\n INSTALLED_APPS = (\n ...\n 'user_fields',\n ...\n )\n\n3. Run a database migration:\n\n.. code-block::\n\n $ python manage.py migrate\n\n4. Create an ``ExtendedExtraField`` model:\n\n.. code-block::\n\n from user_fields.models import ExtraField\n\n class ExtendedExtraField(ExtraField):\n\n # You can add any custom fields you'd like here to make filtering fields easier.\n # A list of all predefined fields can be found below.\n\n5. Add the ``@initialise_extra_fields`` decorator to your form:\n\n.. code-block::\n\n from user_fields.decorators import initialise_extra_fields\n\n @initialise_extra_fields\n class ExampleForm(forms.ModelForm):\n\n6. Add the ``UserFieldMixin`` to the object(s) you would like to have extra fields:\n\n.. code-block::\n\n from user_fields.mixins import UserFieldMixin\n\n class ExampleObject(models.Model, UserFieldMixin):\n\n7. Add a ``UserDataField`` to the object for storage and migrate:\n\n.. code-block::\n\n from user_fields.models import UserDataField, ExtraField\n\n class ExampleObject(models.Model, UserFieldMixin):\n\n extra_data = UserDataField()\n\n $ python manage.py migrate\n\n**Note**: If ``extra_data`` is taken and/or you would like to name the storage field something else, you can define ``USER_FIELDS_ATTR_NAME`` in your settings.\n\n8. Create and pass some extra fields to your form:\n\n.. code-block::\n\n extra_fields = ExtendedExtraField.objects.filter(parameter=something)\n\n form = ExampleForm(... extra_fields=extra_fields, ...)\n\n9. Add an extra line to save the extra fields to your object:\n\n.. code-block::\n\n object = form.save()\n object.save_extra_form_data(form) # Ensures that both object and form save functions are not overwritten.\n\nSupported Fields\n================\n\n- ``CharField``\n- ``CharField With Choices``\n- ``TextField``\n- ``BooleanField``\n- ``EmailField``\n\nFeel free to submit a pull request if you would like to add more fields. Most fields should be relatively easy to add, although ``FileField`` will be an interesting challenge!\n\n``ExtraField`` Attributes\n=========================\n\n+-------------+------------+---------------------------------------------------+------------------------------+\n| Proper Name | Name | Description | Example |\n+=============+============+===================================================+==============================+\n| Name | name | Equivalent to the HTML ``input`` name parameter. | example-field (slug format) |\n+-------------+------------+---------------------------------------------------+------------------------------+\n| Label | label | Django form field label (rendered name). | Example Field |\n+-------------+------------+---------------------------------------------------+------------------------------+\n| Help Text | help_text | Django form field help text. | This is some guidance. |\n+-------------+------------+---------------------------------------------------+------------------------------+\n| Required | required | Django form field required parameter. | True / False |\n+-------------+------------+---------------------------------------------------+------------------------------+\n| Field Type | field_type | Dropdown with all supported fields. | CharField (char) |\n+-------------+------------+---------------------------------------------------+------------------------------+\n| Max. Length | max_length | CharField (only) max length. | 35 |\n+-------------+------------+---------------------------------------------------+------------------------------+\n| Choices | choices | Choices for the ``CharField With Choices``. | Option 1,Option 2,Option 3 |\n+-------------+------------+---------------------------------------------------+------------------------------+\n\n``UserFieldMixin`` Functions\n============================\n\n``.retrieve_extra_data(ExtraField, formatted=True/False)``: Returns the data stored for a given field. If formatted is True, it will return the `value` for the ``CharField With Choices``, otherwise it will return the `key` of the choice.\n\n``.save_extra_data(ExtraField, data)``: Saves the data supplied for a given field to the object.\n\n``.save_extra_form_data(Form)``: Saves all of the extra field data in a form to the object.\n\n``.delete_extra_data(ExtraField)``: Deletes all of the data associated with a given field.\n\nTo Do\n=====\n\n- Improve documentation.\n- Implement testing.\n- Add support for more fields.\n\n\n", "description_content_type": "", "docs_url": null, "download_url": "", "downloads": { "last_day": -1, "last_month": -1, "last_week": -1 }, "home_page": "https://github.com/Rishk/django-user-fields", "keywords": "django custom user defined form fields", "license": "MIT", "maintainer": "", "maintainer_email": "", "name": "django-user-fields", "package_url": "https://pypi.org/project/django-user-fields/", "platform": "", "project_url": "https://pypi.org/project/django-user-fields/", "project_urls": { "Homepage": "https://github.com/Rishk/django-user-fields" }, "release_url": "https://pypi.org/project/django-user-fields/0.1.0/", "requires_dist": [ "Django (>=2.0)" ], "requires_python": "", "summary": "A Django application that makes user creation of form fields simple.", "version": "0.1.0" }, "last_serial": 4219725, "releases": { "0.1.0": [ { "comment_text": "", "digests": { "md5": "ff9573c94cdbb6488a904388958aaa82", "sha256": "f52d204504602b053d652d3128469dae2083dc29bf589587c27539b97fb95518" }, "downloads": -1, "filename": "django_user_fields-0.1.0-py3-none-any.whl", "has_sig": false, "md5_digest": "ff9573c94cdbb6488a904388958aaa82", "packagetype": "bdist_wheel", "python_version": "py3", "requires_python": null, "size": 8182, "upload_time": "2018-08-29T17:29:21", "url": "https://files.pythonhosted.org/packages/17/c4/cdce4f9191723b128202458b31ec529c00c5c7a227e0b9ac469b2aa33b1d/django_user_fields-0.1.0-py3-none-any.whl" } ] }, "urls": [ { "comment_text": "", "digests": { "md5": "ff9573c94cdbb6488a904388958aaa82", "sha256": "f52d204504602b053d652d3128469dae2083dc29bf589587c27539b97fb95518" }, "downloads": -1, "filename": "django_user_fields-0.1.0-py3-none-any.whl", "has_sig": false, "md5_digest": "ff9573c94cdbb6488a904388958aaa82", "packagetype": "bdist_wheel", "python_version": "py3", "requires_python": null, "size": 8182, "upload_time": "2018-08-29T17:29:21", "url": "https://files.pythonhosted.org/packages/17/c4/cdce4f9191723b128202458b31ec529c00c5c7a227e0b9ac469b2aa33b1d/django_user_fields-0.1.0-py3-none-any.whl" } ] }