Skip to content

Commit

Permalink
Merge branch 'mt6-ocultar-universidades' into develop
Browse files Browse the repository at this point in the history
  • Loading branch information
jcabala14 committed Feb 1, 2018
2 parents e5f6314 + 8217c98 commit 9a1a942
Show file tree
Hide file tree
Showing 8 changed files with 67 additions and 116 deletions.
8 changes: 3 additions & 5 deletions tasas/api/views.py
Original file line number Diff line number Diff line change
Expand Up @@ -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']
Expand All @@ -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']

Expand Down
20 changes: 20 additions & 0 deletions tasas/migrations/0021_universidad_activa.py
Original file line number Diff line number Diff line change
@@ -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),
),
]
1 change: 1 addition & 0 deletions tasas/models.py
Original file line number Diff line number Diff line change
Expand Up @@ -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"))
Expand Down
37 changes: 19 additions & 18 deletions tasas/static/tasas/css/backend.css
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@
}

@keyframes faint {

0% {
background-color: rgba(35, 210, 0, 0.86);
opacity: 1;
Expand Down Expand Up @@ -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 {
Expand All @@ -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);
}
90 changes: 0 additions & 90 deletions tasas/static/tasas/css/backend.less

This file was deleted.

5 changes: 5 additions & 0 deletions tasas/templates/tasas/edit.html
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,11 @@ <h5>{% trans "Información general" %}</h5>
<label class="has-error">{{ universidad_form.nombre.errors }}</label>
{{ universidad_form.nombre|add_class:"form-control" }}
</div>
<div>
<label for="{{ universidad_form.activa.id_for_label }}">{{ universidad_form.activa.label }}</label>
<label class="has-error">{{ universidad_form.activa.errors }}</label>
{{ universidad_form.activa }}
</div>
<div>
<label for="{{ universidad_form.tipo.id_for_label }}">{{ universidad_form.tipo.label }}</label>
<label class="has-error">{{ universidad_form.tipo.errors }}</label>
Expand Down
19 changes: 17 additions & 2 deletions tasas/templates/tasas/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -5,19 +5,34 @@
{{ content.super }}
<div class="col-md-8">
<div class="col-md-12">
{% for universidad in universidades %}
{% for universidad in universidades_activas %}
<div class="row uni-row">
<div class="panel panel-default">
<a href="universidad/{{universidad.siglas}}/">
<div class="panel-body">
<div class="col-xs-3 col-sm-2 col-md-2 col-lg-1">{% if universidad.logo %}<img src="{{universidad.logo.url}}" alt="{% trans "Foto de la" %} {{universidad.nombre}}" class="img-circle foto-uni">{% endif %}</div>
<div class="col-xs-8 col-sm-9 col-md-9 col-lg-10"><strong>{{universidad.nombre}}</strong><br><span class="text-muted">{{universidad.campus}}</span></div>
<div class="col-xs-8 col-sm-9 col-md-9 col-lg-10"><strong>{{universidad.nombre}}</strong><br><span class="text-muted">{{universidad.campus|default_if_none:''}}</span></div>
<div class="col-xs-1 col-sm-1 col-md-1 col-lg-1"><a href="universidad/{{universidad.siglas}}/editar/"><i class="fa fa-pencil-square"></i></a></div>
</div>
</a>
</div>
</div>
{% endfor %}
<h3>Universidades inactivas</h3>
{% for universidad in universidades_inactivas %}
<div class="row uni-row">
<div class="panel panel-default panel-inactive">
<a href="universidad/{{universidad.siglas}}/">
<div class="panel-body">
<div class="col-xs-3 col-sm-2 col-md-2 col-lg-1">{% if universidad.logo %}<img src="{{universidad.logo.url}}" alt="{% trans "Foto de la" %} {{universidad.nombre}}" class="img-circle foto-uni">{% endif %}</div>
<div class="col-xs-8 col-sm-9 col-md-9 col-lg-10">{{universidad.nombre}}<br><span class="text-muted">{{universidad.campus|default_if_none:''}}</span></div>
<div class="col-xs-1 col-sm-1 col-md-1 col-lg-1"><a href="universidad/{{universidad.siglas}}/editar/"><i class="fa fa-pencil-square"></i></a></div>
</div>
</a>
</div>
</div>
{% endfor %}

</div>
</div>
<div class="col-md-4">
Expand Down
3 changes: 2 additions & 1 deletion tasas/views.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,8 @@ class IndexView(TemplateView):

def get_context_data(self, **kwargs):
context = super(IndexView, self).get_context_data(**kwargs)
context['universidades'] = Universidad.objects.all()
context['universidades_activas'] = Universidad.objects.filter(activa=True)
context['universidades_inactivas'] = Universidad.objects.filter(activa=False)

return context

Expand Down

0 comments on commit 9a1a942

Please sign in to comment.