Browse Source

Migra para django 1.10 (#2320)

* Revert "Revert "fix #1827 (#2234)""

This reverts commit 0278634119.

* Revert "Revert "HOT-FIX: conserta erro django-bower + Django 1.10""

This reverts commit 1f0d31a409.

* 3.1.121-BETA

* bump version
pull/2329/head
Victor Fabre 6 years ago
committed by Edward
parent
commit
3b12756128
  1. 2
      Dockerfile
  2. 2
      requirements/dev-requirements.txt
  3. 23
      requirements/requirements.txt
  4. 8
      sapl/base/tests/teststub_urls.py
  5. 1
      sapl/comissoes/tests/test_comissoes.py
  6. 2
      sapl/materia/forms.py
  7. 2
      sapl/sessao/forms.py
  8. 18
      sapl/sessao/views.py
  9. 15
      sapl/settings.py
  10. 2
      sapl/test_urls.py
  11. 6
      sapl/urls.py
  12. 25
      setup.py

2
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 # 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 python3 manage.py compilescss
RUN python3 manage.py collectstatic --noinput --clear RUN python3 manage.py collectstatic --noinput --clear

2
requirements/dev-requirements.txt

@ -2,7 +2,7 @@
autopep8==1.2.4 autopep8==1.2.4
beautifulsoup4==4.6.0 beautifulsoup4==4.6.0
django-debug-toolbar==1.5 django-debug-toolbar==1.8
ipdb==0.10.1 ipdb==0.10.1
pdbpp==0.9.2 pdbpp==0.9.2
pip-review==0.4 pip-review==0.4

23
requirements/requirements.txt

@ -1,24 +1,21 @@
dj-database-url==0.4.1 dj-database-url==0.4.1
django-haystack==2.6.0 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 git+git://github.com/rubgombar1/django-admin-bootstrapped.git
# 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-bootstrap3==7.0.1
django-bower==5.1.0 django-bower==5.2.0
django-braces==1.9.0 django-braces==1.9.0
django-compressor==2.0 django-compressor==2.0
django-crispy-forms==1.6.0 django-crispy-forms==1.6.1
django-extensions==1.6.7 django-extensions==1.9.8
django-extra-views==0.8.0 django-extra-views==0.11.0
django-filter==0.15.3 django-filter==0.15.3
django-floppyforms==1.6.2 django-floppyforms==1.6.2
django-model-utils==2.5 django-model-utils==3.1.1
django-sass-processor==0.5.4 django-sass-processor==0.5.8
djangorestframework==3.4.0 djangorestframework==3.4.0
drfdocs==0.0.11 git+git://github.com/jasperlittle/django-rest-framework-docs
easy-thumbnails==2.3 easy-thumbnails==2.5
django-image-cropping==1.1.0 django-image-cropping==1.1.0
git+git://github.com/interlegis/trml2pdf.git git+git://github.com/interlegis/trml2pdf.git
libsass==0.11.1 libsass==0.11.1

8
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 django.views.generic.base import TemplateView
from sapl.urls import urlpatterns as original_patterns from sapl.urls import urlpatterns as original_patterns
ptrn = patterns('', ptrn = [url(r'^zzzz$',
url(r'^zzzz$',
TemplateView.as_view( TemplateView.as_view(
template_name='index.html'), name='zzzz')) template_name='index.html'), name='zzzz')]
urlpatterns = original_patterns + ptrn urlpatterns = original_patterns + ptrn

1
sapl/comissoes/tests/test_comissoes.py

@ -74,6 +74,7 @@ def test_incluir_comissao_submit(admin_client):
'nome': 'Comissão Teste', 'nome': 'Comissão Teste',
'sigla': 'CT', 'sigla': 'CT',
'data_criacao': '2016-03-22', 'data_criacao': '2016-03-22',
'unidade_deliberativa': True,
'salvar': 'salvar'}, 'salvar': 'salvar'},
follow=True) follow=True)
assert response.status_code == 200 assert response.status_code == 200

2
sapl/materia/forms.py

@ -1180,7 +1180,7 @@ class TipoProposicaoSelect(Select):
str(data_has_perfil), str(data_has_perfil),
force_text(option_label)) force_text(option_label))
def render_options(self, choices, selected_choices): def render_options(self, selected_choices):
# Normalize to strings. # Normalize to strings.
selected_choices = set(force_text(v) for v in selected_choices) selected_choices = set(force_text(v) for v in selected_choices)
output = [] output = []

2
sapl/sessao/forms.py

@ -430,7 +430,7 @@ class VotacaoForm(forms.Form):
class VotacaoNominalForm(forms.Form): class VotacaoNominalForm(forms.Form):
resultado_votacao = forms.ModelChoiceField(label='Resultado da Votação', resultado_votacao = forms.ModelChoiceField(label='Resultado da Votação',
required=True, required=False,
queryset=TipoResultadoVotacao.objects.all()) queryset=TipoResultadoVotacao.objects.all())

18
sapl/sessao/views.py

