Hmmm, maybe related to https://code.djangoproject.com/ticket/26665 ?

On Thursday, August 27, 2020 at 5:29:39 PM UTC-4 Roy Smith wrote:

> I'm running:
>
> Python 3.7
> Django 2.2
> Debian 4.9
>
> If I configure a forms ChoiceField with a callback function for choices, 
> it gets called twice each time I render the form:
>
> from unittest import TestCase
> from django import forms
>
> def callback():
>     print("callback")
>     return [('foo', 'bar')]
>
> class MyForm(forms.Form):
>     f = forms.ChoiceField(choices=callback)
>
>
> class FormTest(TestCase):
>     MyForm().as_p()
>
>
>
> prints:
>
> ./manage.py test spi.test_f
> callback
> callback
> System check identified no issues (0 silenced).
>
> ----------------------------------------------------------------------
> Ran 0 tests in 0.000s
>
> OK
>
>
> Is this a known issue?
>
>

-- 
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 [email protected].
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/24a524a6-5c47-42f7-ba63-37c77b09da34n%40googlegroups.com.

Reply via email to