RE: Bug in Django 2.1 on ModelMultipleChoiceField

2019-03-14 Thread Matthew Pava
Well, it is raising an error.  It’s a Python error. Basically, you were passing 
a keyword argument (empty_label), and the class was passing the same keyword 
argument called empty_label. Expanded out, this is what was happening:

field = forms.ModelMultipleChoiceField( queryset = Imodelclass.objects.all(), 
empty_label='' )
= ModelMultipleChoiceField(queryset= Imodelclass.objects.all(), 
empty_label=None, empty_label='')

When you read the error, you see that is actually very clear in this context: 
You passed two arguments for the same keyword.
typeError " __init__() got multiple values for keyword argument 'empty_label'

I think it would be wise to mention this in the documentation; perhaps even 
providing a rationale why ModelMultipleChoiceField should not have an empty 
label. But if there is no rationale behind it, then the clear solution is to do 
exactly as you did: remove the empty_label keyword argument from the super call.

From: Odile Lambert [mailto:pisc...@laposte.net]
Sent: Thursday, March 14, 2019 2:10 AM
To: django-users@googlegroups.com; Matthew Pava
Subject: Re: Bug in Django 2.1 on ModelMultipleChoiceField


Hello

If this is by design Django should raise an error indicating that 
ModelMultipleChoiceField does not allow an empty_label attribute

The present error message in the __init__ of the super_class is not coherent 
and very difficult to understand for beginners. I would strongly suggest that 
it is filed as a bug to improve the code either by allowing the empty label or 
by raising the propoer error.

Modifying the documentation does not seem sufficient from my point of view.

Thanks for your suggestion for creating a specific class.

Odile Lambert


Le 13/03/2019 à 22:06, Matthew Pava a écrit :
Looking at it, I would say that this is by design. You shouldn’t use an empty 
label on a multiple choice field. Perhaps this should be clarified in the docs.
Saying that, if you really want an empty label on a multiple choice field, you 
could create your own class that initializes empty_label however you want it.

From: 'Odile Lambert' via Django users [mailto:django-users@googlegroups.com]
Sent: Wednesday, March 13, 2019 1:57 PM
To: Django users
Subject: Bug in Django 2.1 on ModelMultipleChoiceField


Hello,

I believe Bugs in Django are to be reported in this user list. Below is a 
report for a bug which does not seem to be already filed.

In the documentation reference on the ModelMultipleChoiceField there is no 
restrictios mentioned on the empty_label attribute.

Whenever you declare an attribute empy_label for a ModelMultipleChoiceField, it 
generates an error during the system_checks

 typeError " __init__() got multiple values for keyword argument 'empty_label

To reproduce the bug : :

class MyForm(forms.Form):
field = forms.ModelMultipleChoiceField(
queryset = Imodelclass.objects.all(),)
empty_label=(''))

Another user on stackoverflow encountered  this same problem see here : 
https://stackoverflow.com/questions/52263426/django-empty-label-for-modelmultiplechoicefield-multiple-values-for-keyword-arg

The cause of the error is the following :