@ -1898,9 +1898,6 @@ class VotacaoNominalAbstract(SessaoPermissionMixin):
except ObjectDoesNotExist: except ObjectDoesNotExist:
raise Http404() raise Http404()
if 'cancelar-votacao' in request.POST:
fechar_votacao_materia(materia_votacao)
return self.form_valid(form)
if form.is_valid(): if form.is_valid():
votos_sim = 0 votos_sim = 0
@ -1908,6 +1905,21 @@ class VotacaoNominalAbstract(SessaoPermissionMixin):
abstencoes = 0 abstencoes = 0
nao_votou = 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'): for votos in request.POST.getlist('voto_parlamentar'):
v = votos.split(':') v = votos.split(':')
voto = v[0] voto = v[0]

15
sapl/settings.py

@ -115,11 +115,7 @@ HAYSTACK_CONNECTIONS = {
}, },
} }
MIDDLEWARE = [
if DEBUG:
INSTALLED_APPS += ('debug_toolbar', 'rest_framework_docs',)
MIDDLEWARE_CLASSES = (
'reversion.middleware.RevisionMiddleware', 'reversion.middleware.RevisionMiddleware',
'django.contrib.sessions.middleware.SessionMiddleware', 'django.contrib.sessions.middleware.SessionMiddleware',
'django.middleware.locale.LocaleMiddleware', 'django.middleware.locale.LocaleMiddleware',
@ -130,8 +126,13 @@ MIDDLEWARE_CLASSES = (
'django.contrib.messages.middleware.MessageMiddleware', 'django.contrib.messages.middleware.MessageMiddleware',
'django.middleware.clickjacking.XFrameOptionsMiddleware', 'django.middleware.clickjacking.XFrameOptionsMiddleware',
'django.middleware.security.SecurityMiddleware', '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 = { CACHES = {
'default': { 'default': {

2
sapl/test_urls.py

@ -56,7 +56,7 @@ def create_perms_post_migrate(sapl_app_config):
ctype = ContentType.objects.get_for_model(klass) ctype = ContentType.objects.get_for_model(klass)
ctypes.add(ctype) 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)) searched_perms.append((ctype, perm))
all_perms = set(Permission.objects.filter( all_perms = set(Permission.objects.filter(

6
sapl/urls.py

@ -70,6 +70,12 @@ urlpatterns = [
# http://stackoverflow.com/questions/35510373/ # http://stackoverflow.com/questions/35510373/
if settings.DEBUG: if settings.DEBUG:
import debug_toolbar
urlpatterns += [
url(r'^__debug__/', include(debug_toolbar.urls)),
]
urlpatterns += static(settings.STATIC_URL, urlpatterns += static(settings.STATIC_URL,
document_root=settings.STATIC_ROOT) document_root=settings.STATIC_ROOT)

25
setup.py

@ -11,29 +11,30 @@ os.chdir(os.path.normpath(os.path.join(os.path.abspath(__file__), os.pardir)))
install_requires = [ install_requires = [
'dj-database-url==0.4.1', 'dj-database-url==0.4.1',
'django-haystack==2.6.0', '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 # 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 # a compatibilidade com Django 1.9+. A linha abaixo será mudada quando uma
# nova versão do django-admin-bootstrapped for lançada # nova versão do django-admin-bootstrapped for lançada
# 'git+git://github.com/django-admin-bootstrapped/ # 'git+git://github.com/django-admin-bootstrapped/
# django-admin-bootstrapped.git', # django-admin-bootstrapped.git',
'django-bootstrap3==7.0.1', 'django-bootstrap3==7.0.1',
'django-bower==5.1.0', 'django-bower==5.2.0',
'django-braces==1.9.0', 'django-braces==1.9.0',
'django-compressor==2.0', 'django-compressor==2.0',
'django-crispy-forms==1.6.0', 'django-crispy-forms==1.6.1',
'django-extensions==1.6.7', 'django-extensions==1.9.8',
'django-extra-views==0.8.0', 'django-extra-views==0.11.0',
'django-filter==0.15.3', 'django-filter==0.15.3',
'django-floppyforms==1.6.2', 'django-floppyforms==1.6.2',
'django-model-utils==2.5', 'django-model-utils==3.1.1',
'django-sass-processor==0.5.4', 'django-sass-processor==0.5.8',
'djangorestframework', 'djangorestframework==3.4.0',
'drfdocs', 'drfdocs',
'easy-thumbnails==2.3', 'easy-thumbnails==2.5',
'django-image-cropping==1.1.0',
# 'git+git://github.com/interlegis/trml2pdf.git', # 'git+git://github.com/interlegis/trml2pdf.git',
'libsass==0.11.1', 'libsass==0.11.1',
'psycopg2==2.7.3', 'psycopg2==2.7.4',
'python-decouple==3.0', 'python-decouple==3.0',
'pytz==2016.4', 'pytz==2016.4',
'pyyaml==3.11', 'pyyaml==3.11',
@ -45,7 +46,9 @@ install_requires = [
'gunicorn==19.6.0', 'gunicorn==19.6.0',
'django-reversion==2.0.8', 'django-reversion==2.0.8',
'WeasyPrint==0.42', 'WeasyPrint==0.42',
'whoosh==2.7.4' 'whoosh==2.7.4',
'django-speedinfo==1.3.5',
'django-reversion-compare==0.8.4'
] ]
setup( setup(
name='interlegis-sapl', name='interlegis-sapl',

Loading…
Cancel
Save