Re: [Django] #33155: ModelChoiceIteratorValue is not hashable.

2021-09-30 Thread Django
#33155: ModelChoiceIteratorValue is not hashable.
-+-
 Reporter:  Aljaž Košir  |Owner:  Aljaž
 |  Košir
 Type:  Bug  |   Status:  closed
Component:  Forms|  Version:  3.1
 Severity:  Normal   |   Resolution:  fixed
 Keywords:   | Triage Stage:  Ready for
  ModelChoiceIteratorValue   |  checkin
Has patch:  1|  Needs documentation:  0
  Needs tests:  0|  Patch needs improvement:  0
Easy pickings:  1|UI/UX:  0
-+-

Comment (by Mariusz Felisiak ):

 In [changeset:"0a49276065575867fbbf279f138b399c535e3b6d" 0a492760]:
 {{{
 #!CommitTicketReference repository=""
 revision="0a49276065575867fbbf279f138b399c535e3b6d"
 [4.0.x] Fixed #33155 -- Made ModelChoiceIteratorValue instances hashable.

 Backport of 7b8b3d45cafd7bec7ff3ee0e4371e142c36d from main
 }}}

-- 
Ticket URL: 
Django 
The Web framework for perfectionists with deadlines.

-- 
You received this message because you are subscribed to the Google Groups 
"Django updates" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-updates+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-updates/068.25d6181536320b4be3a17677844e6e67%40djangoproject.com.


Re: [Django] #33155: ModelChoiceIteratorValue is not hashable.

2021-09-30 Thread Django
#33155: ModelChoiceIteratorValue is not hashable.
-+-
 Reporter:  Aljaž Košir  |Owner:  Aljaž
 |  Košir
 Type:  Bug  |   Status:  closed
Component:  Forms|  Version:  3.1
 Severity:  Normal   |   Resolution:  fixed
 Keywords:   | Triage Stage:  Ready for
  ModelChoiceIteratorValue   |  checkin
Has patch:  1|  Needs documentation:  0
  Needs tests:  0|  Patch needs improvement:  0
Easy pickings:  1|UI/UX:  0
-+-
Changes (by GitHub ):

 * status:  assigned => closed
 * resolution:   => fixed


Comment:

 In [changeset:"7b8b3d45cafd7bec7ff3ee0e4371e142c36d" 7b8beee]:
 {{{
 #!CommitTicketReference repository=""
 revision="7b8b3d45cafd7bec7ff3ee0e4371e142c36d"
 Fixed #33155 -- Made ModelChoiceIteratorValue instances hashable.
 }}}

-- 
Ticket URL: 
Django 
The Web framework for perfectionists with deadlines.

-- 
You received this message because you are subscribed to the Google Groups 
"Django updates" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-updates+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-updates/068.d44125d2de6d0e93d5f99af05ebde25b%40djangoproject.com.


Re: [Django] #33155: ModelChoiceIteratorValue is not hashable.

2021-09-30 Thread Django
#33155: ModelChoiceIteratorValue is not hashable.
-+-
 Reporter:  Aljaž Košir  |Owner:  Aljaž
 |  Košir
 Type:  Bug  |   Status:  assigned
Component:  Forms|  Version:  3.1
 Severity:  Normal   |   Resolution:
 Keywords:   | Triage Stage:  Ready for
  ModelChoiceIteratorValue   |  checkin
Has patch:  1|  Needs documentation:  0
  Needs tests:  0|  Patch needs improvement:  0
Easy pickings:  1|UI/UX:  0
-+-
Changes (by Mariusz Felisiak):

 * type:  Cleanup/optimization => Bug
 * stage:  Accepted => Ready for checkin


-- 
Ticket URL: 
Django 
The Web framework for perfectionists with deadlines.

-- 
You received this message because you are subscribed to the Google Groups 
"Django updates" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-updates+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-updates/068.708897207e8bddda4a7139757883a7b8%40djangoproject.com.


Re: [Django] #33155: ModelChoiceIteratorValue is not hashable.

2021-09-30 Thread Django
#33155: ModelChoiceIteratorValue is not hashable.
-+-
 Reporter:  Aljaž Košir  |Owner:  Aljaž
 Type:   |  Košir
  Cleanup/optimization   |   Status:  assigned
Component:  Forms|  Version:  3.1
 Severity:  Normal   |   Resolution:
 Keywords:   | Triage Stage:  Accepted
  ModelChoiceIteratorValue   |
Has patch:  1|  Needs documentation:  0
  Needs tests:  0|  Patch needs improvement:  0
Easy pickings:  1|UI/UX:  0
-+-
Changes (by Aljaž Košir):

 * needs_tests:  1 => 0


