|
1 | 1 | import decimal |
2 | 2 | import fractions |
3 | 3 | import logging |
4 | | -from typing import Any, List, Tuple, Union |
| 4 | +from typing import Any, List, Optional, Tuple, Union |
5 | 5 |
|
6 | 6 | from django.core import checks |
7 | 7 | from django.core.checks.messages import CheckMessage |
@@ -190,19 +190,13 @@ def deconstruct(self) -> Tuple[str, str, list, dict]: |
190 | 190 |
|
191 | 191 | return name, path, args, kwargs |
192 | 192 |
|
193 | | - def formfield(self, **kwargs) -> Any: |
194 | | - defaults = { |
195 | | - 'form_class': fraction_forms.FractionField, |
196 | | - } |
197 | | - defaults.update(kwargs) |
198 | | - |
199 | | - # return super().formfield(**{ |
200 | | - # 'max_digits': self.max_digits, |
201 | | - # 'decimal_places': self.decimal_places, |
202 | | - # 'form_class': forms.DecimalField, |
203 | | - # **kwargs, |
204 | | - # }) |
205 | | - return super().formfield(**defaults) |
| 193 | + def formfield( |
| 194 | + self, |
| 195 | + form_class: Optional[Any] = fraction_forms.FractionField, |
| 196 | + choices_form_class: Optional[Any] = None, |
| 197 | + **kwargs: Any |
| 198 | + ) -> Any: |
| 199 | + return super().formfield(form_class=form_class, choices_form_class=choices_form_class, **kwargs) |
206 | 200 |
|
207 | 201 | def get_internal_type(self) -> str: |
208 | 202 | # returning DecimalField, since we use the same backing column type as that |
|
0 commit comments