def __init__(self, *args, **kwargs): super(TermsForm, self).__init__(*args, **kwargs) self.fields['terms'].label = mark_safe( _('You agree to our <a href="{url_terms}" target="_blank">' 'Terms and Conditions</a> and <a href="{url_privacy}" target="_blank">' 'Privacy Statement</a>').format( url_terms=get_content_url("terms"), url_privacy=get_content_url("privacy"))) user_extra_registry.on_init(self)
def __init__(self, *args, **kwargs): if not hasattr(self, 'request'): self.request = kwargs.pop('request', None) kwargs.pop('request', None) super().__init__(*args, **kwargs) self.fields['terms'].label = format_html(_( 'You agree to our <a href="{url_terms}" target="_blank">' 'Terms and Conditions</a> and <a href="{url_privacy}" target="_blank">' 'Privacy Statement</a>'), url_terms=get_content_url( "terms"), url_privacy=get_content_url( "privacy")) user_extra_registry.on_init('registration', self)
def __init__(self, *args, **kwargs): address_required = kwargs.pop('address_required', False) super().__init__(*args, **kwargs) self.fields['address'].required = address_required if ALLOW_PSEUDONYM and not address_required: self.fields["last_name"].help_text = format_html( _('<a target="_blank" href="{}">You may use a pseudonym if you don\'t need to receive postal messages</a>.' ), get_content_url("privacy") + '#pseudonym')
def __init__(self, *args, **kwargs): super(TermsForm, self).__init__(*args, **kwargs) self.fields['terms'].label = mark_safe( _('You agree to our <a href="{url_terms}" target="_blank">' 'Terms and Conditions</a> and <a href="{url_privacy}" target="_blank">' 'Privacy Statement</a>').format( url_terms=get_content_url("terms"), url_privacy=get_content_url("privacy") ) ) if has_newsletter(): self.fields['newsletter'] = forms.BooleanField( required=False, widget=BootstrapCheckboxInput, label=_("Check if you want to receive our newsletter.") )
def __init__(self, *args, **kwargs): address_required = kwargs.pop('address_required', False) super(NewUserBaseForm, self).__init__(*args, **kwargs) self.fields['address'].required = address_required if ALLOW_PSEUDONYM and not address_required: self.fields["last_name"].help_text = mark_safe( _('<a target="_blank" href="{url}">You may use a pseudonym if you don\'t need to receive postal messages</a>.' ).format(url=get_content_url("privacy") + '#pseudonym')) if address_required: self.fields['address'].help_text = ADDRESS_HELP_TEXT
def get_widget_context(): return { 'url': { 'searchPublicBody': reverse('api:publicbody-search'), 'listLaws': reverse('api:law-list'), 'getPublicBody': reverse('api:publicbody-detail', kwargs={'pk': '0'}), 'helpAbout': get_content_url('about') }, 'i18n': { 'missingPublicBody': _('Are we missing a public body?'), 'publicBodySearchPlaceholder': _('Ministry of...'), 'search': _('Search'), 'examples': _('Examples:'), 'environment': _('Environment'), 'ministryOfLabour': _('Ministry of Labour'), 'or': _('or'), 'noPublicBodiesFound': _('No Public Bodies found for this query.'), 'letUsKnow': _('Please let us know!'), } }
def get_widget_context(): return { 'url': { 'searchPublicBody': reverse('api:publicbody-search'), 'listLaws': reverse('api:law-list'), 'getPublicBody': reverse('api:publicbody-detail', kwargs={'pk': '0'}), 'helpAbout': get_content_url('about') }, 'i18n': { 'missingPublicBody': _('Are we missing a public body?'), 'publicBodySearchPlaceholder': _('Ministry of...'), 'search': _('Search'), 'searchPublicBodyLabel': _('Search for public authorities'), 'examples': _('Examples:'), 'environment': _('Environment'), 'ministryOfLabour': _('Ministry of Labour'), 'or': _('or'), 'noPublicBodiesFound': _('No Public Bodies found for this query.'), 'letUsKnow': _('Please let us know!'), } }
def __init__(self, *args, **kwargs): super().__init__(*args, **kwargs) if self.user is not None: self.fields['email'].initial = self.user.email self.fields['first_name'].initial = self.user.first_name self.fields['last_name'].initial = self.user.last_name parsed = parse_address(self.user.address) self.fields['address'].initial = parsed.get('address', '') self.fields['postcode'].initial = parsed.get('postcode', '') self.fields['city'].initial = parsed.get('city', '') self.fields['country'].initial = 'DE' self.fields.pop('account') else: self.fields['account'].choices = ( (1, format_html( 'Ja, super praktisch. Ich stimme den <a href="{url_terms}" target="_blank">' 'Nutzungsbedingungen</a> zu.', url_terms=get_content_url("terms"), )), (0, _('No, thank you.')), )
def __init__(self, *args, **kwargs): super(NewUserBaseForm, self).__init__(*args, **kwargs) if ALLOW_PSEUDONYM: self.fields["last_name"].help_text = mark_safe( _('<a target="_blank" href="{url}">You may use a pseudonym if you don\'t need to receive postal messages</a>.') .format(url=get_content_url("privacy") + '#pseudonym'))