-- 
Ticket URL: 
Django 
The Web framework for perfectionists with deadlines.

-- 
You received this message because you are subscribed to the Google Groups 
"Django updates" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-updates+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-updates/068.79df03ece52c951d2732b18ee33a45c2%40djangoproject.com.


Re: [Django] #33155: ModelChoiceIteratorValue is not hashable.

2021-09-30 Thread Django
#33155: ModelChoiceIteratorValue is not hashable.
-+-
 Reporter:  Aljaž Košir  |Owner:  Aljaž
 Type:   |  Košir
  Cleanup/optimization   |   Status:  assigned
Component:  Forms|  Version:  3.1
 Severity:  Normal   |   Resolution:
 Keywords:   | Triage Stage:  Accepted
  ModelChoiceIteratorValue   |
Has patch:  1|  Needs documentation:  0
  Needs tests:  1|  Patch needs improvement:  0
Easy pickings:  1|UI/UX:  0
-+-
Changes (by Aljaž Košir):

 * needs_better_patch:  1 => 0


-- 
Ticket URL: 
Django 
The Web framework for perfectionists with deadlines.

-- 
You received this message because you are subscribed to the Google Groups 
"Django updates" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-updates+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-updates/068.b02907f96cbbdceaf2434882038b41ac%40djangoproject.com.


Re: [Django] #33155: ModelChoiceIteratorValue is not hashable.

2021-09-29 Thread Django
#33155: ModelChoiceIteratorValue is not hashable.
-+-
 Reporter:  Aljaž Košir  |Owner:  Aljaž
 Type:   |  Košir
  Cleanup/optimization   |   Status:  assigned
Component:  Forms|  Version:  3.1
 Severity:  Normal   |   Resolution:
 Keywords:   | Triage Stage:  Accepted
  ModelChoiceIteratorValue   |
Has patch:  1|  Needs documentation:  0
  Needs tests:  1|  Patch needs improvement:  1
Easy pickings:  1|UI/UX:  0
-+-
Changes (by Mariusz Felisiak):

 * needs_better_patch:  0 => 1
 * needs_tests:  0 => 1


-- 
Ticket URL: 
Django 
The Web framework for perfectionists with deadlines.

-- 
You received this message because you are subscribed to the Google Groups 
"Django updates" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-updates+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-updates/068.6cf59310dc77f9db9d5bb7ff23b2e21d%40djangoproject.com.


Re: [Django] #33155: ModelChoiceIteratorValue is not hashable.

2021-09-29 Thread Django
#33155: ModelChoiceIteratorValue is not hashable.
-+-
 Reporter:  Aljaž Košir  |Owner:  Aljaž
 Type:   |  Košir
  Cleanup/optimization   |   Status:  assigned
Component:  Forms|  Version:  3.1
 Severity:  Normal   |   Resolution:
 Keywords:   | Triage Stage:  Accepted
  ModelChoiceIteratorValue   |
Has patch:  1|  Needs documentation:  0
  Needs tests:  0|  Patch needs improvement:  0
Easy pickings:  1|UI/UX:  0
-+-
Changes (by Aljaž Košir):

 * has_patch:  0 => 1


Comment:

 Patch: https://github.com/django/django/pull/14915

-- 
Ticket URL: 
Django 
The Web framework for perfectionists with deadlines.

-- 
You received this message because you are subscribed to the Google Groups 
"Django updates" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-updates+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-updates/068.00d2281b6c62ef666888312620d80c4b%40djangoproject.com.


Re: [Django] #33155: ModelChoiceIteratorValue is not hashable.

2021-09-29 Thread Django
#33155: ModelChoiceIteratorValue is not hashable.
-+-
 Reporter:  Aljaž Košir  |Owner:  Aljaž
 Type:   |  Košir
  Cleanup/optimization   |   Status:  assigned
Component:  Forms|  Version:  3.1
 Severity:  Normal   |   Resolution:
 Keywords:   | Triage Stage:  Accepted
  ModelChoiceIteratorValue   |
Has patch:  0|  Needs documentation:  0
  Needs tests:  0|  Patch needs improvement:  0
Easy pickings:  1|UI/UX:  0
-+-
Changes (by Aljaž Košir):

 * owner:  nobody => Aljaž Košir
 * status:  new => assigned


-- 
Ticket URL: 
Django 
The Web framework for perfectionists with deadlines.

-- 
You received this message because you are subscribed to the Google Groups 
"Django updates" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-updates+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-updates/068.fe425ff4445cf82f1fd2218e3949a77f%40djangoproject.com.


Re: [Django] #33155: ModelChoiceIteratorValue is not hashable.

