@@ -43,7 +43,9 @@
{% for value, href, obj in value_list %}
{% if forloop.first %}
-
+ {% if obj.fotografia %}
+
+ {% endif %}
|
{% endif %}
diff --git a/setup.py b/setup.py
index 018ff1002..12a1823a7 100644
--- a/setup.py
+++ b/setup.py
@@ -18,10 +18,10 @@ install_requires = [
'django-bower==5.2.0',
'django-braces==1.9.0',
'django-crispy-forms==1.7.2',
+ 'django-floppyforms==1.7.0',
- 'django-extensions==1.9.8',
'django-extra-views==0.11.0',
- 'django-floppyforms==1.6.2',
+ 'django-extensions==1.9.8',
'django-model-utils==3.1.1',
'django-sass-processor==0.5.8',
'drfdocs',
From 3564909a1b6baf6735e471af5ca3fdb006738b18 Mon Sep 17 00:00:00 2001
From: Leandro Roberto
Date: Mon, 7 Jan 2019 01:03:06 -0200
Subject: [PATCH 10/35] bump django-extra-views
---
requirements/requirements.txt | 2 +-
sapl/settings.py | 25 +++++++++++++++-------
sapl/temp_suppress_crispy_form_warnings.py | 22 -------------------
setup.py | 2 +-
4 files changed, 19 insertions(+), 32 deletions(-)
delete mode 100644 sapl/temp_suppress_crispy_form_warnings.py
diff --git a/requirements/requirements.txt b/requirements/requirements.txt
index 524549446..3b260f0d6 100644
--- a/requirements/requirements.txt
+++ b/requirements/requirements.txt
@@ -8,9 +8,9 @@ django-bower==5.2.0
django-braces==1.9.0
django-crispy-forms==1.7.2
django-floppyforms==1.7.0
+django-extra-views==0.12.0
django-extensions==1.9.8
-django-extra-views==0.11.0
django-model-utils==3.1.1
django-sass-processor==0.5.8
easy-thumbnails==2.5
diff --git a/sapl/settings.py b/sapl/settings.py
index fbc19f53f..78f8f7781 100755
--- a/sapl/settings.py
+++ b/sapl/settings.py
@@ -22,9 +22,6 @@ from dj_database_url import parse as db_url
from easy_thumbnails.conf import Settings as thumbnail_settings
from unipath import Path
-from .temp_suppress_crispy_form_warnings import \
- SUPRESS_CRISPY_FORM_WARNINGS_LOGGING
-
host = socket.gethostbyname_ex(socket.gethostname())[0]
@@ -288,6 +285,7 @@ DAB_FIELD_RENDERER = \
CRISPY_TEMPLATE_PACK = 'bootstrap3'
CRISPY_ALLOWED_TEMPLATE_PACKS = 'bootstrap3'
CRISPY_FAIL_SILENTLY = not DEBUG
+FLOPPY_FORMS_USE_GIS = False
BOWER_COMPONENTS_ROOT = PROJECT_DIR.child("bower")
BOWER_INSTALLED_APPS = (
@@ -345,6 +343,22 @@ LOGGING = {
}
}
+PASSWORD_HASHERS = [
+ 'django.contrib.auth.hashers.PBKDF2PasswordHasher', # default
+ 'sapl.hashers.ZopeSHA1PasswordHasher',
+]
+
+
+def remove_warnings():
+ import warnings
+ warnings.filterwarnings(
+ 'ignore', module='floppyforms',
+ message='Unable to import floppyforms.gis'
+ )
+
+
+remove_warnings()
+
def uncaught_exceptions(type, value, error_traceback):
import traceback
@@ -356,8 +370,3 @@ def uncaught_exceptions(type, value, error_traceback):
# captura exceções que não foram tratadas
sys.excepthook = uncaught_exceptions
-
-PASSWORD_HASHERS = [
- 'django.contrib.auth.hashers.PBKDF2PasswordHasher', # default
- 'sapl.hashers.ZopeSHA1PasswordHasher',
-]
diff --git a/sapl/temp_suppress_crispy_form_warnings.py b/sapl/temp_suppress_crispy_form_warnings.py
deleted file mode 100644
index 39105d39e..000000000
--- a/sapl/temp_suppress_crispy_form_warnings.py
+++ /dev/null
@@ -1,22 +0,0 @@
-import copy
-import logging
-
-from django.utils.log import DEFAULT_LOGGING
-
-# hack to suppress many annoying warnings from crispy_forms
-# Do remove this file and corresponding import in settings
-# when crispy_forms is corrected !!!
-SUPRESS_CRISPY_FORM_WARNINGS_LOGGING = copy.deepcopy(DEFAULT_LOGGING)
-SUPRESS_CRISPY_FORM_WARNINGS_LOGGING['filters']['suppress_deprecated'] = {
- '()': 'sapl.temp_suppress_crispy_form_warnings.SuppressDeprecated'
-}
-SUPRESS_CRISPY_FORM_WARNINGS_LOGGING['handlers']['console']['filters'].append(
- 'suppress_deprecated')
-
-
-class SuppressDeprecated(logging.Filter):
-
- def filter(self, record):
- msg = record.getMessage()
- return not ('crispy_forms' in msg and
- 'RemovedInDjango19Warning' in msg)
diff --git a/setup.py b/setup.py
index 12a1823a7..4a44886a9 100644
--- a/setup.py
+++ b/setup.py
@@ -19,8 +19,8 @@ install_requires = [
'django-braces==1.9.0',
'django-crispy-forms==1.7.2',
'django-floppyforms==1.7.0',
+ 'django-extra-views==0.12.0',
- 'django-extra-views==0.11.0',
'django-extensions==1.9.8',
'django-model-utils==3.1.1',
'django-sass-processor==0.5.8',
From 08d249f123304f8bcb817c89bd1cdf3bb36e7b0a Mon Sep 17 00:00:00 2001
From: Leandro Roberto
Date: Mon, 7 Jan 2019 09:57:28 -0200
Subject: [PATCH 11/35] bump django-models-utils e django-sass-processor
---
requirements/requirements.txt | 4 ++--
setup.py | 4 ++--
2 files changed, 4 insertions(+), 4 deletions(-)
diff --git a/requirements/requirements.txt b/requirements/requirements.txt
index 3b260f0d6..5ad014630 100644
--- a/requirements/requirements.txt
+++ b/requirements/requirements.txt
@@ -9,10 +9,10 @@ django-braces==1.9.0
django-crispy-forms==1.7.2
django-floppyforms==1.7.0
django-extra-views==0.12.0
+django-model-utils==3.1.2
+django-sass-processor==0.7.2
django-extensions==1.9.8
-django-model-utils==3.1.1
-django-sass-processor==0.5.8
easy-thumbnails==2.5
django-image-cropping==1.2
libsass==0.11.1
diff --git a/setup.py b/setup.py
index 4a44886a9..b17a241c0 100644
--- a/setup.py
+++ b/setup.py
@@ -20,10 +20,10 @@ install_requires = [
'django-crispy-forms==1.7.2',
'django-floppyforms==1.7.0',
'django-extra-views==0.12.0',
+ 'django-model-utils==3.1.2',
+ 'django-sass-processor==0.7.2',
'django-extensions==1.9.8',
- 'django-model-utils==3.1.1',
- 'django-sass-processor==0.5.8',
'drfdocs',
'easy-thumbnails==2.5',
'django-image-cropping==1.1.0',
From 9bc8225bbc0a14b2bf526d96df15fdb81d115ce7 Mon Sep 17 00:00:00 2001
From: Leandro Roberto
Date: Mon, 7 Jan 2019 10:18:30 -0200
Subject: [PATCH 12/35] bump django-reversion e django-reversion-compare
---
requirements/requirements.txt | 4 ++--
setup.py | 4 ++--
2 files changed, 4 insertions(+), 4 deletions(-)
diff --git a/requirements/requirements.txt b/requirements/requirements.txt
index 5ad014630..229fc2b44 100644
--- a/requirements/requirements.txt
+++ b/requirements/requirements.txt
@@ -11,6 +11,8 @@ django-floppyforms==1.7.0
django-extra-views==0.12.0
django-model-utils==3.1.2
django-sass-processor==0.7.2
+django-reversion==3.0.2
+django-reversion-compare==0.8.6
django-extensions==1.9.8
easy-thumbnails==2.5
@@ -26,11 +28,9 @@ unipath==1.1
pysolr==3.6.0
python-magic==0.4.12
gunicorn==19.6.0
-django-reversion==2.0.8
WeasyPrint==0.42
whoosh==2.7.4
django-speedinfo==1.3.5
-django-reversion-compare==0.8.4
git+git://github.com/interlegis/trml2pdf.git
git+git://github.com/jasperlittle/django-rest-framework-docs
diff --git a/setup.py b/setup.py
index b17a241c0..c08b7cafb 100644
--- a/setup.py
+++ b/setup.py
@@ -22,6 +22,8 @@ install_requires = [
'django-extra-views==0.12.0',
'django-model-utils==3.1.2',
'django-sass-processor==0.7.2',
+ 'django-reversion==3.0.2',
+ 'django-reversion-compare==0.8.6'
'django-extensions==1.9.8',
'drfdocs',
@@ -38,11 +40,9 @@ install_requires = [
'pysolr==3.6.0',
'python-magic==0.4.12',
'gunicorn==19.6.0',
- 'django-reversion==2.0.8',
'WeasyPrint==0.42',
'whoosh==2.7.4',
'django-speedinfo==1.3.5',
- 'django-reversion-compare==0.8.4'
# 'git+git://github.com/interlegis/trml2pdf.git',
# 'git+git://github.com/jasperlittle/django-rest-framework-docs'
# 'git+git://github.com/rubgombar1/django-admin-bootstrapped.git''
From 93c462703ff30be1e3f970caf905c0ed93daf2bf Mon Sep 17 00:00:00 2001
From: Leandro Roberto
Date: Mon, 7 Jan 2019 10:25:46 -0200
Subject: [PATCH 13/35] bump django-speedinfo
---
requirements/requirements.txt | 2 +-
setup.py | 2 +-
2 files changed, 2 insertions(+), 2 deletions(-)
diff --git a/requirements/requirements.txt b/requirements/requirements.txt
index 229fc2b44..0ebfd9195 100644
--- a/requirements/requirements.txt
+++ b/requirements/requirements.txt
@@ -13,6 +13,7 @@ django-model-utils==3.1.2
django-sass-processor==0.7.2
django-reversion==3.0.2
django-reversion-compare==0.8.6
+django-speedinfo==1.4.0
django-extensions==1.9.8
easy-thumbnails==2.5
@@ -30,7 +31,6 @@ python-magic==0.4.12
gunicorn==19.6.0
WeasyPrint==0.42
whoosh==2.7.4
-django-speedinfo==1.3.5
git+git://github.com/interlegis/trml2pdf.git
git+git://github.com/jasperlittle/django-rest-framework-docs
diff --git a/setup.py b/setup.py
index c08b7cafb..e7839c35e 100644
--- a/setup.py
+++ b/setup.py
@@ -24,6 +24,7 @@ install_requires = [
'django-sass-processor==0.7.2',
'django-reversion==3.0.2',
'django-reversion-compare==0.8.6'
+ 'django-speedinfo==1.4.0',
'django-extensions==1.9.8',
'drfdocs',
@@ -42,7 +43,6 @@ install_requires = [
'gunicorn==19.6.0',
'WeasyPrint==0.42',
'whoosh==2.7.4',
- 'django-speedinfo==1.3.5',
# 'git+git://github.com/interlegis/trml2pdf.git',
# 'git+git://github.com/jasperlittle/django-rest-framework-docs'
# 'git+git://github.com/rubgombar1/django-admin-bootstrapped.git''
From 1c6192a54e9ff358908fa3ed0d5be56bf4001cde Mon Sep 17 00:00:00 2001
From: Leandro Roberto
Date: Mon, 7 Jan 2019 10:31:54 -0200
Subject: [PATCH 14/35] bump django-extensions
---
requirements/requirements.txt | 4 ++--
sapl/settings.py | 6 ++----
setup.py | 2 +-
3 files changed, 5 insertions(+), 7 deletions(-)
diff --git a/requirements/requirements.txt b/requirements/requirements.txt
index 0ebfd9195..2b83fa694 100644
--- a/requirements/requirements.txt
+++ b/requirements/requirements.txt
@@ -14,10 +14,10 @@ django-sass-processor==0.7.2
django-reversion==3.0.2
django-reversion-compare==0.8.6
django-speedinfo==1.4.0
+django-extensions==2.1.4
-django-extensions==1.9.8
-easy-thumbnails==2.5
django-image-cropping==1.2
+easy-thumbnails==2.5
libsass==0.11.1
psycopg2-binary==2.7.4
python-decouple==3.0
diff --git a/sapl/settings.py b/sapl/settings.py
index 78f8f7781..782cbb0f4 100755
--- a/sapl/settings.py
+++ b/sapl/settings.py
@@ -75,21 +75,19 @@ INSTALLED_APPS = (
'django.contrib.sessions',
'django.contrib.messages',
'django.contrib.staticfiles',
+ 'django_extensions',
'djangobower',
'bootstrap3',
'crispy_forms',
'floppyforms',
+ 'sass_processor',
'rest_framework',
'django_filters',
-
-
- 'django_extensions',
'easy_thumbnails',
'image_cropping',
- 'sass_processor',
'reversion',
'reversion_compare',
diff --git a/setup.py b/setup.py
index e7839c35e..2ebde35b9 100644
--- a/setup.py
+++ b/setup.py
@@ -25,8 +25,8 @@ install_requires = [
'django-reversion==3.0.2',
'django-reversion-compare==0.8.6'
'django-speedinfo==1.4.0',
+ 'django-extensions==2.1.4',
- 'django-extensions==1.9.8',
'drfdocs',
'easy-thumbnails==2.5',
'django-image-cropping==1.1.0',
From 33200eae61f253baf2ac826a2bf9ffa3e6efc934 Mon Sep 17 00:00:00 2001
From: Leandro Roberto
Date: Mon, 7 Jan 2019 10:33:54 -0200
Subject: [PATCH 15/35] bump django-image-cropping
---
setup.py | 7 ++++---
1 file changed, 4 insertions(+), 3 deletions(-)
diff --git a/setup.py b/setup.py
index 2ebde35b9..3917d49bd 100644
--- a/setup.py
+++ b/setup.py
@@ -26,10 +26,9 @@ install_requires = [
'django-reversion-compare==0.8.6'
'django-speedinfo==1.4.0',
'django-extensions==2.1.4',
-
- 'drfdocs',
+ 'django-image-cropping==1.2.0',
'easy-thumbnails==2.5',
- 'django-image-cropping==1.1.0',
+
'libsass==0.11.1',
'psycopg2==2.7.4',
'python-decouple==3.0',
@@ -43,6 +42,8 @@ install_requires = [
'gunicorn==19.6.0',
'WeasyPrint==0.42',
'whoosh==2.7.4',
+
+ 'drfdocs',
# 'git+git://github.com/interlegis/trml2pdf.git',
# 'git+git://github.com/jasperlittle/django-rest-framework-docs'
# 'git+git://github.com/rubgombar1/django-admin-bootstrapped.git''
From bfdbf82ef5fc121c3cf683d70f13ec316b3a1ac8 Mon Sep 17 00:00:00 2001
From: Leandro Roberto
Date: Mon, 7 Jan 2019 10:38:06 -0200
Subject: [PATCH 16/35] bump libsass
---
requirements/requirements.txt | 10 +++++-----
setup.py | 4 ++--
2 files changed, 7 insertions(+), 7 deletions(-)
diff --git a/requirements/requirements.txt b/requirements/requirements.txt
index 2b83fa694..5e5425ebe 100644
--- a/requirements/requirements.txt
+++ b/requirements/requirements.txt
@@ -15,10 +15,10 @@ django-reversion==3.0.2
django-reversion-compare==0.8.6
django-speedinfo==1.4.0
django-extensions==2.1.4
-
django-image-cropping==1.2
easy-thumbnails==2.5
-libsass==0.11.1
+libsass==0.17.0
+
psycopg2-binary==2.7.4
python-decouple==3.0
pytz==2016.4
@@ -32,8 +32,8 @@ gunicorn==19.6.0
WeasyPrint==0.42
whoosh==2.7.4
-git+git://github.com/interlegis/trml2pdf.git
-git+git://github.com/jasperlittle/django-rest-framework-docs
-git+git://github.com/rubgombar1/django-admin-bootstrapped.git
+#git+git://github.com/interlegis/trml2pdf.git
+#git+git://github.com/jasperlittle/django-rest-framework-docs
+#git+git://github.com/rubgombar1/django-admin-bootstrapped.git
#django-compressor==2.2
\ No newline at end of file
diff --git a/setup.py b/setup.py
index 3917d49bd..d8fbacbe5 100644
--- a/setup.py
+++ b/setup.py
@@ -29,7 +29,7 @@ install_requires = [
'django-image-cropping==1.2.0',
'easy-thumbnails==2.5',
- 'libsass==0.11.1',
+ 'libsass==0.17.0',
'psycopg2==2.7.4',
'python-decouple==3.0',
'pytz==2016.4',
@@ -42,7 +42,7 @@ install_requires = [
'gunicorn==19.6.0',
'WeasyPrint==0.42',
'whoosh==2.7.4',
-
+
'drfdocs',
# 'git+git://github.com/interlegis/trml2pdf.git',
# 'git+git://github.com/jasperlittle/django-rest-framework-docs'
From a0d47f84c052cf602b32ae3d595a982d3a4ad6a6 Mon Sep 17 00:00:00 2001
From: Leandro Roberto
Date: Mon, 7 Jan 2019 10:43:31 -0200
Subject: [PATCH 17/35] bump python-decouple
---
requirements/requirements.txt | 2 +-
setup.py | 4 ++--
2 files changed, 3 insertions(+), 3 deletions(-)
diff --git a/requirements/requirements.txt b/requirements/requirements.txt
index 5e5425ebe..584b51380 100644
--- a/requirements/requirements.txt
+++ b/requirements/requirements.txt
@@ -18,9 +18,9 @@ django-extensions==2.1.4
django-image-cropping==1.2
easy-thumbnails==2.5
libsass==0.17.0
+python-decouple==3.1
psycopg2-binary==2.7.4
-python-decouple==3.0
pytz==2016.4
pyyaml==4.2b1
rtyaml==0.0.3
diff --git a/setup.py b/setup.py
index d8fbacbe5..80379f086 100644
--- a/setup.py
+++ b/setup.py
@@ -28,10 +28,10 @@ install_requires = [
'django-extensions==2.1.4',
'django-image-cropping==1.2.0',
'easy-thumbnails==2.5',
-
'libsass==0.17.0',
+ 'python-decouple==3.1',
+
'psycopg2==2.7.4',
- 'python-decouple==3.0',
'pytz==2016.4',
'pyyaml==4.2b1',
'rtyaml==0.0.3',
From 5ef0e0421b6a8d62d78f06b105e50a9a8eab039b Mon Sep 17 00:00:00 2001
From: Leandro Roberto
Date: Mon, 7 Jan 2019 10:46:34 -0200
Subject: [PATCH 18/35] bump psycopg2-binary
---
requirements/requirements.txt | 2 +-
setup.py | 4 ++--
2 files changed, 3 insertions(+), 3 deletions(-)
diff --git a/requirements/requirements.txt b/requirements/requirements.txt
index 584b51380..44e37516e 100644
--- a/requirements/requirements.txt
+++ b/requirements/requirements.txt
@@ -19,8 +19,8 @@ django-image-cropping==1.2
easy-thumbnails==2.5
libsass==0.17.0
python-decouple==3.1
+psycopg2-binary==2.7.6.1
-psycopg2-binary==2.7.4
pytz==2016.4
pyyaml==4.2b1
rtyaml==0.0.3
diff --git a/setup.py b/setup.py
index 80379f086..b48c420ee 100644
--- a/setup.py
+++ b/setup.py
@@ -30,10 +30,10 @@ install_requires = [
'easy-thumbnails==2.5',
'libsass==0.17.0',
'python-decouple==3.1',
+ 'psycopg2-binary==2.7.6.1',
+ 'pyyaml==4.2b1',
- 'psycopg2==2.7.4',
'pytz==2016.4',
- 'pyyaml==4.2b1',
'rtyaml==0.0.3',
'textract==1.5.0',
'unipath==1.1',
From 0e1ed356c47e9031cc3cb00f3ab67c5373c26c1f Mon Sep 17 00:00:00 2001
From: Leandro Roberto
Date: Mon, 7 Jan 2019 10:53:26 -0200
Subject: [PATCH 19/35] bump pytz
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
pytz é uma biblioteca que necessita ser atualizada com mais
frequencia... ela traz informações e registra as mudanças de horários de
verão, fato comum no Brasil.
---
requirements/requirements.txt | 4 ++--
setup.py | 2 +-
2 files changed, 3 insertions(+), 3 deletions(-)
diff --git a/requirements/requirements.txt b/requirements/requirements.txt
index 44e37516e..8f0e1c523 100644
--- a/requirements/requirements.txt
+++ b/requirements/requirements.txt
@@ -20,9 +20,9 @@ easy-thumbnails==2.5
libsass==0.17.0
python-decouple==3.1
psycopg2-binary==2.7.6.1
-
-pytz==2016.4
pyyaml==4.2b1
+pytz==2018.9
+
rtyaml==0.0.3
textract==1.5.0
unipath==1.1
diff --git a/setup.py b/setup.py
index b48c420ee..6b720f173 100644
--- a/setup.py
+++ b/setup.py
@@ -32,8 +32,8 @@ install_requires = [
'python-decouple==3.1',
'psycopg2-binary==2.7.6.1',
'pyyaml==4.2b1',
+ 'pytz==2018.9',
- 'pytz==2016.4',
'rtyaml==0.0.3',
'textract==1.5.0',
'unipath==1.1',
From 09fc9942c8a428836230e96f29002ec4cf4f3395 Mon Sep 17 00:00:00 2001
From: Leandro Roberto
Date: Mon, 7 Jan 2019 17:09:31 -0200
Subject: [PATCH 20/35] bump rtyaml
---
requirements/requirements.txt | 8 ++++----
setup.py | 2 +-
2 files changed, 5 insertions(+), 5 deletions(-)
diff --git a/requirements/requirements.txt b/requirements/requirements.txt
index 8f0e1c523..7c40f527d 100644
--- a/requirements/requirements.txt
+++ b/requirements/requirements.txt
@@ -22,8 +22,8 @@ python-decouple==3.1
psycopg2-binary==2.7.6.1
pyyaml==4.2b1
pytz==2018.9
+rtyaml==0.0.5
-rtyaml==0.0.3
textract==1.5.0
unipath==1.1
pysolr==3.6.0
@@ -32,8 +32,8 @@ gunicorn==19.6.0
WeasyPrint==0.42
whoosh==2.7.4
-#git+git://github.com/interlegis/trml2pdf.git
-#git+git://github.com/jasperlittle/django-rest-framework-docs
-#git+git://github.com/rubgombar1/django-admin-bootstrapped.git
+git+git://github.com/interlegis/trml2pdf.git
+git+git://github.com/jasperlittle/django-rest-framework-docs
+git+git://github.com/rubgombar1/django-admin-bootstrapped.git
#django-compressor==2.2
\ No newline at end of file
diff --git a/setup.py b/setup.py
index 6b720f173..e89b7e402 100644
--- a/setup.py
+++ b/setup.py
@@ -33,8 +33,8 @@ install_requires = [
'psycopg2-binary==2.7.6.1',
'pyyaml==4.2b1',
'pytz==2018.9',
+ 'rtyaml==0.0.5',
- 'rtyaml==0.0.3',
'textract==1.5.0',
'unipath==1.1',
'pysolr==3.6.0',
From a4297969901c78aef7480c870b1df85a5a1813c0 Mon Sep 17 00:00:00 2001
From: Leandro Roberto
Date: Mon, 7 Jan 2019 17:25:08 -0200
Subject: [PATCH 21/35] bump WeasyPrint
---
requirements/requirements.txt | 6 +++---
setup.py | 2 +-
2 files changed, 4 insertions(+), 4 deletions(-)
diff --git a/requirements/requirements.txt b/requirements/requirements.txt
index 7c40f527d..0ef545cc5 100644
--- a/requirements/requirements.txt
+++ b/requirements/requirements.txt
@@ -23,13 +23,13 @@ psycopg2-binary==2.7.6.1
pyyaml==4.2b1
pytz==2018.9
rtyaml==0.0.5
+python-magic==0.4.15
+unipath==1.1
+WeasyPrint==44
textract==1.5.0
-unipath==1.1
pysolr==3.6.0
-python-magic==0.4.12
gunicorn==19.6.0
-WeasyPrint==0.42
whoosh==2.7.4
git+git://github.com/interlegis/trml2pdf.git
diff --git a/setup.py b/setup.py
index e89b7e402..370a8f3ca 100644
--- a/setup.py
+++ b/setup.py
@@ -34,13 +34,13 @@ install_requires = [
'pyyaml==4.2b1',
'pytz==2018.9',
'rtyaml==0.0.5',
+ 'WeasyPrint==44',
'textract==1.5.0',
'unipath==1.1',
'pysolr==3.6.0',
'python-magic==0.4.12',
'gunicorn==19.6.0',
- 'WeasyPrint==0.42',
'whoosh==2.7.4',
'drfdocs',
From 284c4662b4adb8b30d0b192072dc238ef8f64712 Mon Sep 17 00:00:00 2001
From: Leandro Roberto
Date: Mon, 7 Jan 2019 17:26:39 -0200
Subject: [PATCH 22/35] bump gunicorn
---
requirements/requirements.txt | 2 +-
setup.py | 7 +++----
2 files changed, 4 insertions(+), 5 deletions(-)
diff --git a/requirements/requirements.txt b/requirements/requirements.txt
index 0ef545cc5..bcc15f37b 100644
--- a/requirements/requirements.txt
+++ b/requirements/requirements.txt
@@ -26,10 +26,10 @@ rtyaml==0.0.5
python-magic==0.4.15
unipath==1.1
WeasyPrint==44
+gunicorn==19.9.0
textract==1.5.0
pysolr==3.6.0
-gunicorn==19.6.0
whoosh==2.7.4
git+git://github.com/interlegis/trml2pdf.git
diff --git a/setup.py b/setup.py
index 370a8f3ca..7b750d91a 100644
--- a/setup.py
+++ b/setup.py
@@ -34,16 +34,15 @@ install_requires = [
'pyyaml==4.2b1',
'pytz==2018.9',
'rtyaml==0.0.5',
+ 'python-magic==0.4.15',
+ 'unipath==1.1',
'WeasyPrint==44',
+ 'gunicorn==19.9.0',
'textract==1.5.0',
- 'unipath==1.1',
'pysolr==3.6.0',
- 'python-magic==0.4.12',
- 'gunicorn==19.6.0',
'whoosh==2.7.4',
- 'drfdocs',
# 'git+git://github.com/interlegis/trml2pdf.git',
# 'git+git://github.com/jasperlittle/django-rest-framework-docs'
# 'git+git://github.com/rubgombar1/django-admin-bootstrapped.git''
From ac91543b0fd0a32f3f30ec881e9052d1ce9cfa58 Mon Sep 17 00:00:00 2001
From: Leandro Roberto da Silva
Date: Thu, 10 Jan 2019 20:45:58 -0200
Subject: [PATCH 23/35] Fix #2337 (#2448)
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
* impl data e hora manual no protocolo de matérias
* impl data e hora manual no protocolo de documentos
* ajustes de teste em protocoloadm
---
sapl/protocoloadm/forms.py | 155 +++++++++++++-----
.../migrations/0014_auto_20190110_1300.py | 35 ++++
...15_protocolo_timestamp_data_hora_manual.py | 21 +++
.../migrations/0016_auto_20190110_1345.py | 21 +++
sapl/protocoloadm/models.py | 24 ++-
sapl/protocoloadm/tests/test_protocoloadm.py | 23 ++-
sapl/protocoloadm/views.py | 41 ++++-
sapl/relatorios/views.py | 35 ++--
sapl/static/js/app.js | 1 +
sapl/templates/protocoloadm/comprovante.html | 6 +-
.../protocoloadm/protocolar_documento.html | 14 ++
.../protocoloadm/protocolar_materia.html | 62 ++++---
.../protocoloadm/protocolo_mostrar.html | 10 +-
sapl/utils.py | 18 ++
14 files changed, 369 insertions(+), 97 deletions(-)
create mode 100644 sapl/protocoloadm/migrations/0014_auto_20190110_1300.py
create mode 100644 sapl/protocoloadm/migrations/0015_protocolo_timestamp_data_hora_manual.py
create mode 100644 sapl/protocoloadm/migrations/0016_auto_20190110_1345.py
diff --git a/sapl/protocoloadm/forms.py b/sapl/protocoloadm/forms.py
index d0c812958..8f476d443 100644
--- a/sapl/protocoloadm/forms.py
+++ b/sapl/protocoloadm/forms.py
@@ -1,9 +1,9 @@
import logging
-from crispy_forms.bootstrap import InlineRadios
+from crispy_forms.bootstrap import InlineRadios, Alert
from crispy_forms.helper import FormHelper
-from crispy_forms.layout import HTML, Button, Column, Fieldset, Layout
+from crispy_forms.layout import HTML, Button, Column, Fieldset, Layout, Div
from django import forms
from django.core.exceptions import (MultipleObjectsReturned,
ObjectDoesNotExist, ValidationError)
@@ -18,11 +18,12 @@ from sapl.base.models import Autor, TipoAutor
from sapl.crispy_layout_mixin import SaplFormLayout, form_actions, to_row
from sapl.materia.models import (MateriaLegislativa, TipoMateriaLegislativa,
UnidadeTramitacao)
+from sapl.protocoloadm.models import Protocolo
from sapl.utils import (RANGE_ANOS, YES_NO_CHOICES, AnoNumeroOrderingFilter,
RangeWidgetOverride, autor_label, autor_modal,
choice_anos_com_protocolo, choice_force_optional,
choice_anos_com_documentoadministrativo,
- FilterOverridesMetaMixin)
+ FilterOverridesMetaMixin, choice_anos_com_materias)
from .models import (AcompanhamentoDocumento, DocumentoAcessorioAdministrativo,
DocumentoAdministrativo,
@@ -344,6 +345,12 @@ class ProtocoloDocumentForm(ModelForm):
numero = forms.IntegerField(
required=False, label=_('Número de Protocolo (opcional)'))
+ data_hora_manual = forms.ChoiceField(
+ label=_('Informar data e hora manualmente?'),
+ widget=forms.RadioSelect(),
+ choices=YES_NO_CHOICES,
+ initial=False)
+
class Meta:
model = Protocolo
fields = ['tipo_protocolo',
@@ -352,7 +359,9 @@ class ProtocoloDocumentForm(ModelForm):
'assunto',
'interessado',
'observacao',
- 'numero'
+ 'numero',
+ 'data',
+ 'hora',
]
def __init__(self, *args, **kwargs):
@@ -360,30 +369,56 @@ class ProtocoloDocumentForm(ModelForm):
row1 = to_row(
[(InlineRadios('tipo_protocolo'), 12)])
row2 = to_row(
- [('tipo_documento', 6),
- ('numero_paginas', 6)])
- row3 = to_row(
- [('assunto', 12)])
+ [('tipo_documento', 5),
+ ('numero_paginas', 2),
+ (Div(), 1),
+ (InlineRadios('data_hora_manual'), 4),
+ ])
+ row3 = to_row([
+ (Div(), 2),
+ (Alert(
+ """
+ Usuário: {} - {}
+ IP: {} - {}
+
+ """.format(
+ kwargs['initial']['user_data_hora_manual'],
+ Protocolo._meta.get_field(
+ 'user_data_hora_manual').help_text,
+ kwargs['initial']['ip_data_hora_manual'],
+ Protocolo._meta.get_field(
+ 'ip_data_hora_manual').help_text,
+
+ ),
+ dismiss=False,
+ css_class='alert-info'), 6),
+ ('data', 2),
+ ('hora', 2),
+ ])
row4 = to_row(
- [('interessado', 12)])
+ [('assunto', 12)])
row5 = to_row(
- [('observacao', 12)])
+ [('interessado', 12)])
row6 = to_row(
+ [('observacao', 12)])
+ row7 = to_row(
[('numero', 12)])
self.helper = FormHelper()
self.helper.layout = Layout(
Fieldset(_('Identificação de Documento'),
row1,
- row2,
+ row2),
+ Fieldset(_('Protocolo com data e hora informados manualmente'),
row3,
- row4,
- row5,
- HTML(" "),
- ),
+ css_id='protocolo_data_hora_manual',
+ css_class='hidden'),
+ row4,
+ row5,
+ HTML(" "),
Fieldset(_('Número do Protocolo (Apenas se quiser que a numeração comece '
'a partir do número a ser informado)'),
- row6,
+ row7,
HTML(" "),
form_actions(label=_('Protocolar Documento'))
)
@@ -419,10 +454,11 @@ class ProtocoloMateriaForm(ModelForm):
ano_materia = forms.CharField(
label=_('Ano matéria'), required=False)
- vincular_materia = forms.ChoiceField(label=_('Vincular a matéria existente?'),
- widget=forms.RadioSelect(),
- choices=YES_NO_CHOICES,
- initial=False)
+ vincular_materia = forms.ChoiceField(
+ label=_('Vincular a matéria existente?'),
+ widget=forms.RadioSelect(),
+ choices=YES_NO_CHOICES,
+ initial=False)
numero_paginas = forms.CharField(label=_('Núm. Páginas'), required=True)
@@ -435,6 +471,12 @@ class ProtocoloMateriaForm(ModelForm):
numero = forms.IntegerField(
required=False, label=_('Número de Protocolo (opcional)'))
+ data_hora_manual = forms.ChoiceField(
+ label=_('Informar data e hora manualmente?'),
+ widget=forms.RadioSelect(),
+ choices=YES_NO_CHOICES,
+ initial=False)
+
class Meta:
model = Protocolo
fields = ['tipo_materia',
@@ -446,7 +488,9 @@ class ProtocoloMateriaForm(ModelForm):
'numero_materia',
'ano_materia',
'vincular_materia',
- 'numero'
+ 'numero',
+ 'data',
+ 'hora',
]
def clean_autor(self):
@@ -506,28 +550,55 @@ class ProtocoloMateriaForm(ModelForm):
('tipo_autor', 3),
('autor', 3)])
row2 = to_row(
- [(InlineRadios('vincular_materia'), 4),
- ('numero_materia', 4),
- ('ano_materia', 4), ])
- row3 = to_row(
- [('assunto_ementa', 12)])
+ [(InlineRadios('vincular_materia'), 3),
+ ('numero_materia', 2),
+ ('ano_materia', 2),
+ (Div(), 1),
+ (InlineRadios('data_hora_manual'), 4),
+ ])
+ row3 = to_row([
+ (Div(), 2),
+ (Alert(
+ """
+ Usuário: {} - {}
+ IP: {} - {}
+
+ """.format(
+ kwargs['initial']['user_data_hora_manual'],
+ Protocolo._meta.get_field(
+ 'user_data_hora_manual').help_text,
+ kwargs['initial']['ip_data_hora_manual'],
+ Protocolo._meta.get_field(
+ 'ip_data_hora_manual').help_text,
+
+ ),
+ dismiss=False,
+ css_class='alert-info'), 6),
+ ('data', 2),
+ ('hora', 2),
+ ])
row4 = to_row(
- [('observacao', 12)])
+ [('assunto_ementa', 12)])
row5 = to_row(
+ [('observacao', 12)])
+ row6 = to_row(
[('numero', 12)])
self.helper = FormHelper()
self.helper.layout = Layout(
Fieldset(_('Identificação da Matéria'),
row1,
- row2,
+ row2),
+ Fieldset(_('Protocolo com data e hora informados manualmente'),
row3,
- row4,
- HTML(" "),
- ),
+ css_id='protocolo_data_hora_manual',
+ css_class='hidden'),
+ row4,
+ row5,
+ HTML(" "),
Fieldset(_('Número do Protocolo (Apenas se quiser que a numeração comece'
' a partir do número a ser informado)'),
- row5,
+ row6,
HTML(" "),
form_actions(label=_('Protocolar Matéria')))
)
@@ -855,15 +926,15 @@ class DesvincularDocumentoForm(ModelForm):
logger = logging.getLogger(__name__)
- numero = forms.CharField(required=True,
- label=DocumentoAdministrativo._meta.
- get_field('numero').verbose_name
- )
- ano = forms.ChoiceField(required=True,
- label=DocumentoAdministrativo._meta.
- get_field('ano').verbose_name,
- choices=RANGE_ANOS,
- widget=forms.Select(attrs={'class': 'selector'}))
+ numero = forms.CharField(
+ required=True,
+ label=DocumentoAdministrativo._meta.get_field('numero').verbose_name)
+
+ ano = forms.ChoiceField(
+ required=True,
+ label=DocumentoAdministrativo._meta.get_field('ano').verbose_name,
+ choices=choice_anos_com_documentoadministrativo,
+ widget=forms.Select(attrs={'class': 'selector'}))
def clean(self):
super(DesvincularDocumentoForm, self).clean()
@@ -929,7 +1000,7 @@ class DesvincularMateriaForm(forms.Form):
label=_('Número da Matéria'))
ano = forms.ChoiceField(required=True,
label=_('Ano da Matéria'),
- choices=RANGE_ANOS,
+ choices=choice_anos_com_materias,
widget=forms.Select(attrs={'class': 'selector'}))
tipo = forms.ModelChoiceField(label=_('Tipo de Matéria'),
required=True,
diff --git a/sapl/protocoloadm/migrations/0014_auto_20190110_1300.py b/sapl/protocoloadm/migrations/0014_auto_20190110_1300.py
new file mode 100644
index 000000000..56cdf8d36
--- /dev/null
+++ b/sapl/protocoloadm/migrations/0014_auto_20190110_1300.py
@@ -0,0 +1,35 @@
+# -*- coding: utf-8 -*-
+# Generated by Django 1.10.8 on 2019-01-10 15:00
+from __future__ import unicode_literals
+
+from django.db import migrations, models
+
+
+class Migration(migrations.Migration):
+
+ dependencies = [
+ ('protocoloadm', '0013_auto_20190106_1336'),
+ ]
+
+ operations = [
+ migrations.AddField(
+ model_name='protocolo',
+ name='ip_data_hora_manual',
+ field=models.CharField(blank=True, help_text='Endereço IP da estação de trabalho do usuário que está realizando Protocolo e informando data e hora manualmente.', max_length=15, verbose_name='IP'),
+ ),
+ migrations.AddField(
+ model_name='protocolo',
+ name='user_data_hora_manual',
+ field=models.CharField(blank=True, help_text='Usuário que está realizando Protocolo e informando data e hora manualmente.', max_length=20, verbose_name='IP'),
+ ),
+ migrations.AlterField(
+ model_name='protocolo',
+ name='data',
+ field=models.DateField(blank=True, help_text='Informado manualmente', null=True, verbose_name='Data do Protocolo'),
+ ),
+ migrations.AlterField(
+ model_name='protocolo',
+ name='hora',
+ field=models.TimeField(blank=True, help_text='Informado manualmente', null=True, verbose_name='Hora do Protocolo'),
+ ),
+ ]
diff --git a/sapl/protocoloadm/migrations/0015_protocolo_timestamp_data_hora_manual.py b/sapl/protocoloadm/migrations/0015_protocolo_timestamp_data_hora_manual.py
new file mode 100644
index 000000000..85554edad
--- /dev/null
+++ b/sapl/protocoloadm/migrations/0015_protocolo_timestamp_data_hora_manual.py
@@ -0,0 +1,21 @@
+# -*- coding: utf-8 -*-
+# Generated by Django 1.10.8 on 2019-01-10 15:43
+from __future__ import unicode_literals
+
+from django.db import migrations, models
+import django.utils.timezone
+
+
+class Migration(migrations.Migration):
+
+ dependencies = [
+ ('protocoloadm', '0014_auto_20190110_1300'),
+ ]
+
+ operations = [
+ migrations.AddField(
+ model_name='protocolo',
+ name='timestamp_data_hora_manual',
+ field=models.DateTimeField(default=django.utils.timezone.now),
+ ),
+ ]
diff --git a/sapl/protocoloadm/migrations/0016_auto_20190110_1345.py b/sapl/protocoloadm/migrations/0016_auto_20190110_1345.py
new file mode 100644
index 000000000..71f2b7f7a
--- /dev/null
+++ b/sapl/protocoloadm/migrations/0016_auto_20190110_1345.py
@@ -0,0 +1,21 @@
+# -*- coding: utf-8 -*-
+# Generated by Django 1.10.8 on 2019-01-10 15:45
+from __future__ import unicode_literals
+
+from django.db import migrations, models
+import django.utils.timezone
+
+
+class Migration(migrations.Migration):
+
+ dependencies = [
+ ('protocoloadm', '0015_protocolo_timestamp_data_hora_manual'),
+ ]
+
+ operations = [
+ migrations.AlterField(
+ model_name='protocolo',
+ name='timestamp',
+ field=models.DateTimeField(blank=True, default=django.utils.timezone.now, null=True),
+ ),
+ ]
diff --git a/sapl/protocoloadm/models.py b/sapl/protocoloadm/models.py
index 6d3d90671..e335a5db1 100644
--- a/sapl/protocoloadm/models.py
+++ b/sapl/protocoloadm/models.py
@@ -57,13 +57,29 @@ class Protocolo(models.Model):
choices=RANGE_ANOS,
verbose_name=_('Ano do Protocolo'))
- # FIXME: https://github.com/interlegis/sapl/issues/2337
- data = models.DateField(null=True, blank=True)
- hora = models.TimeField(null=True, blank=True)
+ data = models.DateField(null=True, blank=True,
+ verbose_name=_('Data do Protocolo'),
+ help_text=_('Informado manualmente'))
+ hora = models.TimeField(null=True, blank=True,
+ verbose_name=_('Hora do Protocolo'),
+ help_text=_('Informado manualmente'))
+ timestamp_data_hora_manual = models.DateTimeField(default=timezone.now)
+ user_data_hora_manual = models.CharField(
+ max_length=20, blank=True,
+ verbose_name=_('IP'),
+ help_text=_('Usuário que está realizando Protocolo e informando '
+ 'data e hora manualmente.'))
+ ip_data_hora_manual = models.CharField(
+ max_length=15, blank=True,
+ verbose_name=_('IP'),
+ help_text=_('Endereço IP da estação de trabalho '
+ 'do usuário que está realizando Protocolo e informando '
+ 'data e hora manualmente.'))
# Não foi utilizado auto_now_add=True em timestamp porque
# ele usa datetime.now que não é timezone aware.
- timestamp = models.DateTimeField(default=timezone.now)
+ timestamp = models.DateTimeField(
+ default=timezone.now, null=True, blank=True)
tipo_protocolo = models.PositiveIntegerField(
blank=True, null=True, verbose_name=_('Tipo de Protocolo'))
tipo_processo = models.PositiveIntegerField()
diff --git a/sapl/protocoloadm/tests/test_protocoloadm.py b/sapl/protocoloadm/tests/test_protocoloadm.py
index 2a4c9f53c..c7e4bc341 100644
--- a/sapl/protocoloadm/tests/test_protocoloadm.py
+++ b/sapl/protocoloadm/tests/test_protocoloadm.py
@@ -1,4 +1,4 @@
-from datetime import date, timedelta
+from datetime import date, timedelta, datetime
from django.core.urlresolvers import reverse
from django.utils import timezone
@@ -392,29 +392,42 @@ def test_documento_administrativo_protocolo_inexistente():
def test_protocolo_documento_form_invalido():
- form = ProtocoloDocumentForm(data={})
+ form = ProtocoloDocumentForm(
+ data={},
+ initial={
+ 'user_data_hora_manual': '',
+ 'ip_data_hora_manual': '',
+ 'data': timezone.localdate(timezone.now()),
+ 'hora': timezone.localtime(timezone.now())})
assert not form.is_valid()
errors = form.errors
+ assert errors['data_hora_manual'] == [_('Este campo é obrigatório.')]
assert errors['tipo_protocolo'] == [_('Este campo é obrigatório.')]
assert errors['interessado'] == [_('Este campo é obrigatório.')]
assert errors['tipo_documento'] == [_('Este campo é obrigatório.')]
assert errors['numero_paginas'] == [_('Este campo é obrigatório.')]
assert errors['assunto'] == [_('Este campo é obrigatório.')]
- assert len(errors) == 5
+ assert len(errors) == 6
def test_protocolo_materia_invalido():
- form = ProtocoloMateriaForm(data={})
+ form = ProtocoloMateriaForm(data={},
+ initial={
+ 'user_data_hora_manual': '',
+ 'ip_data_hora_manual': '',
+ 'data': timezone.localdate(timezone.now()),
+ 'hora': timezone.localtime(timezone.now())})
assert not form.is_valid()
errors = form.errors
+ assert errors['data_hora_manual'] == [_('Este campo é obrigatório.')]
assert errors['assunto_ementa'] == [_('Este campo é obrigatório.')]
assert errors['tipo_autor'] == [_('Este campo é obrigatório.')]
assert errors['tipo_materia'] == [_('Este campo é obrigatório.')]
@@ -422,4 +435,4 @@ def test_protocolo_materia_invalido():
assert errors['autor'] == [_('Este campo é obrigatório.')]
assert errors['vincular_materia'] == [_('Este campo é obrigatório.')]
- assert len(errors) == 6
+ assert len(errors) == 7
diff --git a/sapl/protocoloadm/views.py b/sapl/protocoloadm/views.py
index 8dd7e9e47..f91ee5227 100755
--- a/sapl/protocoloadm/views.py
+++ b/sapl/protocoloadm/views.py
@@ -492,6 +492,15 @@ class ProtocoloDocumentoView(PermissionRequiredMixin,
return reverse('sapl.protocoloadm:protocolo_mostrar',
kwargs={'pk': self.object.id})
+ def get_initial(self):
+ initial = super().get_initial()
+
+ initial['user_data_hora_manual'] = self.request.user.username
+ initial['ip_data_hora_manual'] = get_client_ip(self.request)
+ initial['data'] = timezone.localdate(timezone.now())
+ initial['hora'] = timezone.localtime(timezone.now())
+ return initial
+
def form_valid(self, form):
protocolo = form.save(commit=False)
username = self.request.user.username
@@ -538,6 +547,17 @@ class ProtocoloDocumentoView(PermissionRequiredMixin,
return self.render_to_response(self.get_context_data())
protocolo.ano = timezone.now().year
protocolo.assunto_ementa = self.request.POST['assunto']
+
+ if form.cleaned_data['data_hora_manual'] == 'True':
+ protocolo.timestamp = None
+ protocolo.user_data_hora_manual = username
+ protocolo.ip_data_hora_manual = get_client_ip(self.request)
+ else:
+ protocolo.data = None
+ protocolo.hora = None
+ protocolo.user_data_hora_manual = ''
+ protocolo.ip_data_hora_manual = ''
+
protocolo.save()
self.object = protocolo
return redirect(self.get_success_url())
@@ -659,6 +679,15 @@ class ProtocoloMateriaView(PermissionRequiredMixin, CreateView):
return reverse('sapl.protocoloadm:materia_continuar', kwargs={
'pk': protocolo.pk})
+ def get_initial(self):
+ initial = super().get_initial()
+
+ initial['user_data_hora_manual'] = self.request.user.username
+ initial['ip_data_hora_manual'] = get_client_ip(self.request)
+ initial['data'] = timezone.localdate(timezone.now())
+ initial['hora'] = timezone.localtime(timezone.now())
+ return initial
+
def form_valid(self, form):
protocolo = form.save(commit=False)
username = self.request.user.username
@@ -719,6 +748,16 @@ class ProtocoloMateriaView(PermissionRequiredMixin, CreateView):
protocolo.observacao = self.request.POST['observacao']
protocolo.assunto_ementa = self.request.POST['assunto_ementa']
+ if form.cleaned_data['data_hora_manual'] == 'True':
+ protocolo.timestamp = None
+ protocolo.user_data_hora_manual = username
+ protocolo.ip_data_hora_manual = get_client_ip(self.request)
+ else:
+ protocolo.data = None
+ protocolo.hora = None
+ protocolo.user_data_hora_manual = ''
+ protocolo.ip_data_hora_manual = ''
+
protocolo.save()
data = form.cleaned_data
if data['vincular_materia'] == 'True':
@@ -1168,4 +1207,4 @@ class FichaSelecionaAdmView(PermissionRequiredMixin, FormView):
context['documento'] = documento
return gerar_pdf_impressos(self.request, context,
- 'materia/impressos/ficha_adm_pdf.html')
\ No newline at end of file
+ 'materia/impressos/ficha_adm_pdf.html')
diff --git a/sapl/relatorios/views.py b/sapl/relatorios/views.py
index 0c5dfd377..f4bc8cda2 100755
--- a/sapl/relatorios/views.py
+++ b/sapl/relatorios/views.py
@@ -1,7 +1,7 @@
+from datetime import datetime as dt
import html
-import re
import logging
-from datetime import datetime as dt
+import re
from django.core.exceptions import ObjectDoesNotExist
from django.http import Http404, HttpResponse
@@ -581,7 +581,6 @@ def get_sessao_plenaria(sessao, casa):
if dic_expedientes:
lst_expedientes.append(dic_expedientes)
-
# Lista das matérias do Expediente, incluindo o resultado das votacoes
lst_expediente_materia = []
for expediente_materia in ExpedienteMateria.objects.filter(
@@ -612,7 +611,8 @@ def get_sessao_plenaria(sessao, casa):
dic_expediente_materia["nom_autor"] = ''
autoria = materia.autoria_set.all()
- dic_expediente_materia['num_autores'] = 'Autores' if len(autoria) > 1 else 'Autor'
+ dic_expediente_materia['num_autores'] = 'Autores' if len(
+ autoria) > 1 else 'Autor'
if autoria:
for a in autoria:
if a.autor.nome:
@@ -687,7 +687,7 @@ def get_sessao_plenaria(sessao, casa):
numeracao = materia.numeracao_set.first()
if numeracao:
-
+
dic_votacao["des_numeracao"] = (
str(numeracao.numero_materia) +
'/' +
@@ -762,7 +762,6 @@ def get_sessao_plenaria(sessao, casa):
lst_ocorrencias.append(o)
-
return (inf_basicas_dic,
lst_mesa,
lst_presenca_sessao,
@@ -810,10 +809,12 @@ def relatorio_sessao_plenaria(request, pk):
imagem = get_imagem(casa)
try:
- logger.debug("user=" + username + ". Tentando obter SessaoPlenaria com id={}.".format(pk))
+ logger.debug("user=" + username +
+ ". Tentando obter SessaoPlenaria com id={}.".format(pk))
sessao = SessaoPlenaria.objects.get(id=pk)
except ObjectDoesNotExist as e:
- logger.error("user=" + username + ". Essa SessaoPlenaria não existe (pk={}). ".format(pk) + str(e))
+ logger.error("user=" + username +
+ ". Essa SessaoPlenaria não existe (pk={}). ".format(pk) + str(e))
raise Http404('Essa página não existe')
(inf_basicas_dic,
@@ -828,11 +829,10 @@ def relatorio_sessao_plenaria(request, pk):
lst_oradores,
lst_ocorrencias) = get_sessao_plenaria(sessao, casa)
-
for idx in range(len(lst_expedientes)):
txt_expedientes = lst_expedientes[idx]['txt_expediente']
txt_expedientes = TrocaTag(txt_expedientes, '', 6, 6,
- 'expedientes', '')
lst_expedientes[idx]['txt_expediente'] = txt_expedientes
pdf = pdf_sessao_plenaria_gerar.principal(
@@ -868,7 +868,7 @@ def get_protocolos(prots):
ts.strftime("%H:%m")
else:
dic['data'] = protocolo.data.strftime("%d/%m/%Y") + ' - Horário:' \
- + protocolo.hora.strftime("%H:%m")
+ + protocolo.hora.strftime("%H:%m")
dic['txt_assunto'] = protocolo.assunto_ementa
@@ -979,8 +979,8 @@ def get_etiqueta_protocolos(prots):
dic['titulo'] = str(p.numero) + '/' + str(p.ano)
- tz_hora = timezone.localtime(p.timestamp)
if p.timestamp:
+ tz_hora = timezone.localtime(p.timestamp)
dic['data'] = 'Data: ' + tz_hora.strftime(
"%d/%m/%Y") + ' - Horário: ' + tz_hora.strftime("%H:%M")
else:
@@ -1072,7 +1072,8 @@ def get_pauta_sessao(sessao, casa):
id=expediente_materia.materia.id).first()
dic_expediente_materia = {}
- dic_expediente_materia["tipo_materia"] = materia.tipo.sigla + ' - ' + materia.tipo.descricao
+ dic_expediente_materia["tipo_materia"] = materia.tipo.sigla + \
+ ' - ' + materia.tipo.descricao
dic_expediente_materia["num_ordem"] = str(
expediente_materia.numero_ordem)
dic_expediente_materia["id_materia"] = str(
@@ -1090,7 +1091,8 @@ def get_pauta_sessao(sessao, casa):
dic_expediente_materia["nom_autor"] = ''
autoria = materia.autoria_set.all()
- dic_expediente_materia['num_autores'] = 'Autores' if len(autoria) > 1 else 'Autor'
+ dic_expediente_materia['num_autores'] = 'Autores' if len(
+ autoria) > 1 else 'Autor'
if autoria:
for a in autoria:
if a.autor.nome:
@@ -1112,7 +1114,8 @@ def get_pauta_sessao(sessao, casa):
materia = MateriaLegislativa.objects.filter(
id=votacao.materia.id).first()
dic_votacao = {}
- dic_votacao["tipo_materia"] = materia.tipo.sigla + ' - ' + materia.tipo.descricao
+ dic_votacao["tipo_materia"] = materia.tipo.sigla + \
+ ' - ' + materia.tipo.descricao
dic_votacao["num_ordem"] = votacao.numero_ordem
dic_votacao["id_materia"] = str(
materia.numero) + "/" + str(materia.ano)
@@ -1124,7 +1127,7 @@ def get_pauta_sessao(sessao, casa):
numeracao = Numeracao.objects.filter(materia=votacao.materia).first()
if numeracao:
dic_votacao["des_numeracao"] = str(
- numeracao.numero_materia) + '/' + str(numeracao.ano_materia)
+ numeracao.numero_materia) + '/' + str(numeracao.ano_materia)
turno, tramitacao = get_turno(materia)
dic_votacao["des_turno"] = turno
diff --git a/sapl/static/js/app.js b/sapl/static/js/app.js
index 48777c0e3..d3616a8b5 100644
--- a/sapl/static/js/app.js
+++ b/sapl/static/js/app.js
@@ -47,6 +47,7 @@ function refreshMask() {
$('.dateinput').mask('00/00/0000', {placeholder:"__/__/____"});
$('.hora').mask("00:00", {placeholder:"hh:mm"});
$('.hora_hms').mask("00:00:00", {placeholder:"hh:mm:ss"});
+ $('.timeinput').mask("00:00:00", {placeholder:"hh:mm:ss"});
$('.cronometro').mask("00:00:00", {placeholder:"hh:mm:ss"});
}
diff --git a/sapl/templates/protocoloadm/comprovante.html b/sapl/templates/protocoloadm/comprovante.html
index d285b4e4f..23d299ecf 100644
--- a/sapl/templates/protocoloadm/comprovante.html
+++ b/sapl/templates/protocoloadm/comprovante.html
@@ -65,7 +65,11 @@
| Data / Horário |
- {{ protocolo.timestamp|date:"d/m/Y" }} - {{ protocolo.timestamp|date:"H:i:s" }} |
+ {% if protocolo.timestamp %}
+ {{ protocolo.timestamp|date:"d/m/Y" }} - {{ protocolo.timestamp|date:"H:i:s" }} |
+ {% else %}
+ {{ protocolo.data|date:"d/m/Y" }} - {{ protocolo.hora|date:"H:i:s" }} |
+ {% endif %}
{% if protocolo.tipo_processo == 1 %}
diff --git a/sapl/templates/protocoloadm/protocolar_documento.html b/sapl/templates/protocoloadm/protocolar_documento.html
index 5cb1fa789..49cf4933f 100644
--- a/sapl/templates/protocoloadm/protocolar_documento.html
+++ b/sapl/templates/protocoloadm/protocolar_documento.html
@@ -14,3 +14,17 @@
{% block detail_content %}
{% crispy form %}
{% endblock detail_content %}
+
+{% block extra_js %}
+
+{% endblock %}
diff --git a/sapl/templates/protocoloadm/protocolar_materia.html b/sapl/templates/protocoloadm/protocolar_materia.html
index db3785bd6..2dcb8b4f0 100644
--- a/sapl/templates/protocoloadm/protocolar_materia.html
+++ b/sapl/templates/protocoloadm/protocolar_materia.html
@@ -26,35 +26,43 @@
}
$(document).ready(function() {
- function busca_ementa() {
- var vincular_materia = $("#id_vincular_materia_1").prop("checked");
- var ano_materia = $("#id_ano_materia").val();
- var numero_materia = $("#id_numero_materia").val();
- var tipo_materia = $("#id_tipo_materia").val();
- var json_data = {
- ano : ano_materia,
- numero : numero_materia,
- tipo : tipo_materia
- }
- if (vincular_materia === true && ano_materia !== undefined &&
- numero_materia !== undefined && numero_materia !== "") {
- $.getJSON("/protocoloadm/recuperar-materia", json_data, function(data){
- if (data) {
- if (data['error'] === undefined){
- $('#id_assunto_ementa').val(data['ementa']);
- if (data['autor'] !== undefined) {
- $('#id_autor').val(data['autor']);
- $('#id_tipo_autor').val(data['tipo_autor']);
+ $("input[name=data_hora_manual]").change(function(event) {
+ if (this.value === 'True' && this.checked)
+ $("#protocolo_data_hora_manual").removeClass('hidden');
+ else if (this.value === 'False' && this.checked)
+ $("#protocolo_data_hora_manual").addClass('hidden');
+ });
+ $("input[name=data_hora_manual]").trigger('change')
+
+ function busca_ementa() {
+ var vincular_materia = $("#id_vincular_materia_1").prop("checked");
+ var ano_materia = $("#id_ano_materia").val();
+ var numero_materia = $("#id_numero_materia").val();
+ var tipo_materia = $("#id_tipo_materia").val();
+ var json_data = {
+ ano : ano_materia,
+ numero : numero_materia,
+ tipo : tipo_materia
+ }
+ if (vincular_materia === true && ano_materia !== undefined &&
+ numero_materia !== undefined && numero_materia !== "") {
+ $.getJSON("/protocoloadm/recuperar-materia", json_data, function(data){
+ if (data) {
+ if (data['error'] === undefined){
+ $('#id_assunto_ementa').val(data['ementa']);
+ if (data['autor'] !== undefined) {
+ $('#id_autor').val(data['autor']);
+ $('#id_tipo_autor').val(data['tipo_autor']);
- }
- }
- }
- })
- }
+ }
+ }
+ }
+ })
+ }
};
- $("#id_ano_materia").blur(busca_ementa);
- $("#id_numero_materia").blur(busca_ementa);
- $("#id_tipo_materia").change(busca_ementa);
+ $("#id_ano_materia").blur(busca_ementa);
+ $("#id_numero_materia").blur(busca_ementa);
+ $("#id_tipo_materia").change(busca_ementa);
$("#id_tipo_autor").change(function() {
var tipo_selecionado = $("#id_tipo_autor").val();
diff --git a/sapl/templates/protocoloadm/protocolo_mostrar.html b/sapl/templates/protocoloadm/protocolo_mostrar.html
index 2cac987f3..d22464397 100644
--- a/sapl/templates/protocoloadm/protocolo_mostrar.html
+++ b/sapl/templates/protocoloadm/protocolo_mostrar.html
@@ -4,6 +4,14 @@
{% load crispy_forms_tags %}
{% load static %}
+{% block actions %}
+
+ {{ block.super }}
+
+{% endblock %}
+
{% block detail_content %}
Protocolo: {{ protocolo.numero|stringformat:'06d' }}/{{ protocolo.ano }} -
@@ -12,7 +20,7 @@
{% if protocolo.timestamp %}
Data Protocolo: {{ protocolo.timestamp|localtime|date:"d/m/Y"|default_if_none:"Não informado" }} - Horário: {{ protocolo.timestamp|localtime|date:"G:i:s" }}
{% else %}
- Data Protocolo: {{ protocolo.data|date:"d/m/Y"|default_if_none:"Não informado" }} - Horário: {{ protocolo.hora|date:"G:i:s" }}
+ Data Protocolo: {{ protocolo.data|date:"d/m/Y"|default_if_none:"Não informado" }} - Horário: {{ protocolo.hora|date:"G:i:s" }} - {% if not protocolo.timestamp %} Informado Manualmente por: {{protocolo.user_data_hora_manual}}{% endif %}
{% endif %}
{% if protocolo.tipo_processo == 0 %}
diff --git a/sapl/utils.py b/sapl/utils.py
index 706d5cb65..eb26cadb1 100644
--- a/sapl/utils.py
+++ b/sapl/utils.py
@@ -18,6 +18,7 @@ from django.core.exceptions import ValidationError
from django.core.mail import get_connection
from django.db import models
from django.db.models import Q
+from django.forms.widgets import SplitDateTimeWidget
from django.utils import six, timezone
from django.utils.translation import ugettext_lazy as _
import django_filters
@@ -234,6 +235,23 @@ class RangeWidgetOverride(forms.MultiWidget):
return '%s ' % html
+class CustomSplitDateTimeWidget(SplitDateTimeWidget):
+ def render(self, name, value, attrs=None, renderer=None):
+ rendered_widgets = []
+ for i, x in enumerate(self.widgets):
+ x.attrs['class'] += ' form-control'
+ rendered_widgets.append(
+ x.render(
+ '%s_%d' % (name, i), self.decompress(
+ value)[i] if value else ''
+ )
+ )
+
+ html = '%s %s '\
+ % tuple(rendered_widgets)
+ return '%s ' % html
+
+
def register_all_models_in_admin(module_name, exclude_list=[]):
appname = module_name.split('.')
appname = appname[1] if appname[0] == 'sapl' else appname[0]
From 5bbfbc4b74819351d8474a9d4f5fd42234b7f0eb Mon Sep 17 00:00:00 2001
From: Leandro Roberto
Date: Thu, 10 Jan 2019 20:51:51 -0200
Subject: [PATCH 24/35] =?UTF-8?q?add=20informa=C3=A7=C3=A3o=20na=20lista?=
=?UTF-8?q?=20de=20protocolos?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
sapl/templates/protocoloadm/protocolo_filter.html | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/sapl/templates/protocoloadm/protocolo_filter.html b/sapl/templates/protocoloadm/protocolo_filter.html
index 316003075..d3d1968d8 100644
--- a/sapl/templates/protocoloadm/protocolo_filter.html
+++ b/sapl/templates/protocoloadm/protocolo_filter.html
@@ -47,7 +47,7 @@
{% if p.timestamp%}
Data Protocolo: {{ p.timestamp|localtime|date:"d/m/Y"|default_if_none:"Não informado" }} - Horário: {{ p.timestamp|localtime|date:"G:i:s" }}
{% else %}
- Data Protocolo: {{ p.data|date:"d/m/Y"|default_if_none:"Não informado" }} - Horário: {{ p.hora|date:"G:i:s" }}
+ Data Protocolo: {{ p.data|date:"d/m/Y"|default_if_none:"Não informado" }} - Horário: {{ p.hora|date:"G:i:s" }} - {% if not p.timestamp %} Informado Manualmente por: {{p.user_data_hora_manual}}{% endif %}
{% endif %}
{% if p.tipo_processo == 0 %}
Interessado: {{ p.interessado|default_if_none:"Não informado" }}
From 091f566688363e3c8693c8d315e1b4ed898dfe38 Mon Sep 17 00:00:00 2001
From: Edward Ribeiro
Date: Fri, 11 Jan 2019 12:07:40 -0200
Subject: [PATCH 25/35] HOT-FIX: insere EMAIL_SEND_USER em docs e envs.
---
config/env-sample | 1 +
config/env_dockerfile | 1 +
docker-compose.yml | 1 +
docs/instalacao31.rst | 1 +
sapl/.env_test | 1 +
sapl/env-backup | 1 +
6 files changed, 6 insertions(+)
diff --git a/config/env-sample b/config/env-sample
index bde081a92..aeb8c38c4 100644
--- a/config/env-sample
+++ b/config/env-sample
@@ -5,4 +5,5 @@ EMAIL_USE_TLS = True
EMAIL_PORT = 587
EMAIL_HOST = ''
EMAIL_HOST_USER = ''
+EMAIL_SEND_USER = ''
EMAIL_HOST_PASSWORD = ''
diff --git a/config/env_dockerfile b/config/env_dockerfile
index c83fc88f1..134beb274 100644
--- a/config/env_dockerfile
+++ b/config/env_dockerfile
@@ -5,4 +5,5 @@ EMAIL_USE_TLS = True
EMAIL_PORT = 587
EMAIL_HOST = ''
EMAIL_HOST_USER = ''
+EMAIL_SEND_USER = ''
EMAIL_HOST_PASSWORD = ''
diff --git a/docker-compose.yml b/docker-compose.yml
index c796253d4..51af52a6b 100644
--- a/docker-compose.yml
+++ b/docker-compose.yml
@@ -21,6 +21,7 @@ sapl:
EMAIL_USE_TLS: 'False'
EMAIL_HOST: smtp.dominio.net
EMAIL_HOST_USER: usuariosmtp
+ EMAIL_SEND_USER: usuariosmtp
EMAIL_HOST_PASSWORD: senhasmtp
TZ: America/Sao_Paulo
volumes:
diff --git a/docs/instalacao31.rst b/docs/instalacao31.rst
index e904f8d6c..6e9146ee4 100644
--- a/docs/instalacao31.rst
+++ b/docs/instalacao31.rst
@@ -147,6 +147,7 @@ Criação da `SECRET_KEY
Date: Wed, 16 Jan 2019 10:57:00 -0200
Subject: [PATCH 26/35] HOT-FIX: corrige form e view no cadastro de Frentes
---
sapl/parlamentares/views.py | 11 ++++++++++-
sapl/templates/parlamentares/frente_form.html | 19 +++++++++----------
2 files changed, 19 insertions(+), 11 deletions(-)
diff --git a/sapl/parlamentares/views.py b/sapl/parlamentares/views.py
index c47d36566..7b09c4067 100644
--- a/sapl/parlamentares/views.py
+++ b/sapl/parlamentares/views.py
@@ -301,9 +301,18 @@ class FrenteCrud(Crud):
def form_valid(self, form):
return super(Crud.CreateView, self).form_valid(form)
+ class DetailView(Crud.DetailView):
+ def get_context_data(self, **kwargs):
+ context = super().get_context_data(**kwargs)
+ context['subnav_template_name'] = ''
+ return context
+
class UpdateView(Crud.UpdateView):
form_class = FrenteForm
-
+ def get_context_data(self, **kwargs):
+ context = super().get_context_data(**kwargs)
+ context['subnav_template_name'] = ''
+ return context
class MandatoCrud(MasterDetailCrud):
diff --git a/sapl/templates/parlamentares/frente_form.html b/sapl/templates/parlamentares/frente_form.html
index bbab780ae..1d71f6b76 100644
--- a/sapl/templates/parlamentares/frente_form.html
+++ b/sapl/templates/parlamentares/frente_form.html
@@ -57,16 +57,15 @@
function selecionar_parlamentares_frente() {
// Seleciona automaticamente todos os parlamentares
// que já estão presentes naquela frente
- var update_view = {{ update_view }}
- if (update_view == 1) {
- var frente_id = {{ object.id }}
- $.get("/sistema/frente/parlamentares-frente-selected",
- {frente_id: frente_id},
- function (data) {
- id_list = data['id_list'];
- $("div.controls select").val(id_list);
- });
- }
+ {% if object.id %}
+ var frente_id = {{ object.id }}
+ $.get("/sistema/frente/parlamentares-frente-selected",
+ {frente_id: frente_id},
+ function (data) {
+ id_list = data['id_list'];
+ $("div.controls select").val(id_list);
+ });
+ {% endif %}
}
function atualiza_parlamentares() {
From a07e9ca39e156a3b0dd31dd0076feaf61f06fbdc Mon Sep 17 00:00:00 2001
From: Leandro Roberto
Date: Wed, 16 Jan 2019 11:11:34 -0200
Subject: [PATCH 27/35] HOT-FIX: corrige html em frente_form.html
---
sapl/static/js/app.js | 2 +-
sapl/templates/parlamentares/frente_form.html | 3 ++-
2 files changed, 3 insertions(+), 2 deletions(-)
diff --git a/sapl/static/js/app.js b/sapl/static/js/app.js
index d3616a8b5..c30f357bd 100644
--- a/sapl/static/js/app.js
+++ b/sapl/static/js/app.js
@@ -190,7 +190,7 @@ function OptionalCustomFrontEnd() {
if (_label.length === 0) {
_label = $('label[for='+this.id+']');
if (_label.length === 0) {
- _label = $('').insertBefore(this)
+ _label = $('').insertBefore(this)
}
}
diff --git a/sapl/templates/parlamentares/frente_form.html b/sapl/templates/parlamentares/frente_form.html
index 1d71f6b76..03cd79169 100644
--- a/sapl/templates/parlamentares/frente_form.html
+++ b/sapl/templates/parlamentares/frente_form.html
@@ -26,7 +26,8 @@
From 2277ba56aea29b10db6252744ab93884b09a30ea Mon Sep 17 00:00:00 2001
From: Leandro Roberto
Date: Wed, 16 Jan 2019 11:16:58 -0200
Subject: [PATCH 28/35] =?UTF-8?q?corrige=20pre-sele=C3=A7=C3=A3o?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
sapl/templates/parlamentares/frente_form.html | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/sapl/templates/parlamentares/frente_form.html b/sapl/templates/parlamentares/frente_form.html
index 03cd79169..7f13a076e 100644
--- a/sapl/templates/parlamentares/frente_form.html
+++ b/sapl/templates/parlamentares/frente_form.html
@@ -64,7 +64,7 @@
{frente_id: frente_id},
function (data) {
id_list = data['id_list'];
- $("div.controls select").val(id_list);
+ $("id_parlamentares").val(id_list);
});
{% endif %}
}
From 836268d39d5097fd427fbf07759312ac195675c4 Mon Sep 17 00:00:00 2001
From: Leandro Roberto
Date: Wed, 16 Jan 2019 11:16:58 -0200
Subject: [PATCH 29/35] =?UTF-8?q?corrige=20pre-sele=C3=A7=C3=A3o?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
sapl/templates/parlamentares/frente_form.html | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/sapl/templates/parlamentares/frente_form.html b/sapl/templates/parlamentares/frente_form.html
index 7f13a076e..b38b487bd 100644
--- a/sapl/templates/parlamentares/frente_form.html
+++ b/sapl/templates/parlamentares/frente_form.html
@@ -64,7 +64,7 @@
{frente_id: frente_id},
function (data) {
id_list = data['id_list'];
- $("id_parlamentares").val(id_list);
+ $("#id_parlamentares").val(id_list);
});
{% endif %}
}
From 8ef52003c30baa487e360d07010ceb0209b1b0cf Mon Sep 17 00:00:00 2001
From: Leandro Roberto
Date: Wed, 16 Jan 2019 11:26:53 -0200
Subject: [PATCH 30/35] retira menu de parlamentares do cadastro de FrenteCrud
---
sapl/parlamentares/views.py | 115 ++++++++++++++++++++++--------------
1 file changed, 71 insertions(+), 44 deletions(-)
diff --git a/sapl/parlamentares/views.py b/sapl/parlamentares/views.py
index 7b09c4067..aa636df79 100644
--- a/sapl/parlamentares/views.py
+++ b/sapl/parlamentares/views.py
@@ -1,6 +1,6 @@
+from datetime import datetime
import json
import logging
-from datetime import datetime
from django.contrib import messages
from django.contrib.contenttypes.models import ContentType
@@ -35,6 +35,7 @@ from .models import (CargoMesa, Coligacao, ComposicaoColigacao, ComposicaoMesa,
NivelInstrucao, Parlamentar, Partido, SessaoLegislativa,
SituacaoMilitar, TipoAfastamento, TipoDependente, Votante)
+
CargoMesaCrud = CrudAux.build(CargoMesa, 'cargo_mesa')
PartidoCrud = CrudAux.build(Partido, 'partidos')
TipoDependenteCrud = CrudAux.build(TipoDependente, 'tipo_dependente')
@@ -45,6 +46,7 @@ TipoMilitarCrud = CrudAux.build(SituacaoMilitar, 'tipo_situa_militar')
DependenteCrud = MasterDetailCrud.build(
Dependente, 'parlamentar', 'dependente')
+
class SessaoLegislativaCrud(CrudAux):
model = SessaoLegislativa
@@ -54,6 +56,7 @@ class SessaoLegislativaCrud(CrudAux):
class UpdateView(CrudAux.UpdateView):
form_class = SessaoLegislativaForm
+
class VotanteView(MasterDetailCrud):
model = Votante
parent_field = 'parlamentar'
@@ -89,6 +92,7 @@ class FrenteList(MasterDetailCrud):
class BaseMixin(Crud.PublicMixin, MasterDetailCrud.BaseMixin):
list_field_names = ['nome', 'data_criacao', 'data_extincao']
+
@classmethod
def url_name(cls, suffix):
return '%s_parlamentar_%s' % (cls.model._meta.model_name, suffix)
@@ -276,13 +280,16 @@ def parlamentares_frente_selected(request):
logger = logging.getLogger(__name__)
username = request.user.username
try:
- logger.info("user=" + username + ". Tentando objet objeto Frente com id={}.".format(request.GET['frente_id']))
+ logger.info("user=" + username +
+ ". Tentando objet objeto Frente com id={}.".format(request.GET['frente_id']))
frente = Frente.objects.get(id=int(request.GET['frente_id']))
except ObjectDoesNotExist:
- logger.error("user=" + username + ". Frente buscada (id={}) não existe. Retornada lista vazia.".format(request.GET['frente_id']))
+ logger.error("user=" + username +
+ ". Frente buscada (id={}) não existe. Retornada lista vazia.".format(request.GET['frente_id']))
lista_parlamentar_id = []
else:
- logger.info("user=" + username + ". Frente (id={}) encontrada com sucesso.".format(request.GET['frente_id']))
+ logger.info("user=" + username +
+ ". Frente (id={}) encontrada com sucesso.".format(request.GET['frente_id']))
lista_parlamentar_id = frente.parlamentares.all().values_list(
'id', flat=True)
return JsonResponse({'id_list': list(lista_parlamentar_id)})
@@ -292,8 +299,14 @@ class FrenteCrud(Crud):
model = Frente
help_topic = 'tipo_situa_militar'
public = [RP_DETAIL, RP_LIST]
- list_field_names = ['nome', 'data_criacao', 'data_extincao', 'parlamentares']
+ list_field_names = ['nome', 'data_criacao',
+ 'data_extincao', 'parlamentares']
+ class BaseMixin(Crud.BaseMixin):
+ def get_context_data(self, **kwargs):
+ context = super().get_context_data(**kwargs)
+ context['subnav_template_name'] = ''
+ return context
class CreateView(Crud.CreateView):
form_class = FrenteForm
@@ -301,18 +314,8 @@ class FrenteCrud(Crud):
def form_valid(self, form):
return super(Crud.CreateView, self).form_valid(form)
- class DetailView(Crud.DetailView):
- def get_context_data(self, **kwargs):
- context = super().get_context_data(**kwargs)
- context['subnav_template_name'] = ''
- return context
-
class UpdateView(Crud.UpdateView):
form_class = FrenteForm
- def get_context_data(self, **kwargs):
- context = super().get_context_data(**kwargs)
- context['subnav_template_name'] = ''
- return context
class MandatoCrud(MasterDetailCrud):
@@ -369,7 +372,7 @@ class ComposicaoColigacaoCrud(MasterDetailCrud):
class LegislaturaCrud(CrudAux):
-
+
model = Legislatura
help_topic = 'legislatura'
@@ -380,11 +383,13 @@ class LegislaturaCrud(CrudAux):
def get_initial(self):
username = self.request.user.username
try:
- self.logger.error("user=" + username + ". Tentando obter última Legislatura.")
+ self.logger.error("user=" + username +
+ ". Tentando obter última Legislatura.")
ultima_legislatura = Legislatura.objects.latest('numero')
numero = ultima_legislatura.numero + 1
except Legislatura.DoesNotExist:
- self.logger.error("user=" + username + ". Legislatura não encontrada. Número definido como 1.")
+ self.logger.error(
+ "user=" + username + ". Legislatura não encontrada. Número definido como 1.")
numero = 1
return {'numero': numero}
@@ -485,10 +490,12 @@ class ParlamentarCrud(Crud):
def take_legislatura_id(self):
username = self.request.user.username
try:
- self.logger.debug("user=" + username + ". Tentando obter id da legislatura.")
+ self.logger.debug("user=" + username +
+ ". Tentando obter id da legislatura.")
return int(self.request.GET['pk'])
except:
- self.logger.error("user=" + username + ". Legislatura não possui ID. Buscando em todas as entradas.")
+ self.logger.error(
+ "user=" + username + ". Legislatura não possui ID. Buscando em todas as entradas.")
legislaturas = Legislatura.objects.all()
for l in legislaturas:
if l.atual():
@@ -510,14 +517,17 @@ class ParlamentarCrud(Crud):
mandato_titular=F('mandato__titular')).distinct()
else:
try:
- self.logger.debug("user=" + username + ". Tentando obter o mais recente registro do objeto Legislatura.")
+ self.logger.debug(
+ "user=" + username + ". Tentando obter o mais recente registro do objeto Legislatura.")
l = Legislatura.objects.all().order_by(
'-data_inicio').first()
except ObjectDoesNotExist:
- self.logger.error("user=" + username + ". Objeto não encontrado. Retornando todos os registros.")
+ self.logger.error(
+ "user=" + username + ". Objeto não encontrado. Retornando todos os registros.")
return Legislatura.objects.all()
else:
- self.logger.info("user=" + username + ". Objeto encontrado com sucesso.")
+ self.logger.info("user=" + username +
+ ". Objeto encontrado com sucesso.")
if l is None:
return Legislatura.objects.all()
return queryset.filter(mandato__legislatura_id=l).annotate(
@@ -556,8 +566,8 @@ class ParlamentarCrud(Crud):
# ou igual a data de fim da legislatura
try:
self.logger.debug("user=" + username + ". Tentando obter filiação do parlamentar com (data<={} e data_desfiliacao>={}) "
- "ou (data<={} e data_desfiliacao=Null))."
- .format(legislatura.data_fim, legislatura.data_fim, legislatura.data_fim))
+ "ou (data<={} e data_desfiliacao=Null))."
+ .format(legislatura.data_fim, legislatura.data_fim, legislatura.data_fim))
filiacao = parlamentar.filiacao_set.get(Q(
data__lte=legislatura.data_fim,
data_desfiliacao__gte=legislatura.data_fim) | Q(
@@ -583,7 +593,8 @@ class ParlamentarCrud(Crud):
# Caso encontre UMA filiação nessas condições
else:
- self.logger.debug("user=" + username + ". Filiação encontrada com sucesso.")
+ self.logger.debug("user=" + username +
+ ". Filiação encontrada com sucesso.")
row[1] = (filiacao.partido.sigla, None, None)
return context
@@ -615,13 +626,16 @@ class ParlamentarMateriasView(FormView):
parlamentar_pk = kwargs['pk']
username = request.user.username
try:
- self.logger.debug("user=" + username + ". Tentando obter Autor (object_id={}).".format(parlamentar_pk))
+ self.logger.debug(
+ "user=" + username + ". Tentando obter Autor (object_id={}).".format(parlamentar_pk))
autor = Autor.objects.get(
content_type=ContentType.objects.get_for_model(Parlamentar),
object_id=parlamentar_pk)
except ObjectDoesNotExist:
- mensagem = _('Este Parlamentar (pk={}) não é Autor de matéria.'.format(parlamentar_pk))
- self.logger.error("user=" + username + ". Este Parlamentar (pk={}) não é Autor de matéria.".format(parlamentar_pk))
+ mensagem = _(
+ 'Este Parlamentar (pk={}) não é Autor de matéria.'.format(parlamentar_pk))
+ self.logger.error(
+ "user=" + username + ". Este Parlamentar (pk={}) não é Autor de matéria.".format(parlamentar_pk))
messages.add_message(request, messages.ERROR, mensagem)
return HttpResponseRedirect(
reverse(
@@ -709,7 +723,8 @@ class MesaDiretoraView(FormView):
sessao_atual = sessoes.filter(data_inicio__year__lte=year).exclude(
data_inicio__gt=timezone.now()).order_by('-data_inicio').first()
- mesa = sessao_atual.composicaomesa_set.all().order_by('cargo_id') if sessao_atual else []
+ mesa = sessao_atual.composicaomesa_set.all().order_by(
+ 'cargo_id') if sessao_atual else []
cargos_ocupados = [m.cargo for m in mesa]
cargos = CargoMesa.objects.all()
@@ -765,7 +780,8 @@ def altera_field_mesa(request):
else:
year = timezone.now().year
try:
- logger.debug("user=" + username + ". Tentando obter id de sessoes com data_inicio.ano={}.".format(year))
+ logger.debug(
+ "user=" + username + ". Tentando obter id de sessoes com data_inicio.ano={}.".format(year))
sessao_selecionada = sessoes.get(data_inicio__year=year).id
except ObjectDoesNotExist:
logger.error("user=" + username + ". Id de sessoes com data_inicio.ano={} não encontrado. "
@@ -818,24 +834,29 @@ def insere_parlamentar_composicao(request):
composicao = ComposicaoMesa()
try:
- logger.debug("user=" + username + ". Tentando obter SessaoLegislativa com id={}.".format(request.POST['sessao']))
+ logger.debug(
+ "user=" + username + ". Tentando obter SessaoLegislativa com id={}.".format(request.POST['sessao']))
composicao.sessao_legislativa = SessaoLegislativa.objects.get(
id=int(request.POST['sessao']))
except MultiValueDictKeyError:
- logger.error("user=" + username + ". 'MultiValueDictKeyError', nenhuma sessão foi inserida!")
+ logger.error(
+ "user=" + username + ". 'MultiValueDictKeyError', nenhuma sessão foi inserida!")
return JsonResponse({'msg': ('Nenhuma sessão foi inserida!', 0)})
try:
- logger.debug("user=" + username + ". Tentando obter Parlamentar com id={}.".format(request.POST['parlamentar']))
+ logger.debug(
+ "user=" + username + ". Tentando obter Parlamentar com id={}.".format(request.POST['parlamentar']))
composicao.parlamentar = Parlamentar.objects.get(
id=int(request.POST['parlamentar']))
except MultiValueDictKeyError:
- logger.error("user=" + username + ". 'MultiValueDictKeyError', nenhum parlamentar foi inserido!")
+ logger.error(
+ "user=" + username + ". 'MultiValueDictKeyError', nenhum parlamentar foi inserido!")
return JsonResponse({
'msg': ('Nenhum parlamentar foi inserido!', 0)})
try:
- logger.info("user=" + username + ". Tentando obter CargoMesa com id={}.".format(request.POST['cargo']))
+ logger.info("user=" + username +
+ ". Tentando obter CargoMesa com id={}.".format(request.POST['cargo']))
composicao.cargo = CargoMesa.objects.get(
id=int(request.POST['cargo']))
parlamentar_ja_inserido = ComposicaoMesa.objects.filter(
@@ -848,14 +869,16 @@ def insere_parlamentar_composicao(request):
composicao.save()
except MultiValueDictKeyError:
- logger.error("user=" + username + ". 'MultiValueDictKeyError', nenhum cargo foi inserido!")
+ logger.error("user=" + username +
+ ". 'MultiValueDictKeyError', nenhum cargo foi inserido!")
return JsonResponse({'msg': ('Nenhum cargo foi inserido!', 0)})
logger.info("user=" + username + ". Parlamentar inserido com sucesso!")
return JsonResponse({'msg': ('Parlamentar inserido com sucesso!', 1)})
else:
- logger.error("user=" + username + " não tem permissão para esta operação!")
+ logger.error("user=" + username +
+ " não tem permissão para esta operação!")
return JsonResponse(
{'msg': ('Você não tem permissão para esta operação!', 0)})
@@ -873,7 +896,8 @@ def remove_parlamentar_composicao(request):
if 'composicao_mesa' in request.POST:
try:
- logger.debug("user=" + username + ". Tentando obter ComposicaoMesa com id={}.".format(request.POST['composicao_mesa']))
+ logger.debug("user=" + username + ". Tentando obter ComposicaoMesa com id={}.".format(
+ request.POST['composicao_mesa']))
composicao = ComposicaoMesa.objects.get(
id=request.POST['composicao_mesa'])
except ObjectDoesNotExist:
@@ -885,12 +909,14 @@ def remove_parlamentar_composicao(request):
composicao.delete()
- logger.info("user=" + username + ". ComposicaoMesa com id={} excluido com sucesso!".format(request.POST['composicao_mesa']))
+ logger.info("user=" + username + ". ComposicaoMesa com id={} excluido com sucesso!".format(
+ request.POST['composicao_mesa']))
return JsonResponse(
{'msg': (
'Parlamentar excluido com sucesso!', 1)})
else:
- logger.info("user=" + username + ". Nenhum parlamentar escolhido para ser excluído.")
+ logger.info("user=" + username +
+ ". Nenhum parlamentar escolhido para ser excluído.")
return JsonResponse(
{'msg': (
'Selecione algum parlamentar para ser excluido!', 0)})
@@ -909,8 +935,8 @@ def partido_parlamentar_sessao_legislativa(sessao, parlamentar):
logger = logging.getLogger(__name__)
try:
logger.debug("Tentando obter filiação do parlamentar com (data<={} e data_desfiliacao>={}) "
- "ou (data<={} e data_desfiliacao=Null))."
- .format(sessao.data_fim, sessao.data_fim, sessao.data_fim))
+ "ou (data<={} e data_desfiliacao=Null))."
+ .format(sessao.data_fim, sessao.data_fim, sessao.data_fim))
logger.info("Tentando obter filiação correspondente.")
filiacao = parlamentar.filiacao_set.get(Q(
@@ -966,7 +992,8 @@ def altera_field_mesa_public_view(request):
else:
try:
year = timezone.now().year
- logger.info("user=" + username + ". Tentando obter sessões com data_inicio.ano = {}.".format(year))
+ logger.info("user=" + username +
+ ". Tentando obter sessões com data_inicio.ano = {}.".format(year))
sessao_selecionada = sessoes.get(data_inicio__year=year).id
except ObjectDoesNotExist:
logger.error("user=" + username + ". Sessões não encontradas com com data_inicio.ano = {}. "
From e8ccbc74d85e2253c1a16eea218dd4859df5304e Mon Sep 17 00:00:00 2001
From: Leandro Roberto
Date: Wed, 16 Jan 2019 17:12:38 -0200
Subject: [PATCH 31/35] =?UTF-8?q?resolve=20FIXME=20em=20confirma=C3=A7?=
=?UTF-8?q?=C3=A3o=20de=20proposi=C3=A7=C3=B5es?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
uma proposição, quando incorporada com a opção protocolar sempre, ou
opcionamente, da mais usabilidade ao usuário do protocolo
que sua tela seja redirecionada para o detail do protocolo e não o
detail da matéria. Era um fixme antigo que aguardava conclusão da app
protocolo.
---
sapl/materia/forms.py | 9 ++-------
1 file changed, 2 insertions(+), 7 deletions(-)
diff --git a/sapl/materia/forms.py b/sapl/materia/forms.py
index a043d024d..d00a83d70 100644
--- a/sapl/materia/forms.py
+++ b/sapl/materia/forms.py
@@ -2046,15 +2046,10 @@ class ConfirmarProposicaoForm(ProposicaoForm):
self.instance.results['messages']['success'].append(_(
'Protocolo realizado com sucesso'))
- # FIXME qdo protocoloadm estiver homologado, verifique a necessidade
- # de redirecionamento para o protocolo.
- # complete e libere código abaixo para tal.
-
- """
self.instance.results['url'] = reverse(
- 'sapl.protocoloadm:...',
+ 'sapl.protocoloadm:protocolo_mostrar',
kwargs={'pk': protocolo.pk})
- """
+
conteudo_gerado.numero_protocolo = protocolo.numero
conteudo_gerado.save()
From d9f93230b2f1d8859661475bbbe202fcaea2b74e Mon Sep 17 00:00:00 2001
From: Leandro Roberto
Date: Wed, 16 Jan 2019 22:26:05 -0200
Subject: [PATCH 32/35] adequa widget ao django 1.11
---
sapl/materia/forms.py | 43 ++++++++-----------------------------------
1 file changed, 8 insertions(+), 35 deletions(-)
diff --git a/sapl/materia/forms.py b/sapl/materia/forms.py
index d00a83d70..c89d82336 100644
--- a/sapl/materia/forms.py
+++ b/sapl/materia/forms.py
@@ -1298,41 +1298,14 @@ class TipoProposicaoForm(ModelForm):
class TipoProposicaoSelect(Select):
- def render_tipo_option(self, selected_choices, option_value, option_label,
- data_has_perfil=False):
- if option_value is None:
- option_value = ''
- option_value = force_text(option_value)
- if option_value in selected_choices:
- selected_html = mark_safe(' selected="selected"')
- if not self.allow_multiple_selected:
- # Only allow for a single selection.
- selected_choices.remove(option_value)
- else:
- selected_html = ''
- return format_html(
- '',
- option_value,
- selected_html,
- str(data_has_perfil),
- force_text(option_label))
-
- def render_options(self, selected_choices):
- # Normalize to strings.
- selected_choices = set(force_text(v) for v in selected_choices)
- output = []
- output.append(
- self.render_tipo_option(
- selected_choices, '', self.choices.field.empty_label))
-
- for tipo in self.choices.queryset.all():
- output.append(
- self.render_tipo_option(
- selected_choices,
- str(tipo.pk),
- str(tipo),
- data_has_perfil=tipo.perfis.exists()))
- return '\n'.join(output)
+ def create_option(self, name, value, label, selected, index, subindex=None, attrs=None):
+ option = super().create_option(name, value, label, selected,
+ index, subindex=subindex, attrs=attrs)
+ if value:
+ tipo = TipoProposicao.objects.get(id=value)
+ option['attrs']['data-has-perfil'] = str(tipo.perfis.exists())
+
+ return option
class ProposicaoForm(forms.ModelForm):
From 15542b438736a7d56b7144f9eaefd8c7c6e794a0 Mon Sep 17 00:00:00 2001
From: Leandro Roberto
Date: Thu, 17 Jan 2019 16:27:34 -0200
Subject: [PATCH 33/35] =?UTF-8?q?Fix=20#2451=20-=20adequa=C3=A7=C3=A3o=20a?=
=?UTF-8?q?o=20django=201.11?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
sapl/materia/views.py | 2 +-
sapl/norma/views.py | 22 +++++++++++++---------
2 files changed, 14 insertions(+), 10 deletions(-)
diff --git a/sapl/materia/views.py b/sapl/materia/views.py
index 0f856ede3..c3036d52e 100644
--- a/sapl/materia/views.py
+++ b/sapl/materia/views.py
@@ -2175,7 +2175,7 @@ class ImpressosView(PermissionRequiredMixin, TemplateView):
def gerar_pdf_impressos(request, context, template_name):
template = loader.get_template(template_name)
- html = template.render(RequestContext(request, context))
+ html = template.render(context, request)
pdf = weasyprint.HTML(string=html, base_url=request.build_absolute_uri()
).write_pdf()
diff --git a/sapl/norma/views.py b/sapl/norma/views.py
index 0e0ed23e4..c145705b5 100644
--- a/sapl/norma/views.py
+++ b/sapl/norma/views.py
@@ -1,8 +1,6 @@
import logging
import re
-import sapl
-import weasyprint
from django.contrib.auth.mixins import PermissionRequiredMixin
from django.core.exceptions import ObjectDoesNotExist
@@ -15,7 +13,10 @@ from django.views.generic import TemplateView, UpdateView
from django.views.generic.base import RedirectView
from django.views.generic.edit import FormView
from django_filters.views import FilterView
+import weasyprint
+
from sapl import settings
+import sapl
from sapl.base.models import AppConfig
from sapl.compilacao.views import IntegracaoTaView
from sapl.crud.base import (RP_DETAIL, RP_LIST, Crud, CrudAux,
@@ -108,7 +109,8 @@ class NormaPesquisaView(FilterView):
context['filter_url'] = ('&' + qr.urlencode()) if len(qr) > 0 else ''
context['show_results'] = show_results_filter_set(qr)
- context['USE_SOLR'] = settings.USE_SOLR if hasattr(settings, 'USE_SOLR') else False
+ context['USE_SOLR'] = settings.USE_SOLR if hasattr(
+ settings, 'USE_SOLR') else False
return context
@@ -196,9 +198,8 @@ class NormaCrud(Crud):
estatisticas_acesso_normas = AppConfig.objects.first().estatisticas_acesso_normas
if estatisticas_acesso_normas == 'S':
NormaEstatisticas.objects.create(usuario=str(self.request.user),
- norma_id=kwargs['pk'])
+ norma_id=kwargs['pk'])
return super().get(request, *args, **kwargs)
-
class DeleteView(Crud.DeleteView):
@@ -218,12 +219,14 @@ class NormaCrud(Crud):
username = self.request.user.username
try:
- self.logger.debug('user=' + username + '. Tentando obter objeto de modelo da esfera da federação.')
+ self.logger.debug(
+ 'user=' + username + '. Tentando obter objeto de modelo da esfera da federação.')
esfera = sapl.base.models.AppConfig.objects.last(
).esfera_federacao
self.initial['esfera_federacao'] = esfera
except:
- self.logger.error('user=' + username + '. Erro ao obter objeto de modelo da esfera da federação.')
+ self.logger.error(
+ 'user=' + username + '. Erro ao obter objeto de modelo da esfera da federação.')
pass
self.initial['complemento'] = False
return self.initial
@@ -233,7 +236,7 @@ class NormaCrud(Crud):
class ListView(Crud.ListView, RedirectView):
def get_redirect_url(self, *args, **kwargs):
- namespace = self.model._meta.app_config.name
+ namespace = self.model._meta.app_config.name
return reverse('%s:%s' % (namespace, 'norma_pesquisa'))
def get(self, request, *args, **kwargs):
@@ -332,6 +335,7 @@ class AutoriaNormaCrud(MasterDetailCrud):
})
return initial
+
class ImpressosView(PermissionRequiredMixin, TemplateView):
template_name = 'materia/impressos/impressos.html'
permission_required = ('materia.can_access_impressos', )
@@ -339,7 +343,7 @@ class ImpressosView(PermissionRequiredMixin, TemplateView):
def gerar_pdf_impressos(request, context, template_name):
template = loader.get_template(template_name)
- html = template.render(RequestContext(request, context))
+ html = template.render(context, request)
pdf = weasyprint.HTML(string=html, base_url=request.build_absolute_uri()
).write_pdf()
From a645e0a12c0399843338b29ccd4aeefbf533d919 Mon Sep 17 00:00:00 2001
From: Leandro Roberto
Date: Thu, 17 Jan 2019 17:11:22 -0200
Subject: [PATCH 34/35] =?UTF-8?q?corrige=20leitura=20de=20permissoes=20nas?=
=?UTF-8?q?=20tabelas=20auxili=C3=A1res?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
sapl/templates/compilacao/tipotextoarticulado_list.html | 4 ++--
sapl/templates/crud/list_tabaux.html | 4 ++--
2 files changed, 4 insertions(+), 4 deletions(-)
diff --git a/sapl/templates/compilacao/tipotextoarticulado_list.html b/sapl/templates/compilacao/tipotextoarticulado_list.html
index 509c9c0d3..3445306f5 100644
--- a/sapl/templates/compilacao/tipotextoarticulado_list.html
+++ b/sapl/templates/compilacao/tipotextoarticulado_list.html
@@ -15,7 +15,7 @@
{% endblock actions %}
- |