diff --git a/Dockerfile b/Dockerfile index d1a9ca29f..95782b591 100644 --- a/Dockerfile +++ b/Dockerfile @@ -40,7 +40,7 @@ COPY config/env_dockerfile /var/interlegis/sapl/sapl/.env # compilescss - Precompile all occurrences of your SASS/SCSS files for the whole project into css files -RUN python3 manage.py bower_install -- --allow-root --no-input && \ +RUN python3 manage.py bower_install --allow-root && \ python3 manage.py compilescss RUN python3 manage.py collectstatic --noinput --clear diff --git a/requirements/dev-requirements.txt b/requirements/dev-requirements.txt index 49ded787e..dba8788b2 100644 --- a/requirements/dev-requirements.txt +++ b/requirements/dev-requirements.txt @@ -2,7 +2,7 @@ autopep8==1.2.4 beautifulsoup4==4.6.0 -django-debug-toolbar==1.5 +django-debug-toolbar==1.8 ipdb==0.10.1 pdbpp==0.9.2 pip-review==0.4 diff --git a/requirements/requirements.txt b/requirements/requirements.txt index 6d9d79d66..f93a0ee00 100644 --- a/requirements/requirements.txt +++ b/requirements/requirements.txt @@ -1,24 +1,21 @@ dj-database-url==0.4.1 django-haystack==2.6.0 -django>=1.9,<1.10 -# TODO O django-admin-bootstrapped 2.5.7 não inseriu a mudança que permite -# a compatibilidade com Django 1.9+. A linha abaixo será mudada quando uma -# nova versão do django-admin-bootstrapped for lançada -git+git://github.com/django-admin-bootstrapped/django-admin-bootstrapped.git +django>=1.10,<1.11 +git+git://github.com/rubgombar1/django-admin-bootstrapped.git django-bootstrap3==7.0.1 -django-bower==5.1.0 +django-bower==5.2.0 django-braces==1.9.0 django-compressor==2.0 -django-crispy-forms==1.6.0 -django-extensions==1.6.7 -django-extra-views==0.8.0 +django-crispy-forms==1.6.1 +django-extensions==1.9.8 +django-extra-views==0.11.0 django-filter==0.15.3 django-floppyforms==1.6.2 -django-model-utils==2.5 -django-sass-processor==0.5.4 +django-model-utils==3.1.1 +django-sass-processor==0.5.8 djangorestframework==3.4.0 -drfdocs==0.0.11 -easy-thumbnails==2.3 +git+git://github.com/jasperlittle/django-rest-framework-docs +easy-thumbnails==2.5 django-image-cropping==1.1.0 git+git://github.com/interlegis/trml2pdf.git libsass==0.11.1 diff --git a/sapl/base/tests/teststub_urls.py b/sapl/base/tests/teststub_urls.py index 9796768f2..8b66d6586 100644 --- a/sapl/base/tests/teststub_urls.py +++ b/sapl/base/tests/teststub_urls.py @@ -1,11 +1,9 @@ -from django.conf.urls import patterns, url +from django.conf.urls import url from django.views.generic.base import TemplateView from sapl.urls import urlpatterns as original_patterns -ptrn = patterns('', - url(r'^zzzz$', +ptrn = [url(r'^zzzz$', TemplateView.as_view( - template_name='index.html'), name='zzzz')) - + template_name='index.html'), name='zzzz')] urlpatterns = original_patterns + ptrn diff --git a/sapl/comissoes/tests/test_comissoes.py b/sapl/comissoes/tests/test_comissoes.py index 4d12ba810..d2f8b0bd1 100644 --- a/sapl/comissoes/tests/test_comissoes.py +++ b/sapl/comissoes/tests/test_comissoes.py @@ -74,6 +74,7 @@ def test_incluir_comissao_submit(admin_client): 'nome': 'Comissão Teste', 'sigla': 'CT', 'data_criacao': '2016-03-22', + 'unidade_deliberativa': True, 'salvar': 'salvar'}, follow=True) assert response.status_code == 200 diff --git a/sapl/materia/forms.py b/sapl/materia/forms.py index b244af69a..80ceff110 100644 --- a/sapl/materia/forms.py +++ b/sapl/materia/forms.py @@ -1180,7 +1180,7 @@ class TipoProposicaoSelect(Select): str(data_has_perfil), force_text(option_label)) - def render_options(self, choices, selected_choices): + def render_options(self, selected_choices): # Normalize to strings. selected_choices = set(force_text(v) for v in selected_choices) output = [] diff --git a/sapl/sessao/forms.py b/sapl/sessao/forms.py index 96e85b9d8..f514ed6a7 100644 --- a/sapl/sessao/forms.py +++ b/sapl/sessao/forms.py @@ -430,7 +430,7 @@ class VotacaoForm(forms.Form): class VotacaoNominalForm(forms.Form): resultado_votacao = forms.ModelChoiceField(label='Resultado da Votação', - required=True, + required=False, queryset=TipoResultadoVotacao.objects.all()) diff --git a/sapl/sessao/views.py b/sapl/sessao/views.py index 6cc9300fb..35b490419 100644 --- a/sapl/sessao/views.py +++ b/sapl/sessao/views.py @@ -1898,9 +1898,6 @@ class VotacaoNominalAbstract(SessaoPermissionMixin): except ObjectDoesNotExist: raise Http404() - if 'cancelar-votacao' in request.POST: - fechar_votacao_materia(materia_votacao) - return self.form_valid(form) if form.is_valid(): votos_sim = 0 @@ -1908,6 +1905,21 @@ class VotacaoNominalAbstract(SessaoPermissionMixin): abstencoes = 0 nao_votou = 0 + if 'cancelar-votacao' in request.POST: + fechar_votacao_materia(materia_votacao) + if self.ordem: + return HttpResponseRedirect(reverse( + 'sapl.sessao:ordemdia_list', kwargs={'pk': kwargs['pk']})) + else: + return HttpResponseRedirect(reverse( + 'sapl.sessao:expedientemateria_list', + kwargs={'pk': kwargs['pk']})) + else: + if form.cleaned_data['resultado_votacao'] == None: + form.add_error(None, 'Não é possível finalizar a votação sem ' + 'nenhum resultado da votação') + return self.form_invalid(form) + for votos in request.POST.getlist('voto_parlamentar'): v = votos.split(':') voto = v[0] diff --git a/sapl/settings.py b/sapl/settings.py index 7413ecb81..6cc34401e 100644 --- a/sapl/settings.py +++ b/sapl/settings.py @@ -115,11 +115,7 @@ HAYSTACK_CONNECTIONS = { }, } - -if DEBUG: - INSTALLED_APPS += ('debug_toolbar', 'rest_framework_docs',) - -MIDDLEWARE_CLASSES = ( +MIDDLEWARE = [ 'reversion.middleware.RevisionMiddleware', 'django.contrib.sessions.middleware.SessionMiddleware', 'django.middleware.locale.LocaleMiddleware', @@ -130,8 +126,13 @@ MIDDLEWARE_CLASSES = ( 'django.contrib.messages.middleware.MessageMiddleware', 'django.middleware.clickjacking.XFrameOptionsMiddleware', 'django.middleware.security.SecurityMiddleware', - # 'speedinfo.middleware.ProfilerMiddleware', # Bug na versão 1.9 -) + 'speedinfo.middleware.ProfilerMiddleware', +] +if DEBUG: + INSTALLED_APPS += ('debug_toolbar', 'rest_framework_docs',) + MIDDLEWARE += ['debug_toolbar.middleware.DebugToolbarMiddleware', ] + INTERNAL_IPS = ('127.0.0.1') + CACHES = { 'default': { diff --git a/sapl/test_urls.py b/sapl/test_urls.py index 851b1995b..23e0c9544 100644 --- a/sapl/test_urls.py +++ b/sapl/test_urls.py @@ -56,7 +56,7 @@ def create_perms_post_migrate(sapl_app_config): ctype = ContentType.objects.get_for_model(klass) ctypes.add(ctype) - for perm in _get_all_permissions(klass._meta, ctype): + for perm in _get_all_permissions(klass._meta): searched_perms.append((ctype, perm)) all_perms = set(Permission.objects.filter( diff --git a/sapl/urls.py b/sapl/urls.py index 07f382013..904b4357e 100644 --- a/sapl/urls.py +++ b/sapl/urls.py @@ -70,6 +70,12 @@ urlpatterns = [ # http://stackoverflow.com/questions/35510373/ if settings.DEBUG: + import debug_toolbar + + urlpatterns += [ + url(r'^__debug__/', include(debug_toolbar.urls)), + + ] urlpatterns += static(settings.STATIC_URL, document_root=settings.STATIC_ROOT) diff --git a/setup.py b/setup.py index c11a354b1..0fffd52ef 100644 --- a/setup.py +++ b/setup.py @@ -11,29 +11,30 @@ os.chdir(os.path.normpath(os.path.join(os.path.abspath(__file__), os.pardir))) install_requires = [ 'dj-database-url==0.4.1', 'django-haystack==2.6.0', - 'django>=1.9,<1.10', + 'django>=1.10,<1.11', # TODO O django-admin-bootstrapped 2.5.7 não inseriu a mudança que permite # a compatibilidade com Django 1.9+. A linha abaixo será mudada quando uma # nova versão do django-admin-bootstrapped for lançada # 'git+git://github.com/django-admin-bootstrapped/ # django-admin-bootstrapped.git', 'django-bootstrap3==7.0.1', - 'django-bower==5.1.0', + 'django-bower==5.2.0', 'django-braces==1.9.0', 'django-compressor==2.0', - 'django-crispy-forms==1.6.0', - 'django-extensions==1.6.7', - 'django-extra-views==0.8.0', + 'django-crispy-forms==1.6.1', + 'django-extensions==1.9.8', + 'django-extra-views==0.11.0', 'django-filter==0.15.3', 'django-floppyforms==1.6.2', - 'django-model-utils==2.5', - 'django-sass-processor==0.5.4', - 'djangorestframework', + 'django-model-utils==3.1.1', + 'django-sass-processor==0.5.8', + 'djangorestframework==3.4.0', 'drfdocs', - 'easy-thumbnails==2.3', + 'easy-thumbnails==2.5', + 'django-image-cropping==1.1.0', # 'git+git://github.com/interlegis/trml2pdf.git', 'libsass==0.11.1', - 'psycopg2==2.7.3', + 'psycopg2==2.7.4', 'python-decouple==3.0', 'pytz==2016.4', 'pyyaml==3.11', @@ -45,7 +46,9 @@ install_requires = [ 'gunicorn==19.6.0', 'django-reversion==2.0.8', 'WeasyPrint==0.42', - 'whoosh==2.7.4' + 'whoosh==2.7.4', + 'django-speedinfo==1.3.5', + 'django-reversion-compare==0.8.4' ] setup( name='interlegis-sapl',