the code ( see fdjango/forms/models.py line 1266 sets the empty_label attribute 
to None while calling the super_class (ModelChoiceField):

super().__init__(queryset, empty_label=None, **kwargs)

while the super_class.__init__ sets the empy_label to "-".

removing the empty_label= None in the call to the super_class solved the 
problem for me.

best regards

Odile Lambert

--
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to 
django-users+unsubscr...@googlegroups.com<mailto:django-users+unsubscr...@googlegroups.com>.
To post to this group, send email to 
django-users@googlegroups.com<mailto:django-users@googlegroups.com>.
Visit this group at https://groups.google.com/group/django-users.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/063841b4-5b58-4931-6ea3-29188ccc8171%40laposte.net<https://groups.google.com/d/msgid/django-users/063841b4-5b58-4931-6ea3-29188ccc8171%40laposte.net?utm_medium=email_source=footer>.
For more options, visit https://groups.google.com/d/optout.
--
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to 
django-users+unsubscr...@googlegroups.com<mailto:django-users+unsubscr...@googlegroups.com>.
To post to this group, send email to 
django-users@googlegroups.com<mailto:django-users@googlegroups.com>.
Visit this group at https://groups.google.com/group/django-users.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/c6be6380098a49b6bab737a85e

Re: Bug in Django 2.1 on ModelMultipleChoiceField

2019-03-14 Thread 'Odile Lambert' via Django users

  
  
Hello
If this is by design Django should raise an error indicating that
  ModelMultipleChoiceField does not allow an empty_label attribute 

The present error message in the __init__ of the super_class is
  not coherent and very difficult to understand for beginners. I
  would strongly suggest that it is filed as a bug to improve the
  code either by allowing the empty label or by raising the propoer
  error.
Modifying the documentation does not seem sufficient from my
  point of view.

Thanks for your suggestion for creating a specific class.
Odile Lambert



Le 13/03/2019 à 22:06, Matthew Pava a
  écrit :


  
  
  
  
Looking
at it, I would say that this is by design. You shouldn’t use
an empty label on a multiple choice field. Perhaps this
should be clarified in the docs.
Saying
that, if you really want an empty label on a multiple choice
field, you could create your own class that initializes
empty_label however you want it.

 

  
From:
'Odile Lambert' via Django users
[mailto:django-users@googlegroups.com]

Sent: Wednesday, March 13, 2019 1:57 PM
To: Django users
Subject: Bug in Django 2.1 on
ModelMultipleChoiceField
  

 
Hello,
I believe Bugs in Django are to be reported in this user
  list. Below is a report for a bug which does not seem to be
  already filed.
In the documentation reference on the
  ModelMultipleChoiceField there is no restrictios mentioned on
  the empty_label attribute.
  
Whenever you declare an attribute empy_label for a
  ModelMultipleChoiceField, it generates an error during the
  system_checks
 typeError " __init__() got multiple values for keyword argument 'empty_label
To reproduce the bug : :
class MyForm(forms.Form):
      field = forms.ModelMultipleChoiceField(
      queryset = Imodelclass.objects.all(),)
      empty_label=(''))
Another user on stackoverflow encountered  this same problem
  see here : 
https://stackoverflow.com/questions/52263426/django-empty-label-for-modelmultiplechoicefield-multiple-values-for-keyword-arg
  
The cause of the error is the following :
the code ( see fdjango/forms/models.py line 1266 sets the
  empty_label attribute to None while calling the super_class
  (ModelChoiceField):
super().__init__(queryset, empty_label=None, **kwargs)
while the super_class.__init__ sets the empy_label to
  "-". 
removing the empty_label= None in the call to the super_class
  solved the problem for me.
  
best regards
Odile Lambert
 
-- 
You received this message because you are subscribed to the
Google Groups "Django users" group.
To unsubscribe from this group and stop receiving emails
from it, send an email to
django-users+unsubscr...@googlegroups.com.
To post to this group, send email to 
  django-users@googlegroups.com.
Visit this group at https://groups.google.com/group/django-users.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/063841b4-5b58-4931-6ea3-29188ccc8171%40laposte.net.
For more options, visit https://groups.google.com/d/optout.
  
  -- 
  You received this message because you are subscribed to the Google
  Groups "Django users" group.
  To unsubscribe from this group and stop receiving emails from it,
  send an email to django-users+unsubscr...@googlegroups.com.
  To post to this group, send email to django-users@googlegroups.com.
  Visit this group at https://groups.google.com/group/django-users.
  To view this discussion on the web visit https://groups.google.com/d/msgid/django-users/c6be6380098a49b6bab737a85e1b5d5b%40iss2.ISS.LOCAL.
  For more options, visit https://groups.google.com/d/optout.

  




-- 
You received this message because you are subscribed to the Google Groups "Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to django-users+unsubscr...@googlegroups.com.
To post to this group, send email to django-users@googlegroups.com.
Visit this group at https://groups.google.com/group/django-users.
To view this discussion on the web visit https://groups.google.com/d/msgid/django-users/d1387fdf-7729-fc81-f311-0b4919fff6c0%40laposte.net.
For more options, visit https://groups.google.com/d/optout.


RE: Bug in Django 2.1 on ModelMultipleChoiceField

2019-03-13 Thread Matthew Pava
Looking at it, I would say that this is by design. You shouldn’t use an empty 
label on a multiple choice field. Perhaps this should be clarified in the docs.
Saying that, if you really want an empty label on a multiple choice field, you 
could create your own class that initializes empty_label however you want it.

From: 'Odile Lambert' via Django users [mailto:django-users@googlegroups.com]
Sent: Wednesday, March 13, 2019 1:57 PM
To: Django users
Subject: Bug in Django 2.1 on ModelMultipleChoiceField


Hello,

I believe Bugs in Django are to be reported in this user list. Below is a 
report for a bug which does not seem to be already filed.

In the documentation reference on the ModelMultipleChoiceField there is no 
restrictios mentioned on the empty_label attribute.

Whenever you declare an attribute empy_label for a ModelMultipleChoiceField, it 
generates an error during the system_checks

 typeError " __init__() got multiple values for keyword argument 'empty_label

To reproduce the bug : :

class MyForm(forms.Form):
field = forms.ModelMultipleChoiceField(
queryset = Imodelclass.objects.all(),)
empty_label=(''))

