mirror of
https://github.com/SectorLabs/django-localized-fields.git
synced 2025-10-30 02:28:57 +03:00
Add LocalizedIntegerFieldWidget
This commit is contained in:
@@ -5,6 +5,7 @@ from django.db.utils import IntegrityError
|
||||
|
||||
from .field import LocalizedField
|
||||
from ..value import LocalizedValue, LocalizedIntegerValue
|
||||
from ..forms import LocalizedIntegerFieldForm
|
||||
|
||||
|
||||
class LocalizedIntegerField(LocalizedField):
|
||||
@@ -63,6 +64,15 @@ class LocalizedIntegerField(LocalizedField):
|
||||
|
||||
return prepped_value
|
||||
|
||||
def formfield(self, **kwargs):
|
||||
"""Gets the form field associated with this field."""
|
||||
defaults = {
|
||||
'form_class': LocalizedIntegerFieldForm
|
||||
}
|
||||
|
||||
defaults.update(kwargs)
|
||||
return super().formfield(**defaults)
|
||||
|
||||
@staticmethod
|
||||
def _convert_localized_value(value: LocalizedValue) -> LocalizedIntegerValue:
|
||||
"""Converts from :see:LocalizedValue to :see:LocalizedIntegerValue."""
|
||||
|
||||
Reference in New Issue
Block a user