diff --git a/release.sh b/release.sh index d8301aafe..3470bc633 100755 --- a/release.sh +++ b/release.sh @@ -14,14 +14,16 @@ function bump_version { sed -e s/$VERSION/$NEXT_VERSION/g setup.py > tmp2 mv tmp2 setup.py - sed -e s/$VERSION/$NEXT_VERSION/g sapl/templates/base.html > tmp3 mv tmp3 sapl/templates/base.html + + sed -e s/$VERSION/$NEXT_VERSION/g sapl/settings.py > tmp4 + mv tmp4 sapl/settings.py } function commit_and_push { echo "committing..." - git add docker-compose.yml setup.py sapl/templates/base.html + git add docker-compose.yml setup.py sapl/settings.py sapl/templates/base.html git commit -m "Release: $NEXT_VERSION" git tag $NEXT_VERSION diff --git a/sapl/api/serializers.py b/sapl/api/serializers.py index f416517c5..ac95cd146 100644 --- a/sapl/api/serializers.py +++ b/sapl/api/serializers.py @@ -1,6 +1,7 @@ +from django.conf import settings from rest_framework import serializers -from sapl.base.models import Autor +from sapl.base.models import Autor, CasaLegislativa class ChoiceSerializer(serializers.Serializer): @@ -38,3 +39,14 @@ class AutorSerializer(serializers.ModelSerializer): class Meta: model = Autor fields = '__all__' + + +class CasaLegislativaSerializer(serializers.ModelSerializer): + version = serializers.SerializerMethodField() + + def get_version(self, obj): + return settings.SAPL_VERSION + + class Meta: + model = CasaLegislativa + fields = '__all__' diff --git a/sapl/api/urls.py b/sapl/api/urls.py index bdcf0e372..3e874add2 100644 --- a/sapl/api/urls.py +++ b/sapl/api/urls.py @@ -40,7 +40,7 @@ schema_view = get_schema_view( permission_classes=(permissions.AllowAny,), ) -urlpatterns_api = [ +urlpatterns_api_doc = [ url(r'^docs/swagger(?P\.json|\.yaml)$', schema_view.without_ui(cache_timeout=0), name='schema-json'), url(r'^docs/swagger/$', @@ -60,13 +60,16 @@ deprecated_urlpatterns_api = [ url(r'^model/(?P\d+)/(?P\d*)$', ModelChoiceView.as_view(), name='model_list'), + + ] urlpatterns = [ url(r'^api/', include(deprecated_urlpatterns_api)), - url(r'^api/', include(urlpatterns_api)), + url(r'^api/', include(urlpatterns_api_doc)), url(r'^api/', include(urlpatterns_router)), + # implementar caminho para autenticaĆ§Ć£o # https://www.django-rest-framework.org/tutorial/4-authentication-and-permissions/ # url(r'^api/auth/', include('rest_framework.urls', namespace='rest_framework')), diff --git a/sapl/settings.py b/sapl/settings.py index a85b6b18d..48df49d9b 100755 --- a/sapl/settings.py +++ b/sapl/settings.py @@ -41,6 +41,8 @@ ALLOWED_HOSTS = ['*'] LOGIN_REDIRECT_URL = '/' LOGIN_URL = '/login/?next=' +SAPL_VERSION = '3.1.144' + if DEBUG: EMAIL_BACKEND = 'django.core.mail.backends.console.EmailBackend' else: