mirror of
https://github.com/SectorLabs/django-localized-fields.git
synced 2025-04-24 19:32:53 +03:00
LocalizedField should not set required twice
This commit is contained in:
parent
f453c44a73
commit
43a48403e9
@ -1,5 +1,6 @@
|
||||
from django.conf import settings
|
||||
from django.db.utils import IntegrityError
|
||||
|
||||
from localized_fields import LocalizedFieldForm
|
||||
from psqlextra.fields import HStoreField
|
||||
|
||||
@ -17,8 +18,13 @@ class LocalizedField(HStoreField):
|
||||
def __init__(self, *args, **kwargs):
|
||||
"""Initializes a new instance of :see:LocalizedField."""
|
||||
|
||||
super(LocalizedField, self).__init__(
|
||||
*args, required=[settings.LANGUAGE_CODE], **kwargs)
|
||||
required = kwargs.get('required')
|
||||
if required is None:
|
||||
required = [settings.LANGUAGE_CODE]
|
||||
|
||||
kwargs['required'] = required
|
||||
|
||||
super(LocalizedField, self).__init__(*args, **kwargs)
|
||||
|
||||
@staticmethod
|
||||
def from_db_value(value, *_):
|
||||
|
Loading…
x
Reference in New Issue
Block a user