{"id":13502457,"url":"https://github.com/ulule/django-separatedvaluesfield","last_synced_at":"2025-08-19T18:41:24.148Z","repository":{"id":57421851,"uuid":"14959987","full_name":"ulule/django-separatedvaluesfield","owner":"ulule","description":"Custom field for Django to separate multiple values in database with a separator and retrieve them as list","archived":false,"fork":false,"pushed_at":"2024-09-30T13:46:24.000Z","size":34,"stargazers_count":26,"open_issues_count":5,"forks_count":10,"subscribers_count":4,"default_branch":"master","last_synced_at":"2025-03-26T09:47:27.387Z","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":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/ulule.png","metadata":{"files":{"readme":"README.rst","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2013-12-05T17:01:01.000Z","updated_at":"2025-03-04T10:44:07.000Z","dependencies_parsed_at":"2024-10-31T21:32:08.442Z","dependency_job_id":"bf71944f-ae42-4ba6-9f01-a38695b1a407","html_url":"https://github.com/ulule/django-separatedvaluesfield","commit_stats":{"total_commits":48,"total_committers":5,"mean_commits":9.6,"dds":0.4375,"last_synced_commit":"750d212817b8320f8030d95a225deec88a9b4f84"},"previous_names":["thoas/django-separatedvaluesfield"],"tags_count":6,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ulule%2Fdjango-separatedvaluesfield","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ulule%2Fdjango-separatedvaluesfield/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ulule%2Fdjango-separatedvaluesfield/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ulule%2Fdjango-separatedvaluesfield/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/ulule","download_url":"https://codeload.github.com/ulule/django-separatedvaluesfield/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":246174208,"owners_count":20735406,"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-07-31T22:02:14.593Z","updated_at":"2025-03-29T10:32:59.816Z","avatar_url":"https://github.com/ulule.png","language":"Python","funding_links":[],"categories":["Python"],"sub_categories":[],"readme":"django-separatedvaluesfield\n===========================\n\n.. image:: https://secure.travis-ci.org/ulule/django-separatedvaluesfield.svg?branch=master\n    :alt: Build Status\n    :target: http://travis-ci.org/ulule/django-separatedvaluesfield\n\nAlternative to CommaSeparatedIntegerField_ built-in field that supports\nMultipleChoiceField_, custom separator and returns values as list.\n\nInstallation\n------------\n\nInstall package from PyPi_::\n\n    pip install django-separatedvaluesfield\n\nOr download the archive from GitHub_ and proceed to a manual installation::\n\n    curl -L https://github.com/ulule/django-separatedvaluesfield/tarball/master | tar zx\n    cd thoas-django-separatedvaluesfield\n    python setup.py install\n\nAdd ``SeparatedValuesField`` to your Django model:\n\n.. code:: python\n\n    # models.py\n    from django.db import models\n\n    from separatedvaluesfield.models import SeparatedValuesField\n\n    class Project(models.Model):\n        name = models.CharField(max_length=150)\n        languages = SeparatedValuesField(\n            max_length=150,\n            token=',',\n            choices=(\n                ('en', 'English'),\n                ('fr', 'French')))\n\nIf your choices values are not strings, add the ``cast`` option with the type\nyou want to apply on values (defaults to ``django.utils.six.text_type``):\n\n.. code:: python\n\n    # models.py\n    from django.db import models\n\n    from separatedvaluesfield.models import SeparatedValuesField\n\n    class Project(models.Model):\n        name = models.CharField(max_length=150)\n        languages = SeparatedValuesField(\n            max_length=150,\n            cast=int,\n            token=',',\n            choices=(\n                (1, 'English'),\n                (2, 'French')))\n\nIf you are running Django \u003c= 1.6, synchronize your database using ``syncdb``::\n\n    python manage.py syncdb\n\nIf you are running Django \u003e= 1.7, synchronize your database using ``migrate``::\n\n    python manage.py migrate\n\nThe ``SeparatedValuesField`` behaves like a ``CharField`` which separates values with\na token (default is ``,``).\n\nThis field is transformed as a MultipleChoiceField_ when you are\ncreating a ``forms.ModelForm`` with your model.\n\nUsage\n-----\n\n.. code:: pycon\n\n    \u003e\u003e\u003e from myapp.models import Project\n    \u003e\u003e\u003e project = Project(name='Project with strings', languages=['fr', 'en'])\n    \u003e\u003e\u003e project.save() # save 'fr,en' in database for the column \"languages\"\n    \u003e\u003e\u003e project.pk\n    1\n\n    \u003e\u003e\u003e project = Project.objects.get(pk=1)\n    \u003e\u003e\u003e project.languages\n    ['fr', 'en']\n\n    # If you added \"cast\" option to the field to cast to 'int'\n    \u003e\u003e\u003e project = Project(name='Project with integers', languages=[u'1', u'2'])\n    \u003e\u003e\u003e project.save() # save '1,2' in database for the column \"languages\"\n    \u003e\u003e\u003e project = Project.objects.get(pk=1)\n    \u003e\u003e\u003e project.languages\n    [1, 2]\n\nContribute\n----------\n\n1. Fork the repository\n2. Clone your fork\n3. Create a dedicated branch (never ever work in ``master``)\n4. Create your development environment with ``make dev``\n5. Activate your environment with ``source .venv/bin/activate``\n6. Make modifications\n7. Write tests and execute them with ``make test``\n8. Be sure all test pass with ``tox``\n9. If all tests pass, submit a pull request\n\n.. _CommaSeparatedIntegerField: https://docs.djangoproject.com/en/dev/ref/models/fields/#commaseparatedintegerfield\n.. _PyPi: https://pypi.python.org/\n.. _GitHub: https://github.com/ulule/django-separatedvaluesfield\n.. _MultipleChoiceField: https://docs.djangoproject.com/en/dev/ref/forms/fields/#multiplechoicefield\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fulule%2Fdjango-separatedvaluesfield","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fulule%2Fdjango-separatedvaluesfield","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fulule%2Fdjango-separatedvaluesfield/lists"}