diff --git a/requirements/requirements.txt b/requirements/requirements.txt index 694f67b..e7d0bed 100644 --- a/requirements/requirements.txt +++ b/requirements/requirements.txt @@ -17,6 +17,7 @@ django-image-cropping==1.0.3 django-localflavor==1.3 django-model-utils==2.4 django-sass-processor==0.3.4 +django-easy-select2==1.3.2 django-simple-captcha==0.5.1 Django==1.9.6 libsass==0.11.0 diff --git a/sigi/apps/usuarios/forms.py b/sigi/apps/usuarios/forms.py index d34e739..0cde164 100644 --- a/sigi/apps/usuarios/forms.py +++ b/sigi/apps/usuarios/forms.py @@ -14,7 +14,8 @@ from django.core.exceptions import ValidationError from django.db import transaction from django.forms import ModelForm from django.utils.translation import ugettext_lazy as _ - +from sigi.apps.casas.models import CasaLegislativa +from easy_select2 import Select2 import sigi.apps.crispy_layout_mixin from sigi.apps.crud.utils import YES_NO_CHOICES @@ -87,6 +88,11 @@ class UsuarioForm(ModelForm): captcha = CaptchaField() + casa_legislativa = forms.ModelChoiceField( + queryset=CasaLegislativa.objects.all(), + widget=Select2() + ) + class Meta(object): model = Usuario fields = [u'username', u'email', u'nome_completo', u'password', diff --git a/sigi/settings/base.py b/sigi/settings/base.py index fea53bc..91c41d9 100644 --- a/sigi/settings/base.py +++ b/sigi/settings/base.py @@ -93,6 +93,7 @@ INSTALLED_APPS = ( 'djangobower', 'floppyforms', 'sass_processor', + 'easy_select2', )