'Sets choices and initial value'

def __init__(self, user, *args, **kwargs):

    super(SettingsForm, self).__init__(*args, **kwargs)
    self.fields['default_perspective'].queryset = Perspective.objects.all()
    try:
        conf = ModuleSetting.get_for_module('treeio.core', 'default_perspective')[0]
        default_perspective = Perspective.objects.get(pk=long(conf.value))
        self.fields['default_perspective'].initial = default_perspective.id
    except:
        pass
    try:
        conf = ModuleSetting.get_for_module('treeio.core', 'default_permissions')[0]
        self.fields['default_permissions'].initial = conf.value
    except:
        self.fields['default_permissions'].initial = getattr(settings, 'HARDTREE_DEFAULT_PERMISSIONS', 'everyone')
    self.fields['default_timezone'].choices = getattr(settings, 'HARDTREE_SERVER_TIMEZONE')
    timezone = settings.HARDTREE_SERVER_DEFAULT_TIMEZONE
    try:
        conf = ModuleSetting.get_for_module('treeio.core', 'default_timezone')[0]
        timezone = conf.value
    except Exception:
        pass
    self.fields['default_timezone'].initial = timezone
    self.fields['language'].choices = getattr(settings, 'HARDTREE_LANGUAGES', [('en', 'English')])
    language = getattr(settings, 'HARDTREE_LANGUAGES_DEFAULT', '')
    try:
        conf = ModuleSetting.get_for_module('treeio.core', 'language')[0]
        language = conf.value
    except IndexError:
        pass
    self.fields['language'].initial = language
    if getattr(settings, 'HARDTREE_SUBSCRIPTION_CUSTOMIZATION', True):
        logopath = ''
        try:
            conf = ModuleSetting.get_for_module('treeio.core', 'logopath')[0]
            logopath = conf.value
        except:
            pass
        if logopath:
            match = re.match('.*[a-z0-9]{32}__(?P<filename>.+)$', logopath)
            if match:
                logopath = match.group('filename')
            form_field = forms.ChoiceField(label=_('Logo'), widget=forms.RadioSelect())
            form_field.choices = ((logopath, (_('Keep    existing:    ') + unicode(logopath))), ('delete', 'Delete    '))
            form_field.initial = logopath
            form_field.required = False
            self.fields['logo'] = form_field
        self.fields['logo'].label = _('Logo')
    else:
        del self.fields['logo']
    self.fields['default_perspective'].label = _('Default    Perspective')
    self.fields['default_permissions'].label = _('Default    Permissions')
    self.fields['default_timezone'].label = _('Time    Zone')
    self.fields['language'].label = _('Language')
