Django CheckboxSelectMultiple widget adds ------— value to query set

I have form with such field:

categories = forms.ModelChoiceField( queryset=Field.objects.all(), widget=CheckboxSelectMultiple, required=False )

And after rendering I get my first value as shown:

<ul> <li> <label for="id_categories_0"><input type="checkbox" name="categories" id="id_categories_0">---------</label> </li> ...

Yes, I don't have Field Model "------". Is it trying to set possible empty value? (same '-------' are used in select boxes to show empty value in the django admin layer).

Sure changing "----------" to "All fields" would be useful (since i will need such option), but how should i achieve that and what causes this weird behavior?


both your questions are answered in the documentation: https://docs.djangoproject.com/en/dev/ref/forms/fields/#django.forms.ModelChoiceField


  • javafx 3d performance large data set
  • Function JavaScript : on Menu CSS HTML
  • Can't delete li from to-do list
  • Rails 5 - Google Maps - Javascript error - initMap is not a function - fixing one js issue creates a
  • How to name a 'group' check box in Adobe Reader when wanting to fill form by FDF / XFDF
  • How to create two column output from a single column
  • Add reference to ASP.NET 5 Class Library from Framework 4.5 Class Library Project
  • Cut the background to expose the layer below
  • How to render a pixel array most efficiently to a window in c++?
  • How can I get the choice “H2” back in the H2 consol?
  • Approximate Order-Preserving Huffman Code
  • xcode don't localize specific strings
  • Angularjs pass function from Controller to Directive (or call controller function from directive) -
  • Swift: Switch statement fallthrough behavior
  • How do I pass the string value parameter of the selected list item from an auto-populated dropdown l
  • Lost migrations and Azure database is now out of sync
  • Using jQuery closest() method with class selector
  • Display issues when we change from one jquery mobile page to another in firefox
  • java.lang.NoClassDefFoundError: com.parse.Parse$Configuration$Builder on below Lollipop versions
  • Why doesn't :active or :focus work on text links in webkit? (safari & chrome)
  • Which linear programming package should I use for high numbers of constraints and “warm starts” [clo
  • Jquery - Jquery Wysiwyg return html as a string
  • VB.net deserialize, JSON Conversion from type 'Dictionary(Of String,Object)' to type '
  • How to delete a row from a dynamic generate table using jquery?
  • json Serialization in asp
  • Rails 2: use form_for to build a form covering multiple objects of the same class
  • How can I get HTML syntax highlighting in my editor for CakePHP?
  • Why can't I rebase on to an ancestor of source changesets if on a different branch?
  • How do I configure my settings file to work with unit tests?
  • embed rChart in Markdown
  • How to stop GridView from loading again when I press back button?
  • How to get Windows thread pool to call class member function?
  • IndexOutOfRangeException on multidimensional array despite using GetLength check
  • costura.fody for a dll that references another dll
  • Binding checkboxes to object values in AngularJs
  • Observable and ngFor in Angular 2
  • How to Embed XSL into XML
  • UserPrincipal.Current returns apppool on IIS
  • Conditional In-Line CSS for IE and Others?
  • java string with new operator and a literal