def __init__(self, *args, **kwargs): self.obj = GlobalSettingsObject() super().__init__(*args, obj=self.obj, **kwargs) self.fields = OrderedDict([ ('footer_text', I18nFormField( widget=I18nTextInput, required=False, label=_("Additional footer text"), help_text= _("Will be included as additional text in the footer, site-wide." ))), ('footer_link', I18nFormField( widget=I18nTextInput, required=False, label=_("Additional footer link"), help_text= _("Will be included as the link in the additional footer text." ))) ]) responses = register_global_settings.send(self) for r, response in responses: for key, value in response.items(): # We need to be this explicit, since OrderedDict.update does not retain ordering self.fields[key] = value
def __init__(self, *args, **kwargs): self.obj = GlobalSettingsObject() super().__init__(*args, obj=self.obj, **kwargs) self.fields = OrderedDict(list(self.fields.items()) + [ ('footer_text', I18nFormField( widget=I18nTextInput, required=False, label=_("Additional footer text"), help_text=_("Will be included as additional text in the footer, site-wide.") )), ('footer_link', I18nFormField( widget=I18nTextInput, required=False, label=_("Additional footer link"), help_text=_("Will be included as the link in the additional footer text.") )), ('banner_message', I18nFormField( widget=I18nTextarea, required=False, label=_("Global message banner"), )), ('banner_message_detail', I18nFormField( widget=I18nTextarea, required=False, label=_("Global message banner detail text"), )), ('opencagedata_apikey', SecretKeySettingsField( required=False, label=_("OpenCage API key for geocoding"), )), ('mapquest_apikey', SecretKeySettingsField( required=False, label=_("MapQuest API key for geocoding"), )), ('leaflet_tiles', forms.CharField( required=False, label=_("Leaflet tiles URL pattern"), help_text=_("e.g. {sample}").format(sample="https://a.tile.openstreetmap.org/{z}/{x}/{y}.png") )), ('leaflet_tiles_attribution', forms.CharField( required=False, label=_("Leaflet tiles attribution"), help_text=_("e.g. {sample}").format(sample='© <a href="https://www.openstreetmap.org/copyright">OpenStreetMap</a> contributors') )), ]) responses = register_global_settings.send(self) for r, response in sorted(responses, key=lambda r: str(r[0])): for key, value in response.items(): # We need to be this explicit, since OrderedDict.update does not retain ordering self.fields[key] = value self.fields['banner_message'].widget.attrs['rows'] = '2' self.fields['banner_message_detail'].widget.attrs['rows'] = '3'
def __init__(self, *args, **kwargs): self.obj = GlobalSettingsObject() super().__init__(*args, obj=self.obj, **kwargs) self.fields = OrderedDict([ ('footer_text', I18nFormField( widget=I18nTextInput, required=False, label=_("Additional footer text"), help_text=_("Will be included as additional text in the footer, site-wide.") )), ('footer_link', I18nFormField( widget=I18nTextInput, required=False, label=_("Additional footer link"), help_text=_("Will be included as the link in the additional footer text.") )), ('banner_message', I18nFormField( widget=I18nTextarea, required=False, label=_("Global message banner"), )), ('banner_message_detail', I18nFormField( widget=I18nTextarea, required=False, label=_("Global message banner detail text"), )), ]) responses = register_global_settings.send(self) for r, response in sorted(responses, key=lambda r: str(r[0])): for key, value in response.items(): # We need to be this explicit, since OrderedDict.update does not retain ordering self.fields[key] = value self.fields['banner_message'].widget.attrs['rows'] = '2' self.fields['banner_message_detail'].widget.attrs['rows'] = '3'