From 7b76481d1d470c4eb494cb3826424ac774410d92 Mon Sep 17 00:00:00 2001 From: tcaxle Date: Sat, 11 Apr 2020 14:01:52 +0100 Subject: [PATCH] Weapons. Migrations. --- app/__pycache__/models.cpython-38.pyc | Bin 9902 -> 10335 bytes app/migrations/0009_auto_20200411_1301.py | 34 ++ .../0009_auto_20200411_1301.cpython-38.pyc | Bin 0 -> 1589 bytes app/models.py | 16 +- .../DESCRIPTION.rst | 269 ++++++++++++++++ .../INSTALLER | 1 + .../METADATA | 294 ++++++++++++++++++ .../RECORD | 25 ++ .../WHEEL | 5 + .../metadata.json | 1 + .../top_level.txt | 1 + .../multiselectfield/__init__.py | 5 + .../__pycache__/__init__.cpython-38.pyc | Bin 0 -> 365 bytes .../__pycache__/apps.cpython-38.pyc | Bin 0 -> 431 bytes .../__pycache__/utils.cpython-38.pyc | Bin 0 -> 641 bytes .../__pycache__/validators.cpython-38.pyc | Bin 0 -> 1142 bytes .../site-packages/multiselectfield/apps.py | 6 + .../multiselectfield/db/__init__.py | 0 .../db/__pycache__/__init__.cpython-38.pyc | Bin 0 -> 155 bytes .../db/__pycache__/fields.cpython-38.pyc | Bin 0 -> 7578 bytes .../multiselectfield/db/fields.py | 205 ++++++++++++ .../multiselectfield/forms/__init__.py | 0 .../forms/__pycache__/__init__.cpython-38.pyc | Bin 0 -> 158 bytes .../forms/__pycache__/fields.cpython-38.pyc | Bin 0 -> 1056 bytes .../multiselectfield/forms/fields.py | 36 +++ .../locale/es/LC_MESSAGES/django.mo | Bin 0 -> 564 bytes .../locale/es/LC_MESSAGES/django.po | 23 ++ .../site-packages/multiselectfield/utils.py | 34 ++ .../multiselectfield/validators.py | 36 +++ .../wheel/__pycache__/__init__.cpython-38.pyc | Bin 0 -> 186 bytes 30 files changed, 988 insertions(+), 3 deletions(-) create mode 100644 app/migrations/0009_auto_20200411_1301.py create mode 100644 app/migrations/__pycache__/0009_auto_20200411_1301.cpython-38.pyc create mode 100644 venv/lib/python3.8/site-packages/django_multiselectfield-0.1.12.dist-info/DESCRIPTION.rst create mode 100644 venv/lib/python3.8/site-packages/django_multiselectfield-0.1.12.dist-info/INSTALLER create mode 100644 venv/lib/python3.8/site-packages/django_multiselectfield-0.1.12.dist-info/METADATA create mode 100644 venv/lib/python3.8/site-packages/django_multiselectfield-0.1.12.dist-info/RECORD create mode 100644 venv/lib/python3.8/site-packages/django_multiselectfield-0.1.12.dist-info/WHEEL create mode 100644 venv/lib/python3.8/site-packages/django_multiselectfield-0.1.12.dist-info/metadata.json create mode 100644 venv/lib/python3.8/site-packages/django_multiselectfield-0.1.12.dist-info/top_level.txt create mode 100644 venv/lib/python3.8/site-packages/multiselectfield/__init__.py create mode 100644 venv/lib/python3.8/site-packages/multiselectfield/__pycache__/__init__.cpython-38.pyc create mode 100644 venv/lib/python3.8/site-packages/multiselectfield/__pycache__/apps.cpython-38.pyc create mode 100644 venv/lib/python3.8/site-packages/multiselectfield/__pycache__/utils.cpython-38.pyc create mode 100644 venv/lib/python3.8/site-packages/multiselectfield/__pycache__/validators.cpython-38.pyc create mode 100644 venv/lib/python3.8/site-packages/multiselectfield/apps.py create mode 100644 venv/lib/python3.8/site-packages/multiselectfield/db/__init__.py create mode 100644 venv/lib/python3.8/site-packages/multiselectfield/db/__pycache__/__init__.cpython-38.pyc create mode 100644 venv/lib/python3.8/site-packages/multiselectfield/db/__pycache__/fields.cpython-38.pyc create mode 100644 venv/lib/python3.8/site-packages/multiselectfield/db/fields.py create mode 100644 venv/lib/python3.8/site-packages/multiselectfield/forms/__init__.py create mode 100644 venv/lib/python3.8/site-packages/multiselectfield/forms/__pycache__/__init__.cpython-38.pyc create mode 100644 venv/lib/python3.8/site-packages/multiselectfield/forms/__pycache__/fields.cpython-38.pyc create mode 100644 venv/lib/python3.8/site-packages/multiselectfield/forms/fields.py create mode 100644 venv/lib/python3.8/site-packages/multiselectfield/locale/es/LC_MESSAGES/django.mo create mode 100644 venv/lib/python3.8/site-packages/multiselectfield/locale/es/LC_MESSAGES/django.po create mode 100644 venv/lib/python3.8/site-packages/multiselectfield/utils.py create mode 100644 venv/lib/python3.8/site-packages/multiselectfield/validators.py create mode 100644 venv/lib/python3.8/site-packages/wheel/__pycache__/__init__.cpython-38.pyc diff --git a/app/__pycache__/models.cpython-38.pyc b/app/__pycache__/models.cpython-38.pyc index 738b4e12623c0ba8798573be7dfa261a0463eec7..dffe3f5c777ec3c2a27ab146dff633df9b2e248f 100644 GIT binary patch delta 2229 zcmZuxTTI(k81HFI`P0(U(n7g)+&j84#x9IGcA+o^j7u2>Hp(1h`~Jf*7j`3-GQDZWv(}@r2i_r%YHD+ef2Z?bpM%|1LUJ_$`Sp0qe{$Vu}((jz#o;!V>LATp!!Qa@2myf-$^|Gg=w%cm4kcGsgWlAK3;JJ0uny`|M?36KXOW4Rk znWSN6zuXsCB>%W8kwF26R0XCAOg0!dm}&}x34`%~$pN#TYQWT(Sza&^+OV`}p$)oq!Ut0>sEt$$ zQ>~fi2eXOlz|@&(0Wh1X9!x!$JY?mA*+N^vY}NCDgTUKpJMeY`7XUZV4&WUIE(C6* zoxnSJg+-(kfqH~?f!d`P0T%-|(Qe?~1}*{KLwkYu>Lt)a!275fxY@w#fTPp`++z4k zfm>-m@P4z%GB9m)0L%fCDF@R|9sK<}OsWD@Cmn?8pvhE%>7s5h-FhW9t^)3%Uf^B> zR|ChW54g|F2!lC9{b2g_Ff!Hy$7uj~z`!-YgERy@q_2k_;e^9<1jG@8*g)2}B{F=E zn<^q!98=SzPbPbppRfiraaCP%o)cHpedk^As`}a0DPB=qvhRxPs>mG`udAc(8{(RB zd8$3vGGrrGkefMls=c0a@s2v~=@vKDo1QZDrQfcecGoz(J+qTDr`22Tk!;z))@>XP zs#~sL(Fd3&jpi1b`M*$@@-KMmd|i;=XAAn>q6yihZiWKt3(r0AF*XXQ&vP0xx*>g} zBEBl#OvSy=iO{HJNTF?F*dr22htyT49j<0>aN?1+Pr-Kr_K)Zd5cS8T8& zXu@NaeMaK5xlj5AL4CuTSyeHv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&~CDBh=+R2KIM$>$KEjDC{%?4luP_-3>;&$b3~4 zttAUtFxoI$G1g+VVYFkc#pobAF3_Rg2_LNF6yTirKA)VIvFdK@3p-^$rgDHyh7EgA z|Ha09^aQ3W_|3avkgU}%D*y6?K5|c_TO8L%J_W&JRvP6zrTqgjhx#~jTjbQpPCMfXhvynkbuUd@maUB6I2iY8D zz5g_(Zq`?>-6rH|V~5HAXg`Q0f@NsKtgT#!O+a1N>Yj*0J&uiuBRb|8=n`u&Ekd5r zs;kX!R9$)(D~t*h)V6q=OBd6~?R301d=7Eevr3JtmiS`sU9UJ#Cg5Tq4pb<0G)i0m#YH+kESjEYaUvgapOWNy_7mTEv)k4x| zBrT!3Q590I9_-I#sG_Nxhvw$0#-bMEA^oisQ-CR;bot=KMJl9Pp zCEtjgWOIPcA(&<7U}kbCJ2svhnkc#^Guesb2Zl0*vC*PagUon-Y+TN$mDKhH{jNxT zE7m-}gpwZ?$uEfHheGmuAo;_V{Q1fgZ1{ta-0_mzS8`8EZZ^rCB)JXbEE~Q#$z_*Z gG|4rQd}w_RxdSt`)DgG7f{9x_=$H~t)z{hiFM@8slmGw# diff --git a/app/migrations/0009_auto_20200411_1301.py b/app/migrations/0009_auto_20200411_1301.py new file mode 100644 index 0000000..19f8203 --- /dev/null +++ b/app/migrations/0009_auto_20200411_1301.py @@ -0,0 +1,34 @@ +# Generated by Django 3.0.5 on 2020-04-11 13:01 + +import app.models +from django.db import migrations + + +class Migration(migrations.Migration): + + dependencies = [ + ('app', '0008_auto_20200411_1255'), + ] + + operations = [ + migrations.AddField( + model_name='itemweaponmelee', + name='category', + field=app.models.SingleChoiceField(blank=True, choices=[('L', 'Light'), ('M', 'Medium'), ('H', 'Heavy')], max_length=100, verbose_name='Category'), + ), + migrations.AddField( + model_name='itemweaponmelee', + name='tags', + field=app.models.MultiChoiceField(blank=True, choices=[('General', (('ONE HANDED', 'One Handed'), ('TWO HANDED', 'Two Handed'), ('BASHING', 'Bashing'), ('CONCEALABLE', 'Concealable'), ('LETHAL', 'Lethal'), ('MOUNTED', 'Mounted'), ('PIERCING', 'Piercing'), ('SPECIAL', 'Special'))), ('Melee', (('MELEE', 'Melee'), ('BALANCED', 'Balanced'), ('BRAWL', 'Brawl'), ('CHOPPING', 'Chopping'), ('DISARMING', 'Disarming'), ('FLEXIBLE', 'Flexible'), ('IMPROVISED', 'Improvised'), ('GRAPPLING', 'Grappling'), ('MARTIAL ARTS', 'Martial Arts'), ('NATURAL', 'Natural'), ('REACHING', 'Reaching'), ('SHIELD', 'Shield'), ('SMASHING', 'Smashing'), ('WORN', 'Worn'))), ('Thrown', (('THROWN', 'Occult'), ('CUTTING', 'Cutting'), ('POISONABLE', 'Poisonable'), ('SUBTLE', 'Subtle'))), ('Archery', (('ARCHERY', 'Archery'), ('CROSSBOW', 'Crossbow'), ('FLAME', 'Flame'), ('POWERFUL', 'Powerful'), ('SLOW', 'Slow')))], max_length=100, verbose_name='Tags'), + ), + migrations.AddField( + model_name='itemweaponranged', + name='category', + field=app.models.SingleChoiceField(blank=True, choices=[('L', 'Light'), ('M', 'Medium'), ('H', 'Heavy')], max_length=100, verbose_name='Category'), + ), + migrations.AddField( + model_name='itemweaponranged', + name='tags', + field=app.models.MultiChoiceField(blank=True, choices=[('General', (('ONE HANDED', 'One Handed'), ('TWO HANDED', 'Two Handed'), ('BASHING', 'Bashing'), ('CONCEALABLE', 'Concealable'), ('LETHAL', 'Lethal'), ('MOUNTED', 'Mounted'), ('PIERCING', 'Piercing'), ('SPECIAL', 'Special'))), ('Melee', (('MELEE', 'Melee'), ('BALANCED', 'Balanced'), ('BRAWL', 'Brawl'), ('CHOPPING', 'Chopping'), ('DISARMING', 'Disarming'), ('FLEXIBLE', 'Flexible'), ('IMPROVISED', 'Improvised'), ('GRAPPLING', 'Grappling'), ('MARTIAL ARTS', 'Martial Arts'), ('NATURAL', 'Natural'), ('REACHING', 'Reaching'), ('SHIELD', 'Shield'), ('SMASHING', 'Smashing'), ('WORN', 'Worn'))), ('Thrown', (('THROWN', 'Occult'), ('CUTTING', 'Cutting'), ('POISONABLE', 'Poisonable'), ('SUBTLE', 'Subtle'))), ('Archery', (('ARCHERY', 'Archery'), ('CROSSBOW', 'Crossbow'), ('FLAME', 'Flame'), ('POWERFUL', 'Powerful'), ('SLOW', 'Slow')))], max_length=100, verbose_name='Tags'), + ), + ] diff --git a/app/migrations/__pycache__/0009_auto_20200411_1301.cpython-38.pyc b/app/migrations/__pycache__/0009_auto_20200411_1301.cpython-38.pyc new file mode 100644 index 0000000000000000000000000000000000000000..f664cbf6545b036a1f98cca21bb923a1b64675ee GIT binary patch literal 1589 zcma)6&5z?W6mOfPNi&_@*#!y2X%1Y%VcHp32_yuQrkS=ufTP&&+3)lBo;^D})Eh8<{_Ur4KR;+ReizK^ zLk8v?{_+Eua055<#-a&pD{rl(h16_}8d$>ej}0sn=~DhdTFAH=HVowz$TvKr$@O)X zGE`->C=;>w`sf044uAP8Or*BFXyInsTu4N|RB#JRq?Q);ro$B{OIMYkUEX#H z&bDj8jJYx<=<4Pb25`7$-6|O}SC%;{zT;}LqFF*pfEZoJIVsX=#k*I8Eon*O0WCDCq1@1n)(hSD?BlWN4ecS&1vwt00uwAwqPc&6 z67A^y30DVZIG%VTAW*r=iWH0poPljxHO^W6ZBBsh#_{)Cl#44MI7~JKTDwRxQnFTk!%U1X1c*#Ldc0jD z9y}eN{QK$nuzz~8xnUC6QsFO8VA7=4-?Ab%TkyU6*B$lVJ@v-kAGNNbEOhX8vd?Cp lS_fYOSo8!h>&$DphoJY=H{gzIpYGxNOhi!%ShQwW`Uepf)rSB8 literal 0 HcmV?d00001 diff --git a/app/models.py b/app/models.py index fa7ff21..5004b27 100644 --- a/app/models.py +++ b/app/models.py @@ -1,4 +1,5 @@ from django.db import models +import multiselectfield #==============================================================================# #-------------------------------- OPTION LISTS --------------------------------# @@ -87,7 +88,7 @@ CATEGORIES = [ ("H", "Heavy"), ] -TAGS_WEAPON = [ +TAGS_WEAPONS = [ ( "General", ( ("ONE HANDED", "One Handed"), @@ -181,6 +182,14 @@ class SingleChoiceField(models.CharField): kwargs['max_length'] = 100 super().__init__(*args, **kwargs) +class MultiChoiceField(multiselectfield.MultiSelectField): + def __init__(self, verbose_name, choices, *args, **kwargs): + kwargs['verbose_name'] = verbose_name + kwargs['choices'] = choices + kwargs['blank'] = True + kwargs['max_length'] = 100 + super().__init__(*args, **kwargs) + class NamedIntegerField(models.IntegerField): def __init__(self, verbose_name, desc=None, *args, **kwargs): kwargs['verbose_name'] = verbose_name @@ -196,6 +205,7 @@ class NamedCharField(models.CharField): kwargs['max_length'] = 100 super().__init__(*args, **kwargs) + #==============================================================================# #--------------------------------- MODIFIERS ----------------------------------# #==============================================================================# @@ -233,8 +243,8 @@ class itemWeaponBase(itemBase): class Meta: abstract = True - # category - # tags + category = SingleChoiceField("Category", CATEGORIES) + tags = MultiChoiceField("Tags", TAGS_WEAPONS) accuracy = NamedIntegerField("Accuracy") damage = NamedIntegerField("Damage") defense = NamedIntegerField("Defense") diff --git a/venv/lib/python3.8/site-packages/django_multiselectfield-0.1.12.dist-info/DESCRIPTION.rst b/venv/lib/python3.8/site-packages/django_multiselectfield-0.1.12.dist-info/DESCRIPTION.rst new file mode 100644 index 0000000..05eb001 --- /dev/null +++ b/venv/lib/python3.8/site-packages/django_multiselectfield-0.1.12.dist-info/DESCRIPTION.rst @@ -0,0 +1,269 @@ +django-multiselectfield +======================= + +.. image:: https://travis-ci.org/goinnn/django-multiselectfield.png?branch=master + :target: https://travis-ci.org/goinnn/django-multiselectfield + +.. image:: https://coveralls.io/repos/goinnn/django-multiselectfield/badge.png?branch=master + :target: https://coveralls.io/r/goinnn/django-multiselectfield + +.. image:: https://badge.fury.io/py/django-multiselectfield.png + :target: https://badge.fury.io/py/django-multiselectfield + +A new model field and form field. With this you can get a multiple select from a choices. Stores to the database as a CharField of comma-separated values. + +This egg is inspired by this `snippet `_. + +Supported Python versions: 2.7, 3.4+ + +Supported Django versions: 1.4-2.0+ + +Installation +============ + + +Install with pip +---------------- + +.. code-block:: bash + + $ pip install django-multiselectfield + +Configure your models.py +------------------------ + +.. code-block:: python + + from multiselectfield import MultiSelectField + + # ... + + MY_CHOICES = (('item_key1', 'Item title 1.1'), + ('item_key2', 'Item title 1.2'), + ('item_key3', 'Item title 1.3'), + ('item_key4', 'Item title 1.4'), + ('item_key5', 'Item title 1.5')) + + MY_CHOICES2 = ((1, 'Item title 2.1'), + (2, 'Item title 2.2'), + (3, 'Item title 2.3'), + (4, 'Item title 2.4'), + (5, 'Item title 2.5')) + + class MyModel(models.Model): + + # ..... + + my_field = MultiSelectField(choices=MY_CHOICES) + my_field2 = MultiSelectField(choices=MY_CHOICES2, + max_choices=3, + max_length=3) + + +In your settings.py +------------------- + +Only you need it, if you want the translation of django-multiselectfield + +.. code-block:: python + + INSTALLED_APPS = ( + 'django.contrib.auth', + 'django.contrib.contenttypes', + 'django.contrib.sessions', + 'django.contrib.sites', + 'django.contrib.admin', + + #.....................# + + 'multiselectfield', + ) + + +Customizing templates +--------------------- + +It is possible to customize the HTML of this widget in your form template. To do so, you will need to loop through ``form.{field}.field.choices``. Here is an example that displays the field label underneath/after the checkbox for a ``MultiSelectField`` called ``providers``: + +.. code-block:: HTML+Django + + {% for value, text in form.providers.field.choices %} +
+ + +
+ {% endfor %} + + +Django REST Framework +--------------------- + +Django REST Framework comes with a ``MultipleChoiceField`` that works perfectly with this: + +.. code-block:: python + + from rest_framework import fields, serializers + + from myapp.models import MY_CHOICES, MY_CHOICES2 + + class MyModelSerializer(serializers.HyperlinkedModelSerializer): + # ... + my_field = fields.MultipleChoiceField(choices=MY_CHOICES) + my_field2 = fields.MultipleChoiceField(choices=MY_CHOICES2) + # ... + + +Known Bugs and Limitations +========================== + +All tests pass on Django 1.4, 1.5, and 1.8+, so if you can, use a modern version of Django. However, if you must use Django 1.6 or 1.7 there are two known issues you will need to be aware of: + +1. `Named groups `_ do not render properly in Django 1.6. The workaround is to manually render the field in your form or use a custom widget. If your workaround is suitably generic, please submit a pull request with it. + +2. Only in Django 1.6 and 1.7, due to `Django bug #9619 `_, passing a MultiSelectField to ``values()`` or ``values_list()`` will return the database representation of the field (a string of comma-separated values). The workaround is to manually call ``.split(',')`` on the result. + + The Django bug was introduced in Django 1.6 and is fixed in Django 1.8 and onward, so ``values()`` and ``values_list()`` return a vanilla Python list of values for Django <= 1.5 and Django >= 1.8. + + See `issue #40 `_ for discussion about this bug. + + +Development +=========== + +You can get the last bleeding edge version of django-multiselectfield by doing a clone +of its git repository: + +.. code-block:: bash + + git clone https://github.com/goinnn/django-multiselectfield + + +Example project +=============== + +There is a fully configured example project in the `example directory `_. You can run it as usual: + +.. code-block:: bash + + python manage.py migrate # or python manage.py syncdb --noinput + python manage.py loaddata app_data + python manage.py runserver + + +0.1.12 (2020-02-20) +------------------- + +* Optimize multiselectfield to_python method +* Thanks to: + * `daimon99 `_ + +0.1.11 (2019-12-19) +------------------- + +* Added support for Django 3 +* Added support for Python 3.8 +* Thanks to: + * `thijsBoehme `_ + +0.1.9 (2019-10-02) +------------------ + +* Added support for Django 2 +* Added support for Python 3.6 +* Drop support for Python (2.6, 3.3) +* Thanks to: + * `hirokinko `_ + +0.1.6 (2017-05-10) +------------------ + +* Added support for Django 1.11 +* Added support for Python 3.6 +* Improved rendering in Django admin +* Improved documentation +* Thanks to: + * `atten `_ + * `ixc `_ + * `LeilaniAnn `_ + +0.1.5 (2017-01-02) +------------------ + +* Added support for Django 1.8-1.10 +* Added support for named groups in choices +* Added support for min_choices argument +* Various fixes +* More tests +* Thanks to: + * `danilogbotelho `_ + * `dmitry-krasilnikov `_ + * `Kamil Dębowski `_ + +0.1.4 (2016-02-23) +------------------ + +* Fixed warning about SubfieldBase +* Added support for Django 1.8+ +* Added support for named groups +* We now play nice with django-dynamic-fixture +* More tests + +0.1.3 (2014-10-13) +------------------ + +* Support to Django 1.7 (I'm sorry to the delay) +* Adding get_FIELD_list function +* Fix an error when a MultiSelectField was reandonly at the admin site +* Thanks to: + * `Hernil `_ + * `Vasyl Stanislavchuk `_ + * `Litchfield `_ + * `Chris-erickson `_ + +0.1.2 (2014-04-04) +------------------ + +* Include the spanish translations to the pypi egg +* Improvements in the readme file +* Windows OS compatibility +* Thanks to: + * `StillNewb `_ + * `Diego Yungh `_ + +0.1.1 (2013-12-04) +------------------ +* Move the multiselectfield app to parent folder +* Details + +0.1.0 (2013-11-30) +------------------ + +* Test/example project +* Now works if the first composant of the list of tuple is an integer +* Now max_length is not required, the Multiselect field calculate it automatically. +* The max_choices attr can be a attr in the model field +* Refactor the code +* Spanish translations +* Support to python2.6 +* Thanks to: + * `Daniele Procida `_ + +0.0.3 (2013-09-11) +------------------ + +* Python 3 compatible +* Fix an error, the snippet had another error when the choices were translatables +* Improvements in the README file + + +0.0.2 (2012-09-28) +------------------ + +* Fix an error, the snippet had an error. + +0.0.1 (2012-09-27) +------------------ + +* Initial version from the next `snippet `_ + + diff --git a/venv/lib/python3.8/site-packages/django_multiselectfield-0.1.12.dist-info/INSTALLER b/venv/lib/python3.8/site-packages/django_multiselectfield-0.1.12.dist-info/INSTALLER new file mode 100644 index 0000000..a1b589e --- /dev/null +++ b/venv/lib/python3.8/site-packages/django_multiselectfield-0.1.12.dist-info/INSTALLER @@ -0,0 +1 @@ +pip diff --git a/venv/lib/python3.8/site-packages/django_multiselectfield-0.1.12.dist-info/METADATA b/venv/lib/python3.8/site-packages/django_multiselectfield-0.1.12.dist-info/METADATA new file mode 100644 index 0000000..ecf2b5a --- /dev/null +++ b/venv/lib/python3.8/site-packages/django_multiselectfield-0.1.12.dist-info/METADATA @@ -0,0 +1,294 @@ +Metadata-Version: 2.0 +Name: django-multiselectfield +Version: 0.1.12 +Summary: Django multiple select field +Home-page: https://github.com/goinnn/django-multiselectfield +Author: Pablo Martin +Author-email: goinnn@gmail.com +License: LGPL 3 +Keywords: django,multiple,select,field,choices +Platform: UNKNOWN +Classifier: Development Status :: 4 - Beta +Classifier: Framework :: Django +Classifier: License :: OSI Approved :: GNU Library or Lesser General Public License (LGPL) +Classifier: Programming Language :: Python :: 2 +Classifier: Programming Language :: Python :: 2.6 +Classifier: Programming Language :: Python :: 2.7 +Classifier: Programming Language :: Python :: 3 +Classifier: Programming Language :: Python :: 3.3 +Classifier: Programming Language :: Python :: 3.4 +Classifier: Programming Language :: Python :: 3.5 +Classifier: Programming Language :: Python :: 3.6 +Classifier: Programming Language :: Python :: 3.7 +Classifier: Programming Language :: Python :: 3.8 +Requires-Dist: django (>=1.4) + +django-multiselectfield +======================= + +.. image:: https://travis-ci.org/goinnn/django-multiselectfield.png?branch=master + :target: https://travis-ci.org/goinnn/django-multiselectfield + +.. image:: https://coveralls.io/repos/goinnn/django-multiselectfield/badge.png?branch=master + :target: https://coveralls.io/r/goinnn/django-multiselectfield + +.. image:: https://badge.fury.io/py/django-multiselectfield.png + :target: https://badge.fury.io/py/django-multiselectfield + +A new model field and form field. With this you can get a multiple select from a choices. Stores to the database as a CharField of comma-separated values. + +This egg is inspired by this `snippet `_. + +Supported Python versions: 2.7, 3.4+ + +Supported Django versions: 1.4-2.0+ + +Installation +============ + + +Install with pip +---------------- + +.. code-block:: bash + + $ pip install django-multiselectfield + +Configure your models.py +------------------------ + +.. code-block:: python + + from multiselectfield import MultiSelectField + + # ... + + MY_CHOICES = (('item_key1', 'Item title 1.1'), + ('item_key2', 'Item title 1.2'), + ('item_key3', 'Item title 1.3'), + ('item_key4', 'Item title 1.4'), + ('item_key5', 'Item title 1.5')) + + MY_CHOICES2 = ((1, 'Item title 2.1'), + (2, 'Item title 2.2'), + (3, 'Item title 2.3'), + (4, 'Item title 2.4'), + (5, 'Item title 2.5')) + + class MyModel(models.Model): + + # ..... + + my_field = MultiSelectField(choices=MY_CHOICES) + my_field2 = MultiSelectField(choices=MY_CHOICES2, + max_choices=3, + max_length=3) + + +In your settings.py +------------------- + +Only you need it, if you want the translation of django-multiselectfield + +.. code-block:: python + + INSTALLED_APPS = ( + 'django.contrib.auth', + 'django.contrib.contenttypes', + 'django.contrib.sessions', + 'django.contrib.sites', + 'django.contrib.admin', + + #.....................# + + 'multiselectfield', + ) + + +Customizing templates +--------------------- + +It is possible to customize the HTML of this widget in your form template. To do so, you will need to loop through ``form.{field}.field.choices``. Here is an example that displays the field label underneath/after the checkbox for a ``MultiSelectField`` called ``providers``: + +.. code-block:: HTML+Django + + {% for value, text in form.providers.field.choices %} +
+ + +
+ {% endfor %} + + +Django REST Framework +--------------------- + +Django REST Framework comes with a ``MultipleChoiceField`` that works perfectly with this: + +.. code-block:: python + + from rest_framework import fields, serializers + + from myapp.models import MY_CHOICES, MY_CHOICES2 + + class MyModelSerializer(serializers.HyperlinkedModelSerializer): + # ... + my_field = fields.MultipleChoiceField(choices=MY_CHOICES) + my_field2 = fields.MultipleChoiceField(choices=MY_CHOICES2) + # ... + + +Known Bugs and Limitations +========================== + +All tests pass on Django 1.4, 1.5, and 1.8+, so if you can, use a modern version of Django. However, if you must use Django 1.6 or 1.7 there are two known issues you will need to be aware of: + +1. `Named groups `_ do not render properly in Django 1.6. The workaround is to manually render the field in your form or use a custom widget. If your workaround is suitably generic, please submit a pull request with it. + +2. Only in Django 1.6 and 1.7, due to `Django bug #9619 `_, passing a MultiSelectField to ``values()`` or ``values_list()`` will return the database representation of the field (a string of comma-separated values). The workaround is to manually call ``.split(',')`` on the result. + + The Django bug was introduced in Django 1.6 and is fixed in Django 1.8 and onward, so ``values()`` and ``values_list()`` return a vanilla Python list of values for Django <= 1.5 and Django >= 1.8. + + See `issue #40 `_ for discussion about this bug. + + +Development +=========== + +You can get the last bleeding edge version of django-multiselectfield by doing a clone +of its git repository: + +.. code-block:: bash + + git clone https://github.com/goinnn/django-multiselectfield + + +Example project +=============== + +There is a fully configured example project in the `example directory `_. You can run it as usual: + +.. code-block:: bash + + python manage.py migrate # or python manage.py syncdb --noinput + python manage.py loaddata app_data + python manage.py runserver + + +0.1.12 (2020-02-20) +------------------- + +* Optimize multiselectfield to_python method +* Thanks to: + * `daimon99 `_ + +0.1.11 (2019-12-19) +------------------- + +* Added support for Django 3 +* Added support for Python 3.8 +* Thanks to: + * `thijsBoehme `_ + +0.1.9 (2019-10-02) +------------------ + +* Added support for Django 2 +* Added support for Python 3.6 +* Drop support for Python (2.6, 3.3) +* Thanks to: + * `hirokinko `_ + +0.1.6 (2017-05-10) +------------------ + +* Added support for Django 1.11 +* Added support for Python 3.6 +* Improved rendering in Django admin +* Improved documentation +* Thanks to: + * `atten `_ + * `ixc `_ + * `LeilaniAnn `_ + +0.1.5 (2017-01-02) +------------------ + +* Added support for Django 1.8-1.10 +* Added support for named groups in choices +* Added support for min_choices argument +* Various fixes +* More tests +* Thanks to: + * `danilogbotelho `_ + * `dmitry-krasilnikov `_ + * `Kamil Dębowski `_ + +0.1.4 (2016-02-23) +------------------ + +* Fixed warning about SubfieldBase +* Added support for Django 1.8+ +* Added support for named groups +* We now play nice with django-dynamic-fixture +* More tests + +0.1.3 (2014-10-13) +------------------ + +* Support to Django 1.7 (I'm sorry to the delay) +* Adding get_FIELD_list function +* Fix an error when a MultiSelectField was reandonly at the admin site +* Thanks to: + * `Hernil `_ + * `Vasyl Stanislavchuk `_ + * `Litchfield `_ + * `Chris-erickson `_ + +0.1.2 (2014-04-04) +------------------ + +* Include the spanish translations to the pypi egg +* Improvements in the readme file +* Windows OS compatibility +* Thanks to: + * `StillNewb `_ + * `Diego Yungh `_ + +0.1.1 (2013-12-04) +------------------ +* Move the multiselectfield app to parent folder +* Details + +0.1.0 (2013-11-30) +------------------ + +* Test/example project +* Now works if the first composant of the list of tuple is an integer +* Now max_length is not required, the Multiselect field calculate it automatically. +* The max_choices attr can be a attr in the model field +* Refactor the code +* Spanish translations +* Support to python2.6 +* Thanks to: + * `Daniele Procida `_ + +0.0.3 (2013-09-11) +------------------ + +* Python 3 compatible +* Fix an error, the snippet had another error when the choices were translatables +* Improvements in the README file + + +0.0.2 (2012-09-28) +------------------ + +* Fix an error, the snippet had an error. + +0.0.1 (2012-09-27) +------------------ + +* Initial version from the next `snippet `_ + + diff --git a/venv/lib/python3.8/site-packages/django_multiselectfield-0.1.12.dist-info/RECORD b/venv/lib/python3.8/site-packages/django_multiselectfield-0.1.12.dist-info/RECORD new file mode 100644 index 0000000..50c9c93 --- /dev/null +++ b/venv/lib/python3.8/site-packages/django_multiselectfield-0.1.12.dist-info/RECORD @@ -0,0 +1,25 @@ +django_multiselectfield-0.1.12.dist-info/DESCRIPTION.rst,sha256=QjtRluOTQmWzudG8mNHhBKQb7foYzHq7ZxCs3PAx1bM,8179 +django_multiselectfield-0.1.12.dist-info/INSTALLER,sha256=zuuue4knoyJ-UwPPXg8fezS7VCrXJQrAP7zeNuwvFQg,4 +django_multiselectfield-0.1.12.dist-info/METADATA,sha256=PF35_c0b7aDHBn_nVLS8Hs63e_S6wRZTs0khOvADJ4Q,9172 +django_multiselectfield-0.1.12.dist-info/RECORD,, +django_multiselectfield-0.1.12.dist-info/WHEEL,sha256=8Lm45v9gcYRm70DrgFGVe4WsUtUMi1_0Tso1hqPGMjA,92 +django_multiselectfield-0.1.12.dist-info/metadata.json,sha256=1R2BnZqhvSNaPVMsgYuBM9Hn50w_spOvHiwh7IdYYfk,1216 +django_multiselectfield-0.1.12.dist-info/top_level.txt,sha256=Y5vMmoRWcEEnorayclFbrq60Hy-7-EM5TAhBEw-rlec,17 +multiselectfield/__init__.py,sha256=YhzWaV3qo676EhtgUXuwWZBggKuLuls_8G2ytQqHBmY,217 +multiselectfield/__pycache__/__init__.cpython-38.pyc,, +multiselectfield/__pycache__/apps.cpython-38.pyc,, +multiselectfield/__pycache__/utils.cpython-38.pyc,, +multiselectfield/__pycache__/validators.cpython-38.pyc,, +multiselectfield/apps.py,sha256=qcW5RvrLleieNOz4swZ1QA5SCvX7zDHwY4QcoNr9y30,146 +multiselectfield/db/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0 +multiselectfield/db/__pycache__/__init__.cpython-38.pyc,, +multiselectfield/db/__pycache__/fields.cpython-38.pyc,, +multiselectfield/db/fields.py,sha256=tRm8Ux8aJZJ3Oacr7AYpnN6c88b1u7MgmP0lg-KPi10,7959 +multiselectfield/forms/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0 +multiselectfield/forms/__pycache__/__init__.cpython-38.pyc,, +multiselectfield/forms/__pycache__/fields.cpython-38.pyc,, +multiselectfield/forms/fields.py,sha256=dqaqK9bWwuRpJKBE1DcmsydcqU0OH0RGK3XXrOF-9XA,1659 +multiselectfield/locale/es/LC_MESSAGES/django.mo,sha256=xqKsXhCPHi0YJI_s5ug4syKyoDGdQ_TEwuZzRZoiWNM,564 +multiselectfield/locale/es/LC_MESSAGES/django.po,sha256=5uPlVcG897BqGXxBk-pPleMWUAypNVsZsf8s6JlERVk,770 +multiselectfield/utils.py,sha256=Ojf4Iomw9dheF3ZaHQ_oNB3RsA-d-X3uHtZX95HfDJo,1153 +multiselectfield/validators.py,sha256=E4xwHf56W_WtQ3nE_6WUPUl_DDLrMKjBB9ZKSSvbQfM,1310 diff --git a/venv/lib/python3.8/site-packages/django_multiselectfield-0.1.12.dist-info/WHEEL b/venv/lib/python3.8/site-packages/django_multiselectfield-0.1.12.dist-info/WHEEL new file mode 100644 index 0000000..6261a26 --- /dev/null +++ b/venv/lib/python3.8/site-packages/django_multiselectfield-0.1.12.dist-info/WHEEL @@ -0,0 +1,5 @@ +Wheel-Version: 1.0 +Generator: bdist_wheel (0.30.0) +Root-Is-Purelib: true +Tag: py3-none-any + diff --git a/venv/lib/python3.8/site-packages/django_multiselectfield-0.1.12.dist-info/metadata.json b/venv/lib/python3.8/site-packages/django_multiselectfield-0.1.12.dist-info/metadata.json new file mode 100644 index 0000000..d90475d --- /dev/null +++ b/venv/lib/python3.8/site-packages/django_multiselectfield-0.1.12.dist-info/metadata.json @@ -0,0 +1 @@ +{"classifiers": ["Development Status :: 4 - Beta", "Framework :: Django", "License :: OSI Approved :: GNU Library or Lesser General Public License (LGPL)", "Programming Language :: Python :: 2", "Programming Language :: Python :: 2.6", "Programming Language :: Python :: 2.7", "Programming Language :: Python :: 3", "Programming Language :: Python :: 3.3", "Programming Language :: Python :: 3.4", "Programming Language :: Python :: 3.5", "Programming Language :: Python :: 3.6", "Programming Language :: Python :: 3.7", "Programming Language :: Python :: 3.8"], "extensions": {"python.details": {"contacts": [{"email": "goinnn@gmail.com", "name": "Pablo Martin", "role": "author"}], "document_names": {"description": "DESCRIPTION.rst"}, "project_urls": {"Home": "https://github.com/goinnn/django-multiselectfield"}}}, "extras": [], "generator": "bdist_wheel (0.30.0)", "keywords": ["django", "multiple", "select", "field", "choices"], "license": "LGPL 3", "metadata_version": "2.0", "name": "django-multiselectfield", "run_requires": [{"requires": ["django (>=1.4)"]}], "summary": "Django multiple select field", "test_requires": [{"requires": ["coverage", "django (>=1.4)", "flake8", "tox"]}], "version": "0.1.12"} \ No newline at end of file diff --git a/venv/lib/python3.8/site-packages/django_multiselectfield-0.1.12.dist-info/top_level.txt b/venv/lib/python3.8/site-packages/django_multiselectfield-0.1.12.dist-info/top_level.txt new file mode 100644 index 0000000..a2dd0c2 --- /dev/null +++ b/venv/lib/python3.8/site-packages/django_multiselectfield-0.1.12.dist-info/top_level.txt @@ -0,0 +1 @@ +multiselectfield diff --git a/venv/lib/python3.8/site-packages/multiselectfield/__init__.py b/venv/lib/python3.8/site-packages/multiselectfield/__init__.py new file mode 100644 index 0000000..24eac54 --- /dev/null +++ b/venv/lib/python3.8/site-packages/multiselectfield/__init__.py @@ -0,0 +1,5 @@ +from multiselectfield.db.fields import MultiSelectField # noqa: F401 +from multiselectfield.forms.fields import MultiSelectFormField # noqa: F401 + + +default_app_config = 'multiselectfield.apps.MultiSelectFieldConfig' diff --git a/venv/lib/python3.8/site-packages/multiselectfield/__pycache__/__init__.cpython-38.pyc b/venv/lib/python3.8/site-packages/multiselectfield/__pycache__/__init__.cpython-38.pyc new file mode 100644 index 0000000000000000000000000000000000000000..c9c3dd2dcb828a642d62e3a878c58fb34479aa49 GIT binary patch literal 365 zcmWIL<>g`kf^GXI#@z(ck3k${zy#zt0CBMbkVs)jVa#F3WsG8E1hJWNm~xq;n1O8O zD3%nKUfMO!ZV);e6VDT!QT#(9Qu*x)$ zO1;E_f?_>nwIEUF{JgZxbU#hjC@BmLDM@-@oyA2U*G9==C`bd^Rt!_a3{oSMlA4wX zv^XAUS$s0s?3D~fEI=tR@yk}fB)34nAhSTXG_N2rIXg8)w>%>?HAgqCFt@bAJULk( n-4gxy_{_Y_lK6PNg34PQHo5sJr8%i~j6f5MLB{eh@-PDc^vrD> literal 0 HcmV?d00001 diff --git a/venv/lib/python3.8/site-packages/multiselectfield/__pycache__/apps.cpython-38.pyc b/venv/lib/python3.8/site-packages/multiselectfield/__pycache__/apps.cpython-38.pyc new file mode 100644 index 0000000000000000000000000000000000000000..eeb3e6c4167c01f83d194009981105c247b08698 GIT binary patch literal 431 zcmZ8dy-veG48F^yQd(LGB*fe`Lz@vHAyk9}6J08n8#smdS^}5knrrx5%L~9;@B)lH zNLD6ZfeAZ7qQa6t+uwa>TfP_!dJOIT z5Sp)r^uV97u=9l~7V^4#Z0$*r&(lRh%%*WHCg^S#K{LsL;cqSlc+v-fUHp3QyfUkF zrj1Tkr>Qp3_LAEf@vh7oVc+ z-|6zIaJtdIu`A%3Gny~6>R~@gqW{Z8v9)e&A4`Ev s=x~l8;687dX(;3t+{F2!7?ZN}XclSzrnXrZxjHy(7eAtdInwsU4;eXYEC2ui literal 0 HcmV?d00001 diff --git a/venv/lib/python3.8/site-packages/multiselectfield/__pycache__/utils.cpython-38.pyc b/venv/lib/python3.8/site-packages/multiselectfield/__pycache__/utils.cpython-38.pyc new file mode 100644 index 0000000000000000000000000000000000000000..2a0a21260504b2d99a75b53d757839c2764a6cca GIT binary patch literal 641 zcmY*W%We}f6!l|X3T*|uA|Zhg3r1=ZRv@7$LV|TS5t|VZP3@b+jpxy^2O5+vQ2GP? z16c9{ELrmn-m=Osbj9^R)N)7n%(X}7G4|X2{T{*k@$>4#mw=GpesQ}vE?!}q=LnKW zs!2wGoKi{d6UmmWc?2xu5M*JQK!g*|LK(?GhL<#pC7qBo-XfPAZyDnD7lQDryYh30 z{TkaGA*@k*nKVz=q zVUEoAci*uKdciERHuQ>}1rzd}q}1Ipwo&DLYF9O++_Awk$Ct2jq0Uc0H$GSg*Dr^* zsE4(x`)yh0VhOVUX#t@7v$LW-e<8%MXth-aGzdFWpyjZ&N}EBwa=npO#)_(_#}9of zA1}h^^W!<#X_22#HI#F^7>sl!a&5*q>w@IjdanBscK)lw9=h q9k-g`kf^GXI#)0U^AOaaM0yz#qT+9L_QW%06G#UL?G8BP?5yUSC{gT`Q{esK_ z-O{{*#N_PM6y5TS)YKf^w8Grd3iIS-{oK-=lFZ`NoYdr!w9M3;6#bMW{rLFIyv&mL Yc)fzkTO2mI`6;D2sdgZfKLarX06j`34*&oF literal 0 HcmV?d00001 diff --git a/venv/lib/python3.8/site-packages/multiselectfield/db/__pycache__/fields.cpython-38.pyc b/venv/lib/python3.8/site-packages/multiselectfield/db/__pycache__/fields.cpython-38.pyc new file mode 100644 index 0000000000000000000000000000000000000000..01fe7608bc8ce981829cfbb4fb0b44c5a19f6d80 GIT binary patch literal 7578 zcmbVR%X8$$c}D}78O(#j;bWhoR+O}oGKs|XBa!W7vsp_P6*&@}h_+%QmJo0nBtc>Z z!v;pXI~i6~;a0??94D^IEjf_6q_)aczPWNp`47Q0m+U1ui`|yn5=LMg zEXmrTq0(U4UFq4us=FfVvhmn(ue@u>1=)OT$YyZ$#B#5py(n8~w*vd%I(lvdrd-0@ ze+jOj=jMqBZk!1B#&8W(E=SLG*W5LHVQtTlD|_Mu)c>*3TeXeg`NNv}cVY1NBco^j z5c}LV+N)2oXJe}^vdTyAe7ODI_gF1=V;MvVYEH-R?}jQ#QLhCLJ3&7U<6iRA#H6;B zt$r|w(r`P7f=;>_tL|nPL^50XAnd)pABUYF`N)q#>8G(mr~h!i6N@(Yg4FB!54|Yp z?WOzZc@6_HZ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NQ%?!vP}1)RUi z(^*KiBJFG8Jv_fxLTD>w39ZUiCUf;)MP;uMiw zYMctjy*b)trjLeCeOA-}IerMpVV+q)zsLmx`IfY?>`Ly|_A23@42br%wIHpl1Iaw2aI zts!HmUyxbM*BV+;s4Pu*8wVI~RY%k4SdA&5X6|8h6AFMfjvK zH$1Q2r|!MYUJbGS3^k_55^{@)#jIOc!DC(HUkS)Ht2pWB z&fZhVWhTRoPr7seaQt{f?rh|Lar}5=UU=KL6tlfz8PQ?&Q)(zrcH z!zkI%7Ms%R*2n$$ODf32g$6NLGX9!|eUoffR?_not&+OWf*CON+bFWiI6a%YLRw7y zhlmc6wG(u!Z}0nRlNztt;WoAhJ9<-Z;h!S+N)iv!{f+!jKg1v834*}SxOV-$ZXeQ^ zTan3eOccqvn +# +# This program is free software: you can redistribute it and/or modify +# it under the terms of the GNU Lesser General Public License as published by +# the Free Software Foundation, either version 3 of the License, or +# (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU Lesser General Public License for more details. +# +# You should have received a copy of the GNU Lesser General Public License +# along with this programe. If not, see . + +import sys + +from django import VERSION + +from django.db import models +from django.utils.text import capfirst +from django.core import exceptions + +from ..forms.fields import MultiSelectFormField, MinChoicesValidator, MaxChoicesValidator +from ..utils import get_max_length +from ..validators import MaxValueMultiFieldValidator + +if sys.version_info < (3,): + string_type = unicode # noqa: F821 +else: + string_type = str + +# Code from six egg https://bitbucket.org/gutworth/six/src/a3641cb211cc360848f1e2dd92e9ae6cd1de55dd/six.py?at=default + + +def add_metaclass(metaclass): + """Class decorator for creating a class with a metaclass.""" + def wrapper(cls): + orig_vars = cls.__dict__.copy() + orig_vars.pop('__dict__', None) + orig_vars.pop('__weakref__', None) + for slots_var in orig_vars.get('__slots__', ()): + orig_vars.pop(slots_var) + return metaclass(cls.__name__, cls.__bases__, orig_vars) + return wrapper + + +class MSFList(list): + + def __init__(self, choices, *args, **kwargs): + self.choices = choices + super(MSFList, self).__init__(*args, **kwargs) + + def __str__(msgl): + msg_list = [msgl.choices.get(int(i)) if i.isdigit() else msgl.choices.get(i) for i in msgl] + return u', '.join([string_type(s) for s in msg_list]) + + if sys.version_info < (3,): + def __unicode__(self, msgl): + return self.__str__(msgl) + + +class MultiSelectField(models.CharField): + """ Choice values can not contain commas. """ + + def __init__(self, *args, **kwargs): + self.min_choices = kwargs.pop('min_choices', None) + self.max_choices = kwargs.pop('max_choices', None) + super(MultiSelectField, self).__init__(*args, **kwargs) + self.max_length = get_max_length(self.choices, self.max_length) + self.validators[0] = MaxValueMultiFieldValidator(self.max_length) + if self.min_choices is not None: + self.validators.append(MinChoicesValidator(self.min_choices)) + if self.max_choices is not None: + self.validators.append(MaxChoicesValidator(self.max_choices)) + + def _get_flatchoices(self): + flat_choices = super(MultiSelectField, self)._get_flatchoices() + + class MSFFlatchoices(list): + # Used to trick django.contrib.admin.utils.display_for_field into + # not treating the list of values as a dictionary key (which errors + # out) + def __bool__(self): + return False + __nonzero__ = __bool__ + return MSFFlatchoices(flat_choices) + flatchoices = property(_get_flatchoices) + + def get_choices_default(self): + return self.get_choices(include_blank=False) + + def get_choices_selected(self, arr_choices): + named_groups = arr_choices and isinstance(arr_choices[0][1], (list, tuple)) + choices_selected = [] + if named_groups: + for choice_group_selected in arr_choices: + for choice_selected in choice_group_selected[1]: + choices_selected.append(string_type(choice_selected[0])) + else: + for choice_selected in arr_choices: + choices_selected.append(string_type(choice_selected[0])) + return choices_selected + + def value_to_string(self, obj): + try: + value = self._get_val_from_obj(obj) + except AttributeError: + value = super(MultiSelectField, self).value_from_object(obj) + return self.get_prep_value(value) + + def validate(self, value, model_instance): + arr_choices = self.get_choices_selected(self.get_choices_default()) + for opt_select in value: + if (opt_select not in arr_choices): + if VERSION >= (1, 6): + raise exceptions.ValidationError(self.error_messages['invalid_choice'] % {"value": value}) + else: + raise exceptions.ValidationError(self.error_messages['invalid_choice'] % value) + + def get_default(self): + default = super(MultiSelectField, self).get_default() + if isinstance(default, int): + default = string_type(default) + return default + + def formfield(self, **kwargs): + defaults = {'required': not self.blank, + 'label': capfirst(self.verbose_name), + 'help_text': self.help_text, + 'choices': self.choices, + 'max_length': self.max_length, + 'max_choices': self.max_choices} + if self.has_default(): + defaults['initial'] = self.get_default() + defaults.update(kwargs) + return MultiSelectFormField(**defaults) + + def get_prep_value(self, value): + return '' if value is None else ",".join(map(str, value)) + + def get_db_prep_value(self, value, connection, prepared=False): + if not prepared and not isinstance(value, string_type): + value = self.get_prep_value(value) + return value + + def to_python(self, value): + choices = dict(self.flatchoices) + + if value: + if isinstance(value, list): + return value + elif isinstance(value, string_type): + value_list = map(lambda x: x.strip(), value.replace(u',', ',').split(',')) + return MSFList(choices, value_list) + elif isinstance(value, (set, dict)): + return MSFList(choices, list(value)) + return MSFList(choices, []) + + if VERSION < (2, ): + def from_db_value(self, value, expression, connection, context): + if value is None: + return value + return self.to_python(value) + else: + def from_db_value(self, value, expression, connection): + if value is None: + return value + return self.to_python(value) + + def contribute_to_class(self, cls, name): + super(MultiSelectField, self).contribute_to_class(cls, name) + if self.choices: + def get_list(obj): + fieldname = name + choicedict = dict(self.choices) + display = [] + if getattr(obj, fieldname): + for value in getattr(obj, fieldname): + item_display = choicedict.get(value, None) + if item_display is None: + try: + item_display = choicedict.get(int(value), value) + except (ValueError, TypeError): + item_display = value + display.append(string_type(item_display)) + return display + + def get_display(obj): + return ", ".join(get_list(obj)) + get_display.short_description = self.verbose_name + + setattr(cls, 'get_%s_list' % self.name, get_list) + setattr(cls, 'get_%s_display' % self.name, get_display) + + +if VERSION < (1, 8): + MultiSelectField = add_metaclass(models.SubfieldBase)(MultiSelectField) + +try: + from south.modelsinspector import add_introspection_rules + add_introspection_rules([], ['^multiselectfield\.db.fields\.MultiSelectField']) +except ImportError: + pass diff --git a/venv/lib/python3.8/site-packages/multiselectfield/forms/__init__.py b/venv/lib/python3.8/site-packages/multiselectfield/forms/__init__.py new file mode 100644 index 0000000..e69de29 diff --git a/venv/lib/python3.8/site-packages/multiselectfield/forms/__pycache__/__init__.cpython-38.pyc b/venv/lib/python3.8/site-packages/multiselectfield/forms/__pycache__/__init__.cpython-38.pyc new file mode 100644 index 0000000000000000000000000000000000000000..49ba9151b5d7b1760869bd05dd899edb6514fcd3 GIT binary patch literal 158 zcmWIL<>g`kf^GXI#)0U^AOaaM0yz#qT+9L_QW%06G#UL?G8BP?5yUTN{gT`Q{esK_ z-O{{*#N_PM6y5TS)YKf^w8Grd3iIS-{oK-=lFZ`NoYdr!w9M3;6#caPqTFKr`1s7c b%#!$cy@JYH95%W6DWy57b|Aw)12F>t!Z;^$ literal 0 HcmV?d00001 diff --git a/venv/lib/python3.8/site-packages/multiselectfield/forms/__pycache__/fields.cpython-38.pyc b/venv/lib/python3.8/site-packages/multiselectfield/forms/__pycache__/fields.cpython-38.pyc new file mode 100644 index 0000000000000000000000000000000000000000..12998cc0f4f940b34f524c680da2da819ac3c14b GIT binary patch literal 1056 zcmZuwKW`H;6t~ZJmrI(2(w090v9M)mGqNBAR4P-uR4{nJI?hgViSKf???@=wQmGpf z3j1Bixr~A^+0vco?4YLMqVDtv@fQJ`|hXRkIC815;I7Pka7UG~D zHo;)3GJWgSs5=xT%i=kcA|IBc9x;!Pz}DYEEW9gVilb|9ff#nkTOrROvO=Wv%V2?)-Z)&qxi7$L*;t@)1e+}F zZ30^Js#R_|3%-UEph2`rQ=PATZEIPseUKM?-&Vd3d~xmL2>S6)%vP4>EUDQ80Hm)$ zYvTpFh7{96HK844M?`IbFoCWLp;Tn`h_N(JOU9IK-ZcJ3`M7>3ZNj)HM9x)UBQ&gl zA+xOdTF8O%V>N_BlbQYAVAEtQk+If{-JsvE`ej!1i?rCU@*++qg742pLdgBWSys)T zB}qTCqXB{7Wd?RY`fjHBPS*#;C)I^yk6`OP5D0hOZwGJV9o%yJ{K@}b_h8*wFS1?c zaV8iuEyl7bucX!6jGa}ntUbyOF};5{63OJlbY72&i(5!R!&%B +# +# This program is free software: you can redistribute it and/or modify +# it under the terms of the GNU Lesser General Public License as published by +# the Free Software Foundation, either version 3 of the License, or +# (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU Lesser General Public License for more details. +# +# You should have received a copy of the GNU Lesser General Public License +# along with this programe. If not, see . + +from django import forms + +from ..utils import get_max_length +from ..validators import MaxValueMultiFieldValidator, MinChoicesValidator, MaxChoicesValidator + + +class MultiSelectFormField(forms.MultipleChoiceField): + widget = forms.CheckboxSelectMultiple + + def __init__(self, *args, **kwargs): + self.min_choices = kwargs.pop('min_choices', None) + self.max_choices = kwargs.pop('max_choices', None) + self.max_length = kwargs.pop('max_length', None) + super(MultiSelectFormField, self).__init__(*args, **kwargs) + self.max_length = get_max_length(self.choices, self.max_length) + self.validators.append(MaxValueMultiFieldValidator(self.max_length)) + if self.max_choices is not None: + self.validators.append(MaxChoicesValidator(self.max_choices)) + if self.min_choices is not None: + self.validators.append(MinChoicesValidator(self.min_choices)) diff --git a/venv/lib/python3.8/site-packages/multiselectfield/locale/es/LC_MESSAGES/django.mo b/venv/lib/python3.8/site-packages/multiselectfield/locale/es/LC_MESSAGES/django.mo new file mode 100644 index 0000000000000000000000000000000000000000..0af76427a572308b7bcd039ef9952b5c01b3b7cc GIT binary patch literal 564 zcmaKpO-|h~5XVDRHd%Jv#jrpEwey;QK**2RmO@aU)bPSnK%$$&5f$3E4B^CGnbACU%LzDq@>BCN7qe0I>I1uT6hTl^3^kF{lxRw=!tGB3 zyPcKBnD?FLQjHp`-%^I@BJTv&f@=nae@ZmO({frC|J0Z6TN8w#i?4gCAc(8*rdM2= zF?|hpUWCa>eTX}Mb;ASCg~P%$ww0!1u(OaMtyFYe;h}ZfGcf)A)=xIZ@Ze6?46IBb mUmvGQ9ibHq;c0&8QbT{k9Yh2A_6Ie~4w3&`W&1%k^y&^up{2I~ literal 0 HcmV?d00001 diff --git a/venv/lib/python3.8/site-packages/multiselectfield/locale/es/LC_MESSAGES/django.po b/venv/lib/python3.8/site-packages/multiselectfield/locale/es/LC_MESSAGES/django.po new file mode 100644 index 0000000..f4da1aa --- /dev/null +++ b/venv/lib/python3.8/site-packages/multiselectfield/locale/es/LC_MESSAGES/django.po @@ -0,0 +1,23 @@ +# django-multiselectfield. +# Copyright (C) 2012-2013 +# This file is distributed under the same license as the PACKAGE package. +# FIRST AUTHOR , 2012. +# +msgid "" +msgstr "" +"Project-Id-Version: 1.0.0\n" +"Report-Msgid-Bugs-To: \n" +"POT-Creation-Date: 2013-11-30 20:06-0500\n" +"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" +"Last-Translator: Pablo Martín \n" +"Language-Team: Es \n" +"Language: Es\n" +"MIME-Version: 1.0\n" +"Content-Type: text/plain; charset=UTF-8\n" +"Content-Transfer-Encoding: 8bit\n" +"Plural-Forms: nplurals=2; plural=(n != 1);\n" + +#: validators.py:28 +#, python-format +msgid "You must select a maximum of %(limit_value)d choices." +msgstr "Tu debes de seleccionar un máximo de %(limit_value)d opciones." diff --git a/venv/lib/python3.8/site-packages/multiselectfield/utils.py b/venv/lib/python3.8/site-packages/multiselectfield/utils.py new file mode 100644 index 0000000..56c5d93 --- /dev/null +++ b/venv/lib/python3.8/site-packages/multiselectfield/utils.py @@ -0,0 +1,34 @@ +# -*- coding: utf-8 -*- +# Copyright (c) 2013 by Pablo Martín +# +# This program is free software: you can redistribute it and/or modify +# it under the terms of the GNU Lesser General Public License as published by +# the Free Software Foundation, either version 3 of the License, or +# (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU Lesser General Public License for more details. +# +# You should have received a copy of the GNU Lesser General Public License +# along with this programe. If not, see . + +import sys + + +if sys.version_info[0] == 2: + string = basestring # noqa: F821 + string_type = unicode # noqa: F821 +else: + string = str + string_type = string + + +def get_max_length(choices, max_length, default=200): + if max_length is None: + if choices: + return len(','.join([string_type(key) for key, label in choices])) + else: + return default + return max_length diff --git a/venv/lib/python3.8/site-packages/multiselectfield/validators.py b/venv/lib/python3.8/site-packages/multiselectfield/validators.py new file mode 100644 index 0000000..b387680 --- /dev/null +++ b/venv/lib/python3.8/site-packages/multiselectfield/validators.py @@ -0,0 +1,36 @@ +# -*- coding: utf-8 -*- +# Copyright (c) 2013 by Pablo Martín +# +# This program is free software: you can redistribute it and/or modify +# it under the terms of the GNU Lesser General Public License as published by +# the Free Software Foundation, either version 3 of the License, or +# (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU Lesser General Public License for more details. +# +# You should have received a copy of the GNU Lesser General Public License +# along with this programe. If not, see . + + +from django.core import validators +from django.utils.translation import gettext_lazy as _ + + +class MaxValueMultiFieldValidator(validators.MaxLengthValidator): + code = 'max_multifield_value' + + def clean(self, x): + return len(','.join(x)) + + +class MinChoicesValidator(validators.MinLengthValidator): + message = _(u'You must select a minimum of %(limit_value)d choices.') + code = 'min_choices' + + +class MaxChoicesValidator(validators.MaxLengthValidator): + message = _(u'You must select a maximum of %(limit_value)d choices.') + code = 'max_choices' diff --git a/venv/lib/python3.8/site-packages/wheel/__pycache__/__init__.cpython-38.pyc b/venv/lib/python3.8/site-packages/wheel/__pycache__/__init__.cpython-38.pyc new file mode 100644 index 0000000000000000000000000000000000000000..f64c9bc342c4cc3c321473550f81e6647b22451f GIT binary patch literal 186 zcmWIL<>g`kg5SIoWqw%Tn{o^m8(k z^b0CWGV=3`^(^#@GfPr+3lfvF6Vp?R^~*C-Q*-p=<1_OzOXB183My}L*yQG?l;)(` Kf!y;Mh#3GpfiKJe literal 0 HcmV?d00001