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
There is a small bug in the calculation of max_length in CountryField when multiple=True:
kwargs["max_length"] = (
len(self.countries)
- 1
+ sum(len(code) for code in self.countries.countries)
)
I guess this is supposed to encode "Everything is selected" (the sum()) + "N-1 commas in between" (the len() - 1). However while self.countries.countries correctly lists all the possible countries, self.countries (i.e. Countries.__iter__!) emits the COUNTRIES_FIRST as well, so those are counted multiple times!
The fix will probably just be to replace len(self.countries) with len(self.countries.countries) here.
The text was updated successfully, but these errors were encountered:
There is a small bug in the calculation of
max_length
inCountryField
whenmultiple=True
:I guess this is supposed to encode "Everything is selected" (the
sum()
) + "N-1 commas in between" (thelen() - 1
). However whileself.countries.countries
correctly lists all the possible countries,self.countries
(i.e.Countries.__iter__
!) emits theCOUNTRIES_FIRST
as well, so those are counted multiple times!The fix will probably just be to replace
len(self.countries)
withlen(self.countries.countries)
here.The text was updated successfully, but these errors were encountered: