Browse Source

Arruma bug no layout

pull/6/head
Eduardo Edson Batista Cordeiro Alves 9 years ago
committed by Luciano Almeida
parent
commit
5fef523351
  1. 5
      sigi/apps/crispy_layout_mixin.py
  2. 22
      sigi/apps/usuarios/forms.py
  3. 3
      sigi/apps/usuarios/layouts.yaml
  4. 3
      sigi/apps/usuarios/views.py

5
sigi/apps/crispy_layout_mixin.py

@ -42,10 +42,11 @@ def form_actions(more=[], save_label=_('Salvar')):
class FormLayout(Layout):
def __init__(self, label_cancel=_("Cancelar"), *fields):
def __init__(self, *fields):
buttons = form_actions(more=[
HTML('<a href="{{ view.cancel_url }}"'
' class="btn btn-inverse">%s</a>' % label_cancel)])
' class="btn btn-primary" style="background-color:black;">'
' Cancelar</a>')])
_fields = list(to_fieldsets(fields)) + [to_row([(buttons, 12)])]
super(FormLayout, self).__init__(*_fields)

22
sigi/apps/usuarios/forms.py

@ -57,7 +57,10 @@ class UsuarioForm(ModelForm):
widget=forms.Select(),
choices=TIPO_TELEFONE,
label=_(u'Tipo Telefone'))
segundo_ddd = forms.CharField(required=False, max_length=2, label=_(u'DDD'))
segundo_ddd = forms.CharField(
required=False,
max_length=2,
label=_(u'DDD'))
segundo_numero = forms.CharField(
required=False, max_length=10, label=_(u'Número'))
segundo_principal = forms.ChoiceField(
@ -86,12 +89,12 @@ class UsuarioForm(ModelForm):
class Meta(object):
model = Usuario
fields = [u'username', u'email', u'nome_completo', u'password', u'vinculo',
u'password_confirm', u'email_confirm', u'captcha', u'cpf', u'rg',
u'cargo', u'casa_legislativa']
fields = [u'username', u'email', u'nome_completo', u'password',
u'vinculo', u'password_confirm', u'email_confirm',
u'captcha', u'cpf', u'rg', u'cargo', u'casa_legislativa']
widgets = {u'email': forms.TextInput(
attrs={u'style': u'text-transform:lowercase;'}),}
attrs={u'style': u'text-transform:lowercase;'}), }
def __init__(self, *args, **kwargs):
super(UsuarioForm, self).__init__(*args, **kwargs)
@ -210,9 +213,11 @@ class UsuarioEditForm(UsuarioForm):
fields = [u'username', u'email', u'nome_completo', u'vinculo',
u'email_confirm', u'captcha', u'cpf', u'rg',
u'cargo', u'casa_legislativa']
widgets = {u'username': forms.TextInput(attrs={u'readonly': u'readonly'}),
widgets = {u'username': forms.TextInput(
attrs={u'readonly': u'readonly'}),
u'email': forms.TextInput(
attrs={u'style': u'text-transform:lowercase;'}),
attrs={u'style': u'text-transform:lowercase;'}
),
}
def __init__(self, *args, **kwargs):
@ -307,7 +312,8 @@ class HabilitarEditForm(ModelForm):
fields = [u'cpf', u'nome_completo', u'email', u'habilitado']
widgets = {
u'cpf': forms.TextInput(attrs={u'readonly': u'readonly'}),
u'nome_completo': forms.TextInput(attrs={u'readonly': u'readonly'}),
u'nome_completo': forms.TextInput(attrs={u'readonly': u'readonly'}
),
u'email': forms.TextInput(attrs={u'readonly': u'readonly'})
}

3
sigi/apps/usuarios/layouts.yaml

@ -1,4 +1,3 @@
CasaLegislativa:
Casa Legislativa:
- sigla:4 nome
@ -13,7 +12,7 @@ Subsecretaria:
- nome:8 sigla
Usuario:
Usuário:
Dados do Usuário:
- username nome_completo:9
- password password_confirm
- email email_confirm

3
sigi/apps/usuarios/views.py

@ -12,7 +12,8 @@ from sigi.apps.crud.utils import str2bool
from django.contrib.auth.tokens import default_token_generator
from django.utils.http import urlsafe_base64_encode, urlsafe_base64_decode
from django.utils.encoding import force_bytes
from sigi.apps.crud.base import Crud, CrudBaseMixin, CrudCreateView, CrudListView, CrudUpdateView, CrudDetailView
from sigi.apps.crud.base import (Crud, CrudBaseMixin, CrudCreateView,
CrudListView, CrudUpdateView, CrudDetailView)
from .forms import (HabilitarEditForm, MudarSenhaForm, UsuarioEditForm,
UsuarioForm)

Loading…
Cancel
Save