Commit a215632c6c9e88b60ef20cf201b2335d86c2c76e

Authored by Matheus Lins
2 parents 82f3a3e4 5292e546

Merge branch 'dev' of https://github.com/amadeusproject/amadeuslms into dev

app/templates/home.html
@@ -132,14 +132,3 @@ @@ -132,14 +132,3 @@
132 </center> 132 </center>
133 </div> 133 </div>
134 {% endblock %} 134 {% endblock %}
135 -  
136 -{% block rightbar %}  
137 - <div class="panel panel-warning">  
138 - <div class="panel-heading">  
139 - <h3 class="panel-title">Pending Stuffs</h3>  
140 - </div>  
141 - <div class="panel-body">  
142 - <p>{% trans 'No pending tasks at the moment.' %}</p>  
143 - </div>  
144 - </div>  
145 -{% endblock rightbar %}  
146 \ No newline at end of file 135 \ No newline at end of file
app/templates/home_professor.html
@@ -54,24 +54,3 @@ @@ -54,24 +54,3 @@
54 {% endif %} 54 {% endif %}
55 {% endblock %} 55 {% endblock %}
56 56
57 -{% block rightbar %}  
58 - <div class="col-md-12">  
59 - <div><div class="panel panel-warning">  
60 - <div class="panel-heading">  
61 - <h3 class="panel-title">{% trans 'Pending Stuffs' %}</h3>  
62 - </div>  
63 - <div class="panel-body">  
64 -  
65 - </div>  
66 -</div></div>  
67 - <div><div class="panel panel-warning">  
68 - <div class="panel-heading">  
69 - <h3 class="panel-title">{% trans 'Goals' %}</h3>  
70 - </div>  
71 - <div class="panel-body">  
72 -  
73 - </div>  
74 -</div></div>  
75 - </div>  
76 -  
77 -{% endblock rightbar %}  
app/templates/home_student.html
@@ -67,12 +67,3 @@ @@ -67,12 +67,3 @@
67 </div> 67 </div>
68 </div> 68 </div>
69 {% endblock %} 69 {% endblock %}
70 -  
71 -{% block rightbar %}  
72 - <div class="well well-lg goal">  
73 - {% trans 'Goals' %}  
74 - </div>  
75 - <div class="well well-lg favorites">  
76 - {% trans 'Favorites' %}  
77 - </div>  
78 -{% endblock rightbar %}  
core/templates/base.html
@@ -104,17 +104,13 @@ @@ -104,17 +104,13 @@
104 104
105 {% endblock %} 105 {% endblock %}
106 <div class="row"> 106 <div class="row">
107 - <div class="col-xs-9 col-sm-9 col-md-9 col-lg-9 col-xl-9"> 107 + <div class="col-xs-12 col-sm-12 col-md-12 col-lg-12 col-xl-12">
108 {% block content %} 108 {% block content %}
109 109
110 {% endblock %} 110 {% endblock %}
111 - </div> 111 + </div>
112 112
113 - <div class="col-xs-3 col-sm-3 col-md-3 col-lg-3 col-xl-3">  
114 - {% block rightbar %}  
115 -  
116 - {% endblock rightbar %}  
117 - </div> 113 +
118 </div> 114 </div>
119 </div> 115 </div>
120 </div> 116 </div>
core/templates/index.html
@@ -78,6 +78,4 @@ @@ -78,6 +78,4 @@
78 </div> 78 </div>
79 {% endblock%} 79 {% endblock%}
80 80
81 -{% block rightbar %}  
82 81
83 -{% endblock rightbar %}  
courses/templates/course/view.html
@@ -254,14 +254,3 @@ @@ -254,14 +254,3 @@
254 254
255 {% endblock %} 255 {% endblock %}
256 256
257 -  
258 -{% block rightbar %}  
259 -<div class="panel panel-warning">  
260 - <div class="panel-heading">  
261 - <h3 class="panel-title">{% trans "Pending Stuffs" %}</h3>  
262 - </div>  
263 - <div class="panel-body">  
264 - <p>{% trans 'No pending tasks at the moment.' %}</p>  
265 - </div>  
266 - </div>  
267 -{% endblock rightbar %}  
courses/templates/subject/index.html
@@ -92,15 +92,3 @@ @@ -92,15 +92,3 @@
92 {% endif %} 92 {% endif %}
93 93
94 {% endblock %} 94 {% endblock %}
95 -  
96 -{% block rightbar %}  
97 -  
98 - <div class="panel panel-warning">  
99 - <div class="panel-heading">  
100 - <h3 class="panel-title">{% trans "Pending Stuffs" %}</h3>  
101 - </div>  
102 - <div class="panel-body">  
103 -  
104 - </div>  
105 - </div>  
106 -{% endblock rightbar %}  
courses/templates/subject_category/index.html
@@ -63,15 +63,3 @@ @@ -63,15 +63,3 @@
63 63
64 64
65 {% endblock %} 65 {% endblock %}
66 -  
67 -{% block rightbar %}  
68 -  
69 - <div class="panel panel-warning">  
70 - <div class="panel-heading">  
71 - <h3 class="panel-title">{% trans "Pending Stuffs" %}</h3>  
72 - </div>  
73 - <div class="panel-body">  
74 -  
75 - </div>  
76 - </div>  
77 -{% endblock rightbar %}  
78 \ No newline at end of file 66 \ No newline at end of file
courses/templates/topic/index.html
@@ -149,15 +149,3 @@ @@ -149,15 +149,3 @@
149 </div> 149 </div>
150 </div> 150 </div>
151 {% endblock %} 151 {% endblock %}
152 -  
153 -{% block rightbar %}  
154 -  
155 - <div class="panel panel-warning">  
156 - <div class="panel-heading">  
157 - <h3 class="panel-title">{% trans "Pending Stuffs" %}</h3>  
158 - </div>  
159 - <div class="panel-body">  
160 -  
161 - </div>  
162 - </div>  
163 -{% endblock rightbar %}  
forum/templates/forum/forum_view.html
@@ -124,13 +124,3 @@ @@ -124,13 +124,3 @@
124 </div> 124 </div>
125 {% endblock %} 125 {% endblock %}
126 126
127 -{% block rightbar %}  
128 - <div class="panel panel-warning">  
129 - <div class="panel-heading">  
130 - <h3 class="panel-title">{% trans "Pending Stuffs" %}</h3>  
131 - </div>  
132 - <div class="panel-body">  
133 -  
134 - </div>  
135 - </div>  
136 -{% endblock rightbar %}  
forum/tests/test_model_answer.py
@@ -2,7 +2,7 @@ from django.test import TestCase @@ -2,7 +2,7 @@ from django.test import TestCase
2 from rolepermissions.shortcuts import assign_role 2 from rolepermissions.shortcuts import assign_role
3 3
4 from users.models import User 4 from users.models import User
5 -from courses.models import Category, Course, Subject, Topic 5 +from courses.models import CourseCategory, Course, Subject, Topic
6 from forum.models import Forum, Post, PostAnswer 6 from forum.models import Forum, Post, PostAnswer
7 7
8 class PostAnswerTestCase (TestCase): 8 class PostAnswerTestCase (TestCase):
@@ -28,9 +28,9 @@ class PostAnswerTestCase (TestCase): @@ -28,9 +28,9 @@ class PostAnswerTestCase (TestCase):
28 ) 28 )
29 assign_role(self.user_student, 'student') 29 assign_role(self.user_student, 'student')
30 30
31 - self.category = Category.objects.create( 31 + self.category = CourseCategory.objects.create(
32 name = 'Categoria Teste', 32 name = 'Categoria Teste',
33 - slug = 'categoria_teste' 33 + create_date='2016-10-07',
34 ) 34 )
35 self.category.save() 35 self.category.save()
36 36
forum/tests/test_model_forum.py
@@ -3,7 +3,7 @@ from django.core.urlresolvers import reverse @@ -3,7 +3,7 @@ from django.core.urlresolvers import reverse
3 from rolepermissions.shortcuts import assign_role 3 from rolepermissions.shortcuts import assign_role
4 4
5 from users.models import User 5 from users.models import User
6 -from courses.models import Category, Course, Subject, Topic 6 +from courses.models import CourseCategory, Course, Subject, Topic
7 from forum.models import Forum 7 from forum.models import Forum
8 8
9 class ForumTestCase (TestCase): 9 class ForumTestCase (TestCase):
@@ -29,9 +29,9 @@ class ForumTestCase (TestCase): @@ -29,9 +29,9 @@ class ForumTestCase (TestCase):
29 ) 29 )
30 assign_role(self.user_student, 'student') 30 assign_role(self.user_student, 'student')
31 31
32 - self.category = Category.objects.create( 32 + self.category = CourseCategory.objects.create(
33 name = 'Categoria Teste', 33 name = 'Categoria Teste',
34 - slug = 'categoria_teste' 34 + create_date='2016-10-07',
35 ) 35 )
36 self.category.save() 36 self.category.save()
37 37
forum/tests/test_model_post.py
@@ -2,7 +2,7 @@ from django.test import TestCase @@ -2,7 +2,7 @@ from django.test import TestCase
2 from rolepermissions.shortcuts import assign_role 2 from rolepermissions.shortcuts import assign_role
3 3
4 from users.models import User 4 from users.models import User
5 -from courses.models import Category, Course, Subject, Topic 5 +from courses.models import CourseCategory, Course, Subject, Topic
6 from forum.models import Forum, Post 6 from forum.models import Forum, Post
7 7
8 class PostTestCase (TestCase): 8 class PostTestCase (TestCase):
@@ -28,9 +28,9 @@ class PostTestCase (TestCase): @@ -28,9 +28,9 @@ class PostTestCase (TestCase):
28 ) 28 )
29 assign_role(self.user_student, 'student') 29 assign_role(self.user_student, 'student')
30 30
31 - self.category = Category.objects.create( 31 + self.category = CourseCategory.objects.create(
32 name = 'Categoria Teste', 32 name = 'Categoria Teste',
33 - slug = 'categoria_teste' 33 + create_date='2016-10-07',
34 ) 34 )
35 self.category.save() 35 self.category.save()
36 36
links/forms.py
1 from django import forms 1 from django import forms
2 from .models import Link 2 from .models import Link
  3 +import validators