Another user on stackoverflow encountered  this same problem see here : 
https://stackoverflow.com/questions/52263426/django-empty-label-for-modelmultiplechoicefield-multiple-values-for-keyword-arg

The cause of the error is the following :

the code ( see fdjango/forms/models.py line 1266 sets the empty_label attribute 
to None while calling the super_class (ModelChoiceField):

super().__init__(queryset, empty_label=None, **kwargs)

while the super_class.__init__ sets the empy_label to "-".

removing the empty_label= None in the call to the super_class solved the 
problem for me.

best regards

Odile Lambert

--
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to 
django-users+unsubscr...@googlegroups.com<mailto:django-users+unsubscr...@googlegroups.com>.
To post to this group, send email to 
django-users@googlegroups.com<mailto:django-users@googlegroups.com>.
Visit this group at https://groups.google.com/group/django-users.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/063841b4-5b58-4931-6ea3-29188ccc8171%40laposte.net<https://groups.google.com/d/msgid/django-users/063841b4-5b58-4931-6ea3-29188ccc8171%40laposte.net?utm_medium=email_source=footer>.
For more options, visit https://groups.google.com/d/optout.

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-users+unsubscr...@googlegroups.com.
To post to this group, send email to django-users@googlegroups.com.
Visit this group at https://groups.google.com/group/django-users.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/c6be6380098a49b6bab737a85e1b5d5b%40iss2.ISS.LOCAL.
For more options, visit https://groups.google.com/d/optout.


Bug in Django 2.1 on ModelMultipleChoiceField

2019-03-13 Thread 'Odile Lambert' via Django users

  
  
Hello,
I believe Bugs in Django are to be reported in this user list.
  Below is a report for a bug which does not seem to be already
  filed.

In the documentation reference on the ModelMultipleChoiceField
  there is no restrictios mentioned on the empty_label attribute. 

Whenever you declare an attribute empy_label for a
  ModelMultipleChoiceField, it generates an error during the
  system_checks

 typeError " __init__() got multiple values for keyword argument 'empty_label

To reproduce the bug : :
class MyForm(forms.Form):
      field = forms.ModelMultipleChoiceField(
      queryset = Imodelclass.objects.all(),)
      empty_label=(''))

Another user on stackoverflow encountered  this same problem see
  here :
https://stackoverflow.com/questions/52263426/django-empty-label-for-modelmultiplechoicefield-multiple-values-for-keyword-arg
  

The cause of the error is the following :

the code ( see fdjango/forms/models.py line 1266 sets the
  empty_label attribute to None while calling the super_class
  (ModelChoiceField):
super().__init__(queryset, empty_label=None, **kwargs)
while the super_class.__init__ sets the empy_label to
  "-". 

removing the empty_label= None in the call to the super_class
  solved the problem for me. 

best regards
Odile Lambert


  




-- 
You received this message because you are subscribed to the Google Groups "Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to django-users+unsubscr...@googlegroups.com.
To post to this group, send email to django-users@googlegroups.com.
Visit this group at https://groups.google.com/group/django-users.
To view this discussion on the web visit https://groups.google.com/d/msgid/django-users/063841b4-5b58-4931-6ea3-29188ccc8171%40laposte.net.
For more options, visit https://groups.google.com/d/optout.