Commit 30aba4890c42f1ef02be14f717055d73c4233746
1 parent
0771942e
Exists in
master
and in
3 other branches
solved coordinators problem on initial page
Showing
3 changed files
with
16 additions
and
7 deletions
Show diff stats
serializedata.py
1 | from django.core import serializers | 1 | from django.core import serializers |
2 | import os | 2 | import os |
3 | - | 3 | +import json |
4 | os.environ.setdefault("DJANGO_SETTINGS_MODULE", "amadeus.settings") | 4 | os.environ.setdefault("DJANGO_SETTINGS_MODULE", "amadeus.settings") |
5 | 5 | ||
6 | from subjects.models import Subject | 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 | \ No newline at end of file | 17 | \ No newline at end of file |
18 | +with open('data.txt', 'w') as outfile: | ||
19 | + json.dump(category_data, outfile) | ||
12 | \ No newline at end of file | 20 | \ No newline at end of file |
subjects/templates/subjects/subject_card.html
@@ -11,7 +11,7 @@ | @@ -11,7 +11,7 @@ | ||
11 | </h4> | 11 | </h4> |
12 | 12 | ||
13 | <div class="col-md-5 pull-right category-card-items"> | 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 | <a href="" id="moreActions" data-toggle="dropdown" aria-haspopup="true" aria-expanded="false"> | 15 | <a href="" id="moreActions" data-toggle="dropdown" aria-haspopup="true" aria-expanded="false"> |
16 | <i class="fa fa-ellipsis-v" aria-hidden="true"></i> | 16 | <i class="fa fa-ellipsis-v" aria-hidden="true"></i> |
17 | </a> | 17 | </a> |
@@ -112,7 +112,7 @@ | @@ -112,7 +112,7 @@ | ||
112 | <p>{{subject.description_brief|safe}}</p> | 112 | <p>{{subject.description_brief|safe}}</p> |
113 | {% if show_buttons %} | 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 | <a href="{% url 'subjects:view' subject.slug %}" class="access-subject btn btn-primary btn-raised"> {% trans "Access Subject" %}</a> | 116 | <a href="{% url 'subjects:view' subject.slug %}" class="access-subject btn btn-primary btn-raised"> {% trans "Access Subject" %}</a> |
117 | {% else %} | 117 | {% else %} |
118 | <a href="#" class="subscribe-subject btn btn-primary btn-raised"> {% trans "Subscribe to Subject" %}</a> | 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,7 +10,8 @@ | ||
10 | 10 | ||
11 | {% block breadcrumbs %} | 11 | {% block breadcrumbs %} |
12 | {{ block.super }} | 12 | {{ block.super }} |
13 | - | 13 | + {% breadcrumb 'Home' 'subjects:home' %} |
14 | + | ||
14 | {% endblock %} | 15 | {% endblock %} |
15 | 16 | ||
16 | 17 | ||
@@ -18,6 +19,6 @@ | @@ -18,6 +19,6 @@ | ||
18 | 19 | ||
19 | {% include "subjects/subject_card.html" %} | 20 | {% include "subjects/subject_card.html" %} |
20 | 21 | ||
21 | - | 22 | + |
22 | 23 | ||
23 | {% endblock content %} | 24 | {% endblock content %} |
24 | \ No newline at end of file | 25 | \ No newline at end of file |