diff --git a/requirements/dev-requirements.txt b/requirements/dev-requirements.txt index dba8788b2..49ded787e 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.8 +django-debug-toolbar==1.5 ipdb==0.10.1 pdbpp==0.9.2 pip-review==0.4 diff --git a/requirements/requirements.txt b/requirements/requirements.txt index f93a0ee00..6d9d79d66 100644 --- a/requirements/requirements.txt +++ b/requirements/requirements.txt @@ -1,21 +1,24 @@ dj-database-url==0.4.1 django-haystack==2.6.0 -django>=1.10,<1.11 -git+git://github.com/rubgombar1/django-admin-bootstrapped.git +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-bootstrap3==7.0.1 -django-bower==5.2.0 +django-bower==5.1.0 django-braces==1.9.0 django-compressor==2.0 -django-crispy-forms==1.6.1 -django-extensions==1.9.8 -django-extra-views==0.11.0 +django-crispy-forms==1.6.0 +django-extensions==1.6.7 +django-extra-views==0.8.0 django-filter==0.15.3 django-floppyforms==1.6.2 -django-model-utils==3.1.1 -django-sass-processor==0.5.8 +django-model-utils==2.5 +django-sass-processor==0.5.4 djangorestframework==3.4.0 -git+git://github.com/jasperlittle/django-rest-framework-docs -easy-thumbnails==2.5 +drfdocs==0.0.11 +easy-thumbnails==2.3 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 8b66d6586..9796768f2 100644 --- a/sapl/base/tests/teststub_urls.py +++ b/sapl/base/tests/teststub_urls.py @@ -1,9 +1,11 @@ -from django.conf.urls import url +from django.conf.urls import patterns, url from django.views.generic.base import TemplateView from sapl.urls import urlpatterns as original_patterns -ptrn = [url(r'^zzzz$', +ptrn = patterns('', + 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 d2f8b0bd1..4d12ba810 100644 --- a/sapl/comissoes/tests/test_comissoes.py +++ b/sapl/comissoes/tests/test_comissoes.py @@ -74,7 +74,6 @@ 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 2745b5c72..77ccca5d6 100644 --- a/sapl/materia/forms.py +++ b/sapl/materia/forms.py @@ -1166,7 +1166,7 @@ class TipoProposicaoSelect(Select): str(data_has_perfil), force_text(option_label)) - def render_options(self, selected_choices): + def render_options(self, choices, 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 a5d86e8fd..f7308f62e 100644 --- a/sapl/sessao/forms.py +++ b/sapl/sessao/forms.py @@ -422,7 +422,7 @@ class VotacaoForm(forms.Form): class VotacaoNominalForm(forms.Form): resultado_votacao = forms.ModelChoiceField(label='Resultado da Votação', - required=False, + required=True, queryset=TipoResultadoVotacao.objects.all()) diff --git a/sapl/sessao/views.py b/sapl/sessao/views.py index f9317c0d7..32813f84a 100644 --- a/sapl/sessao/views.py +++ b/sapl/sessao/views.py @@ -1838,6 +1838,9 @@ 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 @@ -1845,21 +1848,6 @@ 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 af5264896..b4da172f8 100644 --- a/sapl/settings.py +++ b/sapl/settings.py @@ -116,7 +116,11 @@ HAYSTACK_CONNECTIONS = { }, } -MIDDLEWARE = [ + +if DEBUG: + INSTALLED_APPS += ('debug_toolbar', 'rest_framework_docs',) + +MIDDLEWARE_CLASSES = ( 'reversion.middleware.RevisionMiddleware', 'django.contrib.sessions.middleware.SessionMiddleware', 'django.middleware.locale.LocaleMiddleware', @@ -127,13 +131,8 @@ MIDDLEWARE = [ 'django.contrib.messages.middleware.MessageMiddleware', 'django.middleware.clickjacking.XFrameOptionsMiddleware', 'django.middleware.security.SecurityMiddleware', - 'speedinfo.middleware.ProfilerMiddleware', -] -if DEBUG: - INSTALLED_APPS += ('debug_toolbar', 'rest_framework_docs',) - MIDDLEWARE += ['debug_toolbar.middleware.DebugToolbarMiddleware', ] - INTERNAL_IPS = ('127.0.0.1') - + # 'speedinfo.middleware.ProfilerMiddleware', # Bug na versão 1.9 +) CACHES = { 'default': { diff --git a/sapl/test_urls.py b/sapl/test_urls.py index 23e0c9544..851b1995b 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): + for perm in _get_all_permissions(klass._meta, ctype): searched_perms.append((ctype, perm)) all_perms = set(Permission.objects.filter( diff --git a/sapl/urls.py b/sapl/urls.py index 904b4357e..07f382013 100644 --- a/sapl/urls.py +++ b/sapl/urls.py @@ -70,12 +70,6 @@ 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)