diff --git a/tasas/api/views.py b/tasas/api/views.py index 20b44f1..1ce6367 100644 --- a/tasas/api/views.py +++ b/tasas/api/views.py @@ -2,16 +2,14 @@ from rest_framework.response import Response from django.shortcuts import get_object_or_404, get_list_or_404 -from django.db.models import Avg, Q +from django.db.models import Avg from .serializers import UniversidadSerializer, TasaSerializer from ..models import Universidad, Tasa, Curso -from tasasrest import settings - class UniversidadViewSet(ModelViewSet): - queryset = Universidad.objects.all() + queryset = Universidad.objects.all().filter(activa=True) serializer_class = UniversidadSerializer base_name = "universidades" http_method_names = ['get', 'head', 'options'] @@ -33,7 +31,7 @@ def retrieve(self, request, pk=None, *args, **kwargs): class ProvinciaViewSet(ModelViewSet): - queryset = Universidad.objects.all().prefetch_related('tasas') + queryset = Universidad.objects.all().prefetch_related('tasas').filter(activa=True) serializer_class = UniversidadSerializer http_method_names = ['get', 'head', 'options'] diff --git a/tasas/migrations/0021_universidad_activa.py b/tasas/migrations/0021_universidad_activa.py new file mode 100644 index 0000000..6b25643 --- /dev/null +++ b/tasas/migrations/0021_universidad_activa.py @@ -0,0 +1,20 @@ +# -*- coding: utf-8 -*- +# Generated by Django 1.9.2 on 2018-01-18 18:23 +from __future__ import unicode_literals + +from django.db import migrations, models + + +class Migration(migrations.Migration): + + dependencies = [ + ('tasas', '0020_auto_20161102_1103'), + ] + + operations = [ + migrations.AddField( + model_name='universidad', + name='activa', + field=models.BooleanField(default=True), + ), + ] diff --git a/tasas/models.py b/tasas/models.py index 67a976d..b901933 100644 --- a/tasas/models.py +++ b/tasas/models.py @@ -65,6 +65,7 @@ def __init__(self, *args, **kwargs): help_text=ugettext_lazy("Siglas de la universidad")) nombre = models.CharField(max_length=200, null=False, blank=False, help_text=ugettext_lazy("Nombre de la universidad")) + activa = models.BooleanField(default=True, null=False) tipo = models.IntegerField(choices=TIPO_UNIVERSIDAD_CHOICES, null=False, blank=False, help_text=ugettext_lazy("Tipo de centro (público/privado)")) centro = models.CharField(max_length=200, null=True, blank=True, help_text=ugettext_lazy("Nombre del centro")) diff --git a/tasas/static/tasas/css/backend.css b/tasas/static/tasas/css/backend.css index a50c77c..9d10424 100644 --- a/tasas/static/tasas/css/backend.css +++ b/tasas/static/tasas/css/backend.css @@ -3,7 +3,6 @@ } @keyframes faint { - 0% { background-color: rgba(35, 210, 0, 0.86); opacity: 1; @@ -38,14 +37,13 @@ opacity: 1; animation: faint ease-in 5s forwards; -moz-animation: faint ease-in 5s forwards; - - p { - position: relative; - top: 50%; - -webkit-transform: translateY(-50%); - -ms-transform: translateY(-50%); - transform: translateY(-50%); - } +} +.status p { + position: relative; + top: 50%; + -webkit-transform: translateY(-50%); + -ms-transform: translateY(-50%); + transform: translateY(-50%); } .success { @@ -69,22 +67,25 @@ margin-right: auto; margin-left: auto; padding-bottom: 30px; - - form{ - display: inline-block; - #submit { - margin-left: auto; - margin-right: auto; - } - } - +} +.form-container form{ + display: inline-block; +} +.form-container form #submit { + margin-left: auto; + margin-right: auto; } .errorlist{ color: red; list-style: none; } + /*Fix for bootstrap-select*/ .overlay{ z-index:3 !important; } + +.panel-inactive{ + background-color: rgb(174, 182, 180); +} diff --git a/tasas/static/tasas/css/backend.less b/tasas/static/tasas/css/backend.less deleted file mode 100644 index a50c77c..0000000 --- a/tasas/static/tasas/css/backend.less +++ /dev/null @@ -1,90 +0,0 @@ -.foto-uni { - max-width: 100%; -} - -@keyframes faint { - - 0% { - background-color: rgba(35, 210, 0, 0.86); - opacity: 1; - } - 50%{ - background-color: rgba(35, 210, 0, 0.43); - opacity: 0.5; - } - 100%{ - background-color: rgba(35, 210, 0, 0); - display: none; - opacity: 0; - } -} - -.status { - position: fixed; - width: 500px; - height: 50px; - margin: -25px auto auto -250px; - top: 25%; - left: 50%; - text-align: center; - z-index: 99; - border-color: white; - border-width: 1px; - border-style: solid; - border-radius: 7px; - color: white; - vertical-align: middle; - display: table-cell; - opacity: 1; - animation: faint ease-in 5s forwards; - -moz-animation: faint ease-in 5s forwards; - - p { - position: relative; - top: 50%; - -webkit-transform: translateY(-50%); - -ms-transform: translateY(-50%); - transform: translateY(-50%); - } -} - -.success { - background-color: rgba(35, 210, 0, 0.86); -} - -.fail { - background-color: rgba(210, 0, 0, 0.9); -} -.page{ - width: 100%; -} -.form-container{ - text-align: center; - border-style: solid; - border-radius: 7px; - border-width: 1px; - border-color: rgba(117, 117, 117, 0.11); - background-color: #F8F8F8; - max-width: 30%; - margin-right: auto; - margin-left: auto; - padding-bottom: 30px; - - form{ - display: inline-block; - #submit { - margin-left: auto; - margin-right: auto; - } - } - -} - -.errorlist{ - color: red; - list-style: none; -} -/*Fix for bootstrap-select*/ -.overlay{ - z-index:3 !important; -} diff --git a/tasas/templates/tasas/edit.html b/tasas/templates/tasas/edit.html index 1c58a1c..b787a94 100644 --- a/tasas/templates/tasas/edit.html +++ b/tasas/templates/tasas/edit.html @@ -36,6 +36,11 @@