Exemplo n.º 1
0
    def __init__(self,
                 based_fields=None,
                 zoom=None,
                 suffix='',
                 default=None,
                 *args,
                 **kwargs):
        kwargs['initial'] = default

        self.widget = LocationWidget(based_fields=based_fields,
                                     zoom=zoom,
                                     suffix=suffix,
                                     **kwargs)

        dwargs = {
            'required': True,
            'label': None,
            'initial': None,
            'help_text': None,
            'error_messages': None,
            'show_hidden_initial': False,
        }

        for attr in dwargs:
            if attr in kwargs:
                dwargs[attr] = kwargs[attr]

        super(PlainLocationField, self).__init__(*args, **dwargs)
Exemplo n.º 2
0
Arquivo: forms.py Projeto: JJ810/URPSM
 class Meta:
     model = Shop
     exclude = ('balance', 'rank','level')
     widgets = {
         'name': forms.TextInput(attrs={'class': 'form-control', 'placeholder': 'Shop name'}),
         'shop_phone': forms.TextInput(attrs={'class': 'form-control', 'placeholder': '+212612345678'}),
         'shop_email': forms.EmailInput(attrs={'class': 'form-control', 'placeholder': '*****@*****.**'}),
         'vat': forms.TextInput(attrs={'class': 'form-control', 'placeholder': '20'}),
         'country': forms.Select(attrs={'class': 'form-control', 'placeholder': 'Country'}),
         # 'city': forms.Select(attrs={'class': 'form-control', 'placeholder': 'City'}),
         'city': ChainedSelect(
             app_name='simplecities',
             model_name='city',
             chain_field='country',
             model_field='country',
             show_all=False,
             auto_choose=False,
             attrs={'class': 'form-control'},
             # select2_options={'width': '100%'}
         ),
         'address': forms.TextInput(attrs={'class': 'form-control', 'placeholder': 'Shop address'}),
         'description': forms.Textarea(attrs={'class': 'form-control'}),
         'location': LocationWidget(attrs={'class': 'form-control'}),
         'logo': FrontImageWidget(attrs={'class': 'form-control'}),
         'website': forms.TextInput(attrs={'class': 'form-control', 'placeholder': 'Website'}),
         'facebook': forms.TextInput(attrs={'class': 'form-control', 'placeholder': 'Facebook'}),
         'twitter': forms.TextInput(attrs={'class': 'form-control', 'placeholder': 'Twitter'}),
         'google_plus': forms.TextInput(attrs={'class': 'form-control', 'placeholder': 'Google Plus'}),
         'paypal_email': forms.EmailInput(attrs={'class': 'form-control', 'placeholder': 'Your paypal account email'}),
     }