{ "info": { "author": "Martin Brochhaus", "author_email": "mbrochh@gmail.com", "bugtrack_url": null, "classifiers": [], "description": "Django Crowdsourced Fields\n==========================\n\nA reusable Django app that allows to mark certain fields of your models as\nmasterdata. Users would still be able to enter their own values but the app\nwill map them to unique instances. Admin staff is able to review all user\ngenerated entries and mark them as approved.\n\nAn example could be a vehicle site, where you would like to allow users to\nenter make and model for their vehicle but you want to make sure that an\nentry of \"bmw\" and \"Bmw\" results in \"BMW\".\n\nThe app also comes with a nice jQuery combobox for such fields, where user get\nauto-suggestions while they type.\n\nInstallation\n------------\n\nYou need to install the following prerequisites in order to use this app::\n\n pip install Django\n pip install South\n\nIf you want to install the latest stable release from PyPi::\n\n $ pip install django-crowdsourced-fields\n\nIf you feel adventurous and want to install the latest commit from GitHub::\n\n $ pip install -e git://github.com/bitmazk/django-crowdsourced-fields.git#egg=crowdsourced_fields\n\nAdd ``crowdsourced_fields`` to your ``INSTALLED_APPS``::\n\n INSTALLED_APPS = (\n ...,\n 'crowdsourced_fields',\n )\n\nDon't forget to migrate your database::\n\n ./manage.py migrate crowdsourced_fields\n\nAdd jQuery and jQuery UI to your base template or at least to the template that \nshould display forms with crowdsourced fields. Also include the jQuery UI\nstyles and special styles provided by this app::\n\n \n {{ form.media.css }}\n\n \n \n {{ form.media.js }}\n\nYou might want to include the jQuery and jQuery UI parts in your base template\nand the ``{{ form.media }}`` parts only in the template that uses a form with\ncrowdsourced fields.\n\nUsage\n-----\n\nPrepare your models\n+++++++++++++++++++\n\nFirst you need to modify the model that should have crowdsourced fields::\n\n from crowdsourced_fields.models import CrowdSourcedModelMixin\n\n class YourModel(CrowdsourcedModelMixin, models.Model):\n CROWDSOURCED_FIELDS = {\n 'make': {'item_type': 'makes', }\n 'model': {'item_type': 'models', }\n }\n\n make = models.CharField(...)\n model = models.CharField(...)\n\n``CROWDSOURCED_FIELDS`` is a dictionary of dictionaries. The main keys are the\nfields that should be crowdsourced. This must be ``CharFields``.\n\nThe inner dictionary supports the following keys as settings:\n\n1. **item_type (mandatory)**: The name of the group under which the data of\n this field should be grouped. Let's assume you have two models and both have\n a field ``country`` which should have access to the same data. By giving\n the same ``item_type`` for the field on both models, they will use the same\n set of crowdsourced data.\n\nFor each field that you selected, the mixin will dynamically add a method\ncalled ``fieldname_crowdsourced`` to the model. Therefore we will save both,\nthe value that the user actually entered (in it's original field) and a link to \nthe unique and approved value that we maintain through this app.\n\nFor your staff users it is save to change the values of the\n``CrowdsourcedItem`` objects. Since you should use those in your templates,\nany typo fixes would be reflected on your site immediately without the need\nof a datamigration.\n\nCreate a model form\n+++++++++++++++++++\n\nNext you would create a ``ModelForm`` for your model with crowdsourced fields::\n\n from django import forms\n from crowdsourced_fields.forms import CrowdsourcedFieldsFormMixin\n from your_app.models import YourModel\n\n class YourModelForm(CrowdsourcedFieldsFormMixin, forms.ModelForm):\n class Meta:\n model = YourModel\n\nThe ``CrowdsourcedFieldsFormMixin`` will do the magic for you and add replace\nthe original form field (a text input) with a combobox that has all existing\nvalues ready for autosuggest.\n\nCreate your template\n++++++++++++++++++++\n\nAs mentioned above, first make sure that jQuery, jQuery UI and the form's media\nis available in your template.\n\nAfter that you can initiate the comboboxes like so::\n\n $(document).ready(function(){\n $('#id_country').combobox({\n source: {{ form.country_crowdsourced_values|safe }}\n });\n });\n\nIn this case ``country`` would be the name of the form field.\n\n\nContribute\n----------\n\nIf you want to contribute to this project, please perform the following steps::\n\n # Fork this repository\n # Clone your fork\n $ mkvirtualenv -p python2.7 django-crowdsourced-fields\n $ pip install -r requirements.txt\n $ ./online_docs/tests/runtests.sh\n # You should get no failing tests\n\n $ git co -b feature_branch master\n # Implement your feature and tests\n $ ./crowdsourced_fields/tests/runtests.sh\n # You should still get no failing tests\n # Describe your change in the CHANGELOG.txt\n $ git add . && git commit\n $ git push origin feature_branch\n # Send us a pull request for your feature branch\n\nWhenever you run the tests a coverage output will be generated in\n``tests/coverage/index.html``. When adding new features, please make sure that\nyou keep the coverage at 100%.\n\nIf you are making changes that need to be tested in a browser (i.e. to the\nCSS or JS files), you might want to setup a Django project, follow the\ninstallation insttructions above, then run ``python setup.py develop``. This\nwill just place an egg-link to your cloned fork in your project's virtualenv.\n\nRoadmap\n-------\n\nCheck the issue tracker on github for milestones and features to come.", "description_content_type": null, "docs_url": null, "download_url": "UNKNOWN", "downloads": { "last_day": -1, "last_month": -1, "last_week": -1 }, "home_page": "https://github.com/bitmazk/django-crowdsourced-fields", "keywords": "django,ORM,jQuery,combobox,models,fields", "license": "The MIT License", "maintainer": null, "maintainer_email": null, "name": "django-crowdsourced-fields", "package_url": "https://pypi.org/project/django-crowdsourced-fields/", "platform": "OS Independent", "project_url": "https://pypi.org/project/django-crowdsourced-fields/", "project_urls": { "Download": "UNKNOWN", "Homepage": "https://github.com/bitmazk/django-crowdsourced-fields" }, "release_url": "https://pypi.org/project/django-crowdsourced-fields/0.4/", "requires_dist": null, "requires_python": null, "summary": "A reusable Django app that allows to mark certain fields of your models as\nmasterdata. Users would still be able to enter their own values but the app\nwill map them to unique instances. Admin staff is able to review all user\ngenerated entriesand mark them as approved.", "version": "0.4" }, "last_serial": 789399, "releases": { "0.1": [ { "comment_text": "", "digests": { "md5": "679c856d62a90ea0810aa28f8a8edf13", "sha256": "c8b16b33321a3731d887eb35514b7a7218757f2a1c4ecf133f74d2178d310d4e" }, "downloads": -1, "filename": "django-crowdsourced-fields-0.1.tar.gz", "has_sig": false, "md5_digest": "679c856d62a90ea0810aa28f8a8edf13", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 11254, "upload_time": "2012-12-05T14:45:43", "url": "https://files.pythonhosted.org/packages/8b/1f/946be414bd2b444f0a9390976423025f419275ce140822c7d7ec69884bb8/django-crowdsourced-fields-0.1.tar.gz" } ], "0.2": [ { "comment_text": "", "digests": { "md5": "7f6983d1616a2ce2f6801d55d1f7c4c8", "sha256": "9641a62cf888aff0bf53253c9b5ee9ab8361acdefa2532d4828dfa909cb3f5ed" }, "downloads": -1, "filename": "django-crowdsourced-fields-0.2.tar.gz", "has_sig": false, "md5_digest": "7f6983d1616a2ce2f6801d55d1f7c4c8", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 11651, "upload_time": "2012-12-06T03:02:37", "url": "https://files.pythonhosted.org/packages/e3/3b/7d47129f2daf0ad268bb708309b492c9ed925974b84fee8e5737dfbcb703/django-crowdsourced-fields-0.2.tar.gz" } ], "0.3": [ { "comment_text": "", "digests": { "md5": "d55b990e7bca374ad421af6598425be3", "sha256": "8871dd128c9a85b5cbb77a2758ee0bccbc561bdd2321657c78c3d127c9309a8b" }, "downloads": -1, "filename": "django-crowdsourced-fields-0.3.tar.gz", "has_sig": false, "md5_digest": "d55b990e7bca374ad421af6598425be3", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 100165, "upload_time": "2012-12-06T03:24:06", "url": "https://files.pythonhosted.org/packages/44/bf/6a5aae2e64d1dd97a710c0fe39d6770b20e3865eb0e049cb531c43d61253/django-crowdsourced-fields-0.3.tar.gz" } ], "0.4": [ { "comment_text": "", "digests": { "md5": "02cea99893df64603f1d8289454d1011", "sha256": "f20e1218be9f36e158c0af99dfb6c74f2e8fffc5c42ccaaa50be50bc6cf331c3" }, "downloads": -1, "filename": "django-crowdsourced-fields-0.4.tar.gz", "has_sig": false, "md5_digest": "02cea99893df64603f1d8289454d1011", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 100967, "upload_time": "2012-12-07T07:07:05", "url": "https://files.pythonhosted.org/packages/6d/eb/98905399cfccb6821ef2de3db3608b6a2a1322099e572d9464971848d5ca/django-crowdsourced-fields-0.4.tar.gz" } ] }, "urls": [ { "comment_text": "", "digests": { "md5": "02cea99893df64603f1d8289454d1011", "sha256": "f20e1218be9f36e158c0af99dfb6c74f2e8fffc5c42ccaaa50be50bc6cf331c3" }, "downloads": -1, "filename": "django-crowdsourced-fields-0.4.tar.gz", "has_sig": false, "md5_digest": "02cea99893df64603f1d8289454d1011", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 100967, "upload_time": "2012-12-07T07:07:05", "url": "https://files.pythonhosted.org/packages/6d/eb/98905399cfccb6821ef2de3db3608b6a2a1322099e572d9464971848d5ca/django-crowdsourced-fields-0.4.tar.gz" } ] }