You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 
 
 

16 lines
529 B

from django import forms
from django.conf import settings
class AdminForm(forms.Form):
model = None
def __init__(self, *args, **kwargs):
"""
create dynamical translated fields fields
"""
if len(settings.LANGUAGES) in range(10):
for lid, (code, name) in enumerate(settings.LANGUAGES):
# uses enumerate for detect iteration number
# first iteration is a default lang so it required fields
required = True if lid == 0 else False