Commit d9e52ea2f0f24114e74720059654cd5096030712

Authored by Zambom
2 parents 1204ee9e cba88b9c

Fixing conflicts

bulletin/models.py
... ... @@ -18,7 +18,7 @@ def validate_file_extension(value):
18 18  
19 19 class Bulletin(Resource):
20 20 content = models.TextField(_('Bulletin Content'), blank = True)
21   - file_content = models.FileField(_('Bulletin Data (Goals)'), blank = True, upload_to = 'files/', validators = [validate_file_extension])
  21 + file_content = models.FileField(_('Bulletin Data (Goals)'), blank = True, upload_to = 'bulletin/', validators = [validate_file_extension])
22 22  
23 23 class Meta:
24 24 verbose_name = _('Bulletin')
... ...
bulletin/templates/bulletin/view.html
... ... @@ -57,8 +57,46 @@
57 57 <hr />
58 58  
59 59 <div class="row">
  60 +<<<<<<< HEAD
60 61 <div class="col-md-8 col-md-offset-2 col-sm-8 col-sm-offset-2 alert-warning bulletin-warning">
61 62 <div class="col-md-2 col-sm-2">
  63 +=======
  64 + <div class="col-md-12">
  65 + <b><h5> {% trans "Check your goals" %}:</b></h5>
  66 + <table class="table table-bordered">
  67 + <thead>
  68 + <tr>
  69 + <th style="text-align:center;vertical-align:middle" colspan="1" rowspan="2">Meta</th>
  70 + <th style="text-align:center;vertical-align:middle" colspan="1" rowspan="2">Média da Turma</th>
  71 + <th style="text-align:center" colspan="3">Dados Individuais</th>
  72 + </tr>
  73 + <tr>
  74 + <th style="text-align:center" colspan="">Desejada</th>
  75 + <th style="text-align:center">Estabelecida</th>
  76 + <th style="text-align:center">Alcançada</th>
  77 + </tr>
  78 + </thead>
  79 + <tbody>
  80 + {% for meta in metas%}
  81 + <tr>
  82 + <td>{{ meta.description }}</td>
  83 + <td></td>
  84 + <td style="text-align:center">{{ meta.desejada }} %</td>
  85 + <td style="text-align:center"> %</td>
  86 + <td style="text-align:center">%</td>
  87 + </tr>
  88 +
  89 + {% endfor %}
  90 + </tbody>
  91 + </table>
  92 + </div>
  93 + </div>
  94 + </div>
  95 +
  96 + <div class="row">
  97 + <div class="col-md-8 col-md-offset-2 alert-warning bulletin-warning">
  98 + <div class="col-md-2">
  99 +>>>>>>> cba88b9cfc2d1ed7f6ebb2af37b204fb9e96f113
62 100 <img src="{% static 'img/warning.png' %}" class="img-responsive" />
63 101 </div>
64 102 <div class="col-md-10 col-sm-10">
... ...
bulletin/views.py
... ... @@ -8,7 +8,7 @@ from django.http import JsonResponse
8 8  
9 9 from amadeus.permissions import has_subject_permissions, has_resource_permissions
10 10 from .utils import brodcast_dificulties
11   -from goals.models import Goals,GoalItem
  11 +from goals.models import Goals,GoalItem,MyGoals
12 12  
13 13 import xlwt
14 14 import time
... ... @@ -153,6 +153,29 @@ class InsideView(LoginRequiredMixin, LogMixin, generic.DetailView):
153 153  
154 154 self.request.session['log_id'] = Log.objects.latest('id').id
155 155  
  156 +
  157 + topic = self.object.topic
  158 +
  159 + meta_geral = Goals.objects.get(topic=topic)
  160 + metas = GoalItem.objects.filter(goal = meta_geral)
  161 + metas_pessoais = []
  162 + '''
  163 + for m in metas:
  164 + if MyGoals.objects.filter(item = m).exists():
  165 + metas_pessoais.append(MyGoals.objects.get(item = m))
  166 + '''
  167 +
  168 + itens_da_meta = sorted(list(metas), key = lambda met: met.id)
  169 + metas_pessoais = sorted(list(metas_pessoais), key = lambda me: me.id)
  170 + lista_metas = [{'description':geral.description, 'desejada':geral.ref_value} for geral in itens_da_meta ]
  171 + '''
  172 + for x in range(0,len(metas_pessoais)):
  173 + lista_metas[x]['estabelecida'] = metas_pessoais[x].value
  174 + print(metas_pessoais)
  175 + print(lista_metas)
  176 + '''
  177 + context['metas'] = lista_metas
  178 +
156 179 return context
157 180  
158 181 class CreateView(LoginRequiredMixin, LogMixin, generic.edit.CreateView):
... ...