2021-09-29 Thread Django
#33155: ModelChoiceIteratorValue is not hashable.
-+-
 Reporter:  Aljaž Košir  |Owner:  nobody
 Type:   |   Status:  new
  Cleanup/optimization   |
Component:  Forms|  Version:  3.1
 Severity:  Normal   |   Resolution:
 Keywords:   | Triage Stage:  Accepted
  ModelChoiceIteratorValue   |
Has patch:  0|  Needs documentation:  0
  Needs tests:  0|  Patch needs improvement:  0
Easy pickings:  1|UI/UX:  0
-+-

Comment (by Aljaž Košir):

 Replying to [comment:1 Mariusz Felisiak]:
 > Thanks for the ticket. Agreed, we could make `ModelChoiceIteratorValue`
 hashable by adding:
 > {{{
 > def __hash__(self):
 > return hash(self.value)
 > }}}
 > For now you can use `value.value` as
 [https://docs.djangoproject.com/en/3.2/releases/3.1/#id1 documented in the
 "Backwards incompatible changes in 3.1" section]. Would you like to
 prepare a patch?


 Yes, sure.

-- 
Ticket URL: 
Django 
The Web framework for perfectionists with deadlines.

-- 
You received this message because you are subscribed to the Google Groups 
"Django updates" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-updates+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-updates/068.e318178a9bdf518c781911dfb0b82720%40djangoproject.com.


Re: [Django] #33155: ModelChoiceIteratorValue is not hashable. (was: ModelChoiceIteratorValue is not hashable)

2021-09-29 Thread Django
#33155: ModelChoiceIteratorValue is not hashable.
-+-
 Reporter:  Aljaž Košir  |Owner:  nobody
 Type:   |   Status:  new
  Cleanup/optimization   |
Component:  Forms|  Version:  3.1
 Severity:  Normal   |   Resolution:
 Keywords:   | Triage Stage:  Accepted
  ModelChoiceIteratorValue   |
Has patch:  0|  Needs documentation:  0
  Needs tests:  0|  Patch needs improvement:  0
Easy pickings:  1|UI/UX:  0
-+-
Changes (by Mariusz Felisiak):

 * type:  Bug => Cleanup/optimization
 * easy:  0 => 1
 * stage:  Unreviewed => Accepted


Comment:

 Thanks for the ticket. Agreed, we could make `ModelChoiceIteratorValue`
 hashable by adding:
 {{{
 def __hash__(self):
 return hash(self.value)
 }}}
 For now you can use `value.value` as
 [https://docs.djangoproject.com/en/3.2/releases/3.1/#id1 documented in the
 "Backwards incompatible changes in 3.1" section].

-- 
Ticket URL: 
Django 
The Web framework for perfectionists with deadlines.

-- 
You received this message because you are subscribed to the Google Groups 
"Django updates" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-updates+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-updates/068.db7e3ad5aebabbf5191e1a60a9ba34df%40djangoproject.com.


[Django] #33155: ModelChoiceIteratorValue is not hashable

2021-09-29 Thread Django
#33155: ModelChoiceIteratorValue is not hashable
-+-
   Reporter: |  Owner:  nobody
  aljazkosir |
   Type:  Bug| Status:  new
  Component:  Forms  |Version:  3.1
   Severity:  Normal |   Keywords:
   Triage Stage: |  ModelChoiceIteratorValue
  Unreviewed |  Has patch:  0
Needs documentation:  0  |Needs tests:  0
Patch needs improvement:  0  |  Easy pickings:  0
  UI/UX:  0  |
-+-
 Recently I migrated from Django 3.0 to Django 3.1. In my code, I add
 custom `data-*` attributes to the select widget options. After the upgrade
 some of those options broke. Error is `{TypeError}unhashable type:
 'ModelChoiceIteratorValue'`.

 Example (this one breaks):
 {{{
 def create_option(self, name, value, label, selected, index,
 subindex=None, attrs=None):
 context = super().create_option(name, value, label, selected,
 index, subindex, attrs)
 if not value:
 return context
 if value in self.show_fields: # This is a dict {1: ['first_name',
 'last_name']}
 context['attrs']['data-fields'] =
 json.dumps(self.show_fields[value])
 }}}

 However, working with arrays is not an issue:
 {{{
 def create_option(self, name, value, label, selected, index,
 subindex=None, attrs=None):
 context = super().create_option(name, value, label, selected,
 index, subindex, attrs)
 if not value:
 return context
 if value in allowed_values: # This is an array [1, 2]
 ...
 }}}

-- 
Ticket URL: 
Django 
The Web framework for perfectionists with deadlines.

-- 
You received this message because you are subscribed to the Google Groups 
"Django updates" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-updates+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-updates/053.da84b9c1c7088e40a6691a13e35eb720%40djangoproject.com.