2012-09-27 12:08:07 +00:00
|
|
|
django-multiselectfield
|
|
|
|
=======================
|
|
|
|
|
2012-09-27 14:03:17 +00:00
|
|
|
A new model and form field. With this you can get a multiple select from a choices
|
|
|
|
|
|
|
|
This egg is done from a `snippet <http://djangosnippets.org/snippets/1200/>`_
|
|
|
|
|
|
|
|
Installation
|
|
|
|
============
|
|
|
|
|
|
|
|
In your settings.py
|
|
|
|
-------------------
|
|
|
|
|
|
|
|
::
|
|
|
|
|
|
|
|
INSTALLED_APPS = (
|
|
|
|
'django.contrib.auth',
|
|
|
|
'django.contrib.contenttypes',
|
|
|
|
'django.contrib.sessions',
|
|
|
|
'django.contrib.sites',
|
|
|
|
'django.contrib.admin',
|
|
|
|
|
|
|
|
#.....................#
|
|
|
|
|
|
|
|
'multiselectfield',
|
|
|
|
)
|
|
|
|
|
|
|
|
|
|
|
|
In your models.py
|
|
|
|
-----------------
|
|
|
|
|
|
|
|
::
|
|
|
|
|
|
|
|
from multiselectfield import MultiSelectField
|
|
|
|
|
|
|
|
...
|
|
|
|
|
2013-09-11 08:49:03 +00:00
|
|
|
MY_CHOICES = (('item_key1', 'Item title1'),
|
|
|
|
('item_key2', 'Item title2'),
|
|
|
|
('item_key3', 'Item title3'),
|
|
|
|
('item_key4', 'Item title4'),
|
|
|
|
('item_key5', 'Item title5'))
|
|
|
|
|
2012-09-27 14:03:17 +00:00
|
|
|
class MyModel(models.Model):
|
|
|
|
|
|
|
|
.....
|
|
|
|
|
2013-09-11 08:49:03 +00:00
|
|
|
my_field = MultiSelectField(choices=MY_CHOICES, max_length=20)
|
2012-09-27 14:03:17 +00:00
|
|
|
|
|
|
|
|
|
|
|
Development
|
|
|
|
===========
|
|
|
|
|
|
|
|
You can get the last bleeding edge version of django-configfield by doing a clone
|
2013-09-11 08:49:03 +00:00
|
|
|
of its git repository::
|
2012-09-27 14:03:17 +00:00
|
|
|
|
|
|
|
git clone https://github.com/goinnn/django-multiselectfield
|