Commit 30aba4890c42f1ef02be14f717055d73c4233746

Authored by Felipe Henrique de Almeida Bormann
1 parent 0771942e

solved coordinators problem on initial page

serializedata.py
1 1 from django.core import serializers
2 2 import os
3   -
  3 +import json
4 4 os.environ.setdefault("DJANGO_SETTINGS_MODULE", "amadeus.settings")
5 5  
6 6 from subjects.models import Subject
  7 +from users.models import User
  8 +from categories.models import Category
  9 +
  10 +subject_data = serializers.serialize("json", Subject.objects.all())
  11 +
  12 +
  13 +users_data = serializers.serialize("json", User.objects.all())
7 14  
  15 +category_data = serializers.serialize("json", Category.objects.all())
8 16  
9   -data = serializers.serialize("json", Subject.objects.all())
10   -print(data)
11 17 \ No newline at end of file
  18 +with open('data.txt', 'w') as outfile:
  19 + json.dump(category_data, outfile)
12 20 \ No newline at end of file
... ...
subjects/templates/subjects/subject_card.html
... ... @@ -11,7 +11,7 @@
11 11 </h4>
12 12  
13 13 <div class="col-md-5 pull-right category-card-items">
14   - {% if request.user in subject.professor.all or request.user in category.coordinators.all or request.user.is_staff %}
  14 + {% if request.user in subject.professor.all or request.user in subject.category.coordinators.all or request.user.is_staff %}
15 15 <a href="" id="moreActions" data-toggle="dropdown" aria-haspopup="true" aria-expanded="false">
16 16 <i class="fa fa-ellipsis-v" aria-hidden="true"></i>
17 17 </a>
... ... @@ -112,7 +112,7 @@
112 112 <p>{{subject.description_brief|safe}}</p>
113 113 {% if show_buttons %}
114 114  
115   - {% if request.user in subject.students.all or request.user in subject.professor.all or request.user.is_staff or request.user in category.coordinators.all %}
  115 + {% if request.user in subject.students.all or request.user in subject.professor.all or request.user.is_staff or request.user in subject.category.coordinators.all %}
116 116 <a href="{% url 'subjects:view' subject.slug %}" class="access-subject btn btn-primary btn-raised"> {% trans "Access Subject" %}</a>
117 117 {% else %}
118 118 <a href="#" class="subscribe-subject btn btn-primary btn-raised"> {% trans "Subscribe to Subject" %}</a>
... ...
subjects/templates/subjects/view.html
... ... @@ -10,7 +10,8 @@
10 10  
11 11 {% block breadcrumbs %}
12 12 {{ block.super }}
13   -
  13 + {% breadcrumb 'Home' 'subjects:home' %}
  14 +
14 15 {% endblock %}
15 16  
16 17  
... ... @@ -18,6 +19,6 @@
18 19  
19 20 {% include "subjects/subject_card.html" %}
20 21  
21   -
  22 +
22 23  
23 24 {% endblock content %}
24 25 \ No newline at end of file
... ...