From 1db4ceaf8eb2881fb441c717098a1011cf2c9e74 Mon Sep 17 00:00:00 2001 From: Rafael Ferreira Date: Fri, 22 Nov 2013 18:55:33 -0200 Subject: [PATCH] adjusted forms --- forms.py | 19 +++++++++++++------ models.py | 2 ++ 2 files changed, 15 insertions(+), 6 deletions(-) diff --git a/forms.py b/forms.py index 3722f26..1d8a017 100644 --- a/forms.py +++ b/forms.py @@ -14,19 +14,26 @@ ('Usuario','Usuario'), ) +PackageTypes = ( + ('Envelope [menos de 1kg]', 'Envelope [menos de 1kg]'), + ('Pacote [ate 10 kg]', 'Pacote [ate 10 kg]'), + ('Acima de 10 kg', 'Acima de 10 kg'), +) + class AppUserForm(djangoforms.ModelForm): - real_user = forms.EmailField(label='Usuario',widget=forms.TextInput(attrs={'size':'50','maxlength':'50'} )) - #name = forms.CharField(label='Identificacao',widget=forms.TextInput(attrs={'size':'50','maxlength':'50'} )) - vehicle = forms.TypedChoiceField(choices=Vehicles, initial='Moto') - user_type = forms.TypedChoiceField(choices=UserTypes, initial='Usuario') + name = forms.CharField(label='Nome',widget=forms.TextInput(attrs={'size':'50','maxlength':'50'} )) + real_user = forms.EmailField(label='E-mail',widget=forms.TextInput(attrs={'size':'50','maxlength':'50'} )) + phone = forms.CharField(label='Telefone',widget=forms.TextInput(attrs={'size':'50','maxlength':'50'} )) + #vehicle = forms.TypedChoiceField(choices=Vehicles, initial='Moto') + #user_type = forms.TypedChoiceField(choices=UserTypes, initial='Usuario') class Meta: model = AppUser - exclude = ['last_status', 'last_position', 'user_email'] + exclude = ['last_status', 'last_position', 'user_email', 'last_lng', 'last_lat', 'avg_price', 'social_id', 'vehicle', 'user_type'] class DeliverFeeForm(djangoforms.ModelForm): source_address = forms.CharField(label='Origem',widget=forms.TextInput(attrs={'size':'50','maxlength':'50'} )) destination_address = forms.CharField(label='Destino',widget=forms.TextInput(attrs={'size':'50','maxlength':'50'} )) - item = forms.CharField(label='Item',widget=forms.Textarea) + item = forms.TypedChoiceField(choices=PackageTypes, initial='Envelope [menos de 1kg]') class Meta: model = DeliverFee exclude = ['dest_lng','dest_lat', 'source_lat', 'source_lng','request_user', 'item', 'request_date_time', 'closed', 'state'] \ No newline at end of file diff --git a/models.py b/models.py index f0c0d66..71a30d7 100644 --- a/models.py +++ b/models.py @@ -12,6 +12,8 @@ class AppUser(db.Model): last_lng = db.StringProperty() avg_price = db.StringProperty() social_id = db.StringProperty() + name = db.StringProperty() + phone = db.StringProperty() class DeliverFee(db.Model): source_address = db.StringProperty()