You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
* It was created to add support for MultiSelectFields in Admin.list_display. But it never does work. If you add a multiselect field to list_display, django does not call to __str__ method of MSGList (renamed to MSFList)
10
-
* It was created for integer choices too and it is a misconception. Explained in the README file.
9
+
* It was created to support MultiSelectFields in admin.list_display, but it never actually worked. If you add a multiselect field to list_display, Django does not call to __str__ method of MSGList (renamed to MSFList)
10
+
* It was created for integer choices too and it is a misconception. This is explained in the README file.
* Now, in list_display, the labels of the choices are shown (separated by commas) instead of the values (separated by commas).
15
+
* In list_display, labels for the choices are now shown (comma-separated) instead of the values of the choices (comma-separated).
16
16
17
-
* In to_python method value is a list or a string. (`c4579138dda2833cbce26afbf57da5353aa45690 <https://github.com/goinnn/django-multiselectfield/commit/c4579138dda2833cbce26afbf57da5353aa45690>`_)
17
+
* In to_python method, value is a list or a string. (`c4579138dda2833cbce26afbf57da5353aa45690 <https://github.com/goinnn/django-multiselectfield/commit/c4579138dda2833cbce26afbf57da5353aa45690>`_)
18
18
19
19
* Remove set case and dict case
20
-
* Please, If this breaks something, you can create a test to understand the use case
20
+
* If this breaks something, please create a test to help understand the use case.
21
21
22
22
* Removing integer choices:
23
23
24
-
* It was an error. MultiSelectField inheritances of CharField, not IntegerField.
24
+
* It was a mistake. MultiSelectField inherits of CharField, not IntegerField.
25
25
* It is impossible knows if original choice is (1, 'Item title 2.1') or ('1', 'Item title 2.1')
26
26
27
27
@@ -38,7 +38,7 @@
38
38
39
39
* Documentation:
40
40
41
-
* How add a filter to the Django administration:
41
+
* How to add a filter to the Django administration:
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.
14
+
A new model field and form field. With this, you can get a multiple select from choices. It is stored to the database as a CharField of comma-separated values.
15
15
16
-
This egg is inspired by this `snippet <https://djangosnippets.org/snippets/1200/>`_.
16
+
This package is inspired by this `snippet <https://djangosnippets.org/snippets/1200/>`_.
# Because when MultiSelectField gets data from db, it can not know if the values are integers or strings.
70
+
# Because when MultiSelectField retrieves data from db, it cannot know if the values are integers or strings.
71
71
# In other words, MultiSelectField save the same data for MY_CHOICES2 and MY_INTEGER_CHOICES2
72
+
# Or in practice it should be the same MY_CHOICES2 and MY_INTEGER_CHOICES2
72
73
73
74
74
75
1.3 In your settings.py
75
76
-----------------------
76
77
77
-
Only you need it, if you want the translation of django-multiselectfield or you need static files.
78
+
Only required if you want the translation of django-multiselectfield or need its static files.
78
79
79
80
.. code-block:: python
80
81
@@ -93,7 +94,7 @@ Only you need it, if you want the translation of django-multiselectfield or you
93
94
1.4 SortMultiSelectField
94
95
------------------------
95
96
96
-
Since version 0.1.14, this package also includes a second field type called: SortMultiSelectField.
97
+
Since version 0.1.14, this package also includes a another field type called: SortMultiSelectField.
97
98
98
99
For this field to work, you need to include `jQuery <https://jquery.com/download/>`_ (already included in the Django admin) and `jQuery UI <https://jqueryui.com/download/>`_.
99
100
@@ -102,9 +103,9 @@ You can include them by updating the ModelAdmin’s form or directly in change_f
102
103
1.5 Other recommendations
103
104
-------------------------
104
105
105
-
`Like django recommended: <https://docs.djangoproject.com/en/5.2/ref/models/fields/#django.db.models.Field.null>`_ Avoid using null on string-based fields such as CharField and TextField.
106
+
`As django recommended: <https://docs.djangoproject.com/en/5.2/ref/models/fields/#django.db.models.Field.null>`_ Avoid using null on string-based fields such as CharField and TextField.
106
107
107
-
MultiSelectField is based on CharField (MultiSelectField inheritances of CharField). So, if you need a not required use only blank=True (null=False by default):
108
+
MultiSelectField is based on CharField (MultiSelectField inheritances of CharField). So, if the field is not required, use only blank=True (null=False by default):
108
109
109
110
.. code-block:: python
110
111
@@ -121,7 +122,7 @@ MultiSelectField is based on CharField (MultiSelectField inheritances of CharFie
121
122
2.1 Customizing templates
122
123
--------------------------
123
124
124
-
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``:
125
+
You can 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``:
125
126
126
127
.. code-block:: HTML+Django
127
128
@@ -136,7 +137,7 @@ It is possible to customize the HTML of this widget in your form template. To do
136
137
2.2 Fixing CSS alignment in the Django administration
Django has no built-in way to add support for custom fields.
194
+
Django doesn't provide built-in support for custom fields.
194
195
195
196
196
197
2.4.1 Option 1. Use get_FOO_display
197
198
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
198
199
199
-
Change one by one
200
+
Change them individually
200
201
201
202
.. code-block:: python
202
203
@@ -212,7 +213,7 @@ Change one by one
212
213
2.4.2 Option 2. Monkey patching Django
213
214
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
214
215
215
-
If you have a lot of django multiselect fields in list_display previous option can be much work.
216
+
If you have many django multiselect fields in list_display, the previous option can be much work.
216
217
217
218
You can see it in the `example project <https://github.com/goinnn/django-multiselectfield/blob/65376239ae7491414f896adb4d314349ff7c2667/example/app/apps.py#L34>`_.
218
219
@@ -258,7 +259,7 @@ This code is inspired by django code. It is possible that for other versions of
258
259
2.5 Add support for read-only fields in the Django administration
Django has no built-in way to add support for custom fields.
262
+
Django doesn't provide built-in support for custom fields.
262
263
263
264
You can see it in the `example project <https://github.com/goinnn/django-multiselectfield/blob/65376239ae7491414f896adb4d314349ff7c2667/example/app/apps.py#L52>`_. Log in to the Django admin in the sample project using the following credentials: user-readonly / DMF-123.
0 commit comments