3 4
4 class CreateLinkForm(forms.ModelForm): 5 class CreateLinkForm(forms.ModelForm):
  6 + def validate_link(self,link):
  7 + if not validators.url(link):
  8 + raise forms.ValidationError(_('Please enter a valid URL'))
  9 + else:
  10 + return link
  11 +
5 class Meta: 12 class Meta:
6 model = Link 13 model = Link
7 fields = ['name','link','description'] 14 fields = ['name','link','description']
8 - 15 +
9 class UpdateLinkForm(forms.ModelForm): 16 class UpdateLinkForm(forms.ModelForm):
10 class Meta: 17 class Meta:
11 model = Link 18 model = Link
links/tests.py
1 -from django.test import TestCase 1 +from django.test import TestCase,Client
  2 +from django.core.urlresolvers import reverse
  3 +from rolepermissions.shortcuts import assign_role
  4 +
  5 +from users.models import User
  6 +from .models import *
2 7
3 # Create your tests here. 8 # Create your tests here.
  9 +class LinkTestCase(TestCase):
  10 + def setUp(self):
  11 + self.client = Client()
  12 + self.user = User.objects.create_user(
  13 + username = 'test',
  14 + email = 'testing@amadeus.com',
  15 + is_staff = True,
  16 + is_active = True,
  17 + password = 'testing'
  18 + )
  19 + assign_role(self.user, 'system_admin')
  20 + def test_create_link(self):
  21 + self.client.login(username='user', password = 'testing')
  22 + links = Link.objects.all().count()
  23 + self.assertEqual(Link.objects.all().count(),links) #Before creating the link
  24 + self.link = Link.objects.create(
  25 + name = 'testinglink',
  26 + description = 'testdescription',
  27 + link = 'teste.com'
  28 + )
  29 + self.assertEqual(Link.objects.all().count(),links+1) #After creating one link, if OK, the link was created successfully.
  30 + # def test_update_link():
  31 + # pass
  32 + # def test_delete_link():
  33 + # pass
links/urls.py 0 → 100644
@@ -0,0 +1,6 @@ @@ -0,0 +1,6 @@
  1 +from django.conf.urls import url, include
  2 +from . import views
  3 +
  4 +urlpatterns = [
  5 + url(r'^$', views.CreateLink.as_view(), name='teste')
  6 +]
requirements.txt
1 click==6.6 1 click==6.6
  2 +decorator==4.0.10
2 deps==0.1.0 3 deps==0.1.0
3 dj-database-url==0.4.1 4 dj-database-url==0.4.1
4 Django==1.10 5 Django==1.10
@@ -19,5 +20,6 @@ psycopg2==2.6.2 @@ -19,5 +20,6 @@ psycopg2==2.6.2
19 pycpfcnpj==1.0.2 20 pycpfcnpj==1.0.2
20 six==1.10.0 21 six==1.10.0
21 slugify==0.0.1 22 slugify==0.0.1
  23 +validators==0.11.0
22 virtualenv==15.0.3 24 virtualenv==15.0.3
23 Werkzeug==0.11.11 25 Werkzeug==0.11.11
users/templates/list_users.html
@@ -103,5 +103,3 @@ @@ -103,5 +103,3 @@
103 {% endif %} 103 {% endif %}
104 {% endblock %} 104 {% endblock %}
105 105
106 -{% block rightbar %}  
107 -{% endblock rightbar %}