Commit 99b13384069ef4a37ed0862de38f757c289f31e3
Exists in
master
and in
5 other branches
Register user
Showing
32 changed files
with
1835 additions
and
490 deletions
Show diff stats
amadeus/settings.py
1 | - | |
2 | -""" | |
3 | -Django settings for amadeus project. | |
4 | - | |
5 | -Generated by 'django-admin startproject' using Django 1.9.7. | |
6 | - | |
7 | -For more information on this file, see | |
8 | -https://docs.djangoproject.com/en/1.9/topics/settings/ | |
9 | - | |
10 | -For the full list of settings and their values, see | |
11 | -https://docs.djangoproject.com/en/1.9/ref/settings/ | |
12 | -""" | |
13 | - | |
14 | -import os | |
15 | - | |
16 | -# Build paths inside the project like this: os.path.join(BASE_DIR, ...) | |
17 | -BASE_DIR = os.path.dirname(os.path.dirname(os.path.abspath(__file__))) | |
18 | - | |
19 | - | |
20 | -# Quick-start development settings - unsuitable for production | |
21 | -# See https://docs.djangoproject.com/en/1.9/howto/deployment/checklist/ | |
22 | - | |
23 | -# SECURITY WARNING: keep the secret key used in production secret! | |
24 | -SECRET_KEY = '$=8)c!5)iha85a&8q4+kv1pyg0yl7_xe_x^z=2cn_1d7r0hny4' | |
25 | - | |
26 | -# SECURITY WARNING: don't run with debug turned on in production! | |
27 | -DEBUG = True | |
28 | - | |
29 | -ALLOWED_HOSTS = [] | |
30 | - | |
31 | - | |
32 | -# Application definition | |
33 | - | |
34 | -INSTALLED_APPS = [ | |
35 | - 'django.contrib.admin', | |
36 | - 'django.contrib.auth', | |
37 | - 'django.contrib.contenttypes', | |
38 | - 'django.contrib.sessions', | |
39 | - 'django.contrib.messages', | |
40 | - 'django.contrib.staticfiles', | |
41 | - | |
42 | - 'widget_tweaks', | |
43 | - 'rolepermissions', | |
44 | - 'rest_framework', | |
45 | - | |
46 | - 'core', | |
47 | - 'app', | |
48 | - 'courses', | |
49 | - 'users', | |
50 | -] | |
51 | - | |
52 | -MIDDLEWARE_CLASSES = [ | |
53 | - 'django.middleware.security.SecurityMiddleware', | |
54 | - 'django.contrib.sessions.middleware.SessionMiddleware', | |
55 | - 'django.middleware.common.CommonMiddleware', | |
56 | - 'django.middleware.csrf.CsrfViewMiddleware', | |
57 | - 'django.contrib.auth.middleware.AuthenticationMiddleware', | |
58 | - 'django.contrib.auth.middleware.SessionAuthenticationMiddleware', | |
59 | - 'django.contrib.messages.middleware.MessageMiddleware', | |
60 | - 'django.middleware.clickjacking.XFrameOptionsMiddleware', | |
61 | - 'django.middleware.locale.LocaleMiddleware', | |
62 | -] | |
63 | - | |
64 | -ROOT_URLCONF = 'amadeus.urls' | |
65 | - | |
66 | -TEMPLATES = [ | |
67 | - { | |
68 | - 'BACKEND': 'django.template.backends.django.DjangoTemplates', | |
69 | - 'DIRS': [], | |
70 | - 'APP_DIRS': True, | |
71 | - 'OPTIONS': { | |
72 | - 'context_processors': [ | |
73 | - 'django.template.context_processors.debug', | |
74 | - 'django.template.context_processors.request', | |
75 | - 'django.contrib.auth.context_processors.auth', | |
76 | - 'django.contrib.messages.context_processors.messages', | |
77 | - ], | |
78 | - }, | |
79 | - }, | |
80 | -] | |
81 | - | |
82 | -WSGI_APPLICATION = 'amadeus.wsgi.application' | |
83 | - | |
84 | - | |
85 | -# Database | |
86 | -# https://docs.djangopr/*oject.com/en/1.9/ref/settings/#databases | |
87 | - | |
88 | -DATABASES = { | |
89 | - 'default': { | |
90 | - 'ENGINE': 'django.db.backends.postgresql', | |
91 | - 'NAME': 'amadeus', | |
92 | - 'USER': 'amadeus_admin', | |
93 | - 'PASSWORD': 'amadeus', | |
94 | - 'HOST': '127.0.0.1', | |
95 | - 'PORT': '5432', | |
96 | - } | |
97 | -} | |
98 | - | |
99 | - | |
100 | -#superuser: admin pass: amadeus2358 | |
101 | - | |
102 | -# Password validation | |
103 | -# https://docs.djangoproject.com/en/1.9/ref/settings/#auth-password-validators | |
104 | - | |
105 | -AUTH_PASSWORD_VALIDATORS = [ | |
106 | - { | |
107 | - 'NAME': 'django.contrib.auth.password_validation.UserAttributeSimilarityValidator', | |
108 | - }, | |
109 | - { | |
110 | - 'NAME': 'django.contrib.auth.password_validation.MinimumLengthValidator', | |
111 | - }, | |
112 | - { | |
113 | - 'NAME': 'django.contrib.auth.password_validation.CommonPasswordValidator', | |
114 | - }, | |
115 | - { | |
116 | - 'NAME': 'django.contrib.auth.password_validation.NumericPasswordValidator', | |
117 | - }, | |
118 | -] | |
119 | - | |
120 | - | |
121 | -# Internationalization | |
122 | -# https://docs.djangoproject.com/en/1.9/topics/i18n/ | |
123 | - | |
124 | -LANGUAGE_CODE = 'pt-br' | |
125 | - | |
126 | -TIME_ZONE = 'America/Recife' | |
127 | - | |
128 | -USE_I18N = True | |
129 | - | |
130 | -USE_L10N = True | |
131 | - | |
132 | -USE_TZ = True | |
133 | - | |
134 | - | |
135 | -# Static files (CSS, JavaScript, Images) | |
136 | -# https://docs.djangoproject.com/en/1.9/howto/static-files/ | |
137 | - | |
138 | -STATIC_URL = '/static/' | |
139 | - | |
140 | -# Files | |
141 | -MEDIA_ROOT = os.path.join(os.path.dirname(BASE_DIR), 'uploads') | |
142 | -MEDIA_URL = '/uploads/' | |
143 | - | |
144 | -# Users | |
145 | -LOGIN_REDIRECT_URL = 'app:index' | |
146 | -LOGIN_URL = 'home' | |
147 | -AUTH_USER_MODEL = 'users.User' | |
148 | -AUTHENTICATION_BACKENDS = [ | |
149 | - 'django.contrib.auth.backends.ModelBackend', | |
150 | -] | |
151 | -ROLEPERMISSIONS_MODULE = 'amadeus.roles' | |
152 | - | |
153 | - | |
154 | -#https://github.com/squ1b3r/Djaneiro | |
155 | 1 | \ No newline at end of file |
2 | +""" | |
3 | +Django settings for amadeus project. | |
4 | + | |
5 | +Generated by 'django-admin startproject' using Django 1.9.7. | |
6 | + | |
7 | +For more information on this file, see | |
8 | +https://docs.djangoproject.com/en/1.9/topics/settings/ | |
9 | + | |
10 | +For the full list of settings and their values, see | |
11 | +https://docs.djangoproject.com/en/1.9/ref/settings/ | |
12 | +""" | |
13 | + | |
14 | +import os | |
15 | + | |
16 | +# Build paths inside the project like this: os.path.join(BASE_DIR, ...) | |
17 | +BASE_DIR = os.path.dirname(os.path.dirname(os.path.abspath(__file__))) | |
18 | + | |
19 | + | |
20 | +# Quick-start development settings - unsuitable for production | |
21 | +# See https://docs.djangoproject.com/en/1.9/howto/deployment/checklist/ | |
22 | + | |
23 | +# SECURITY WARNING: keep the secret key used in production secret! | |
24 | +SECRET_KEY = '$=8)c!5)iha85a&8q4+kv1pyg0yl7_xe_x^z=2cn_1d7r0hny4' | |
25 | + | |
26 | +# SECURITY WARNING: don't run with debug turned on in production! | |
27 | +DEBUG = True | |
28 | + | |
29 | +ALLOWED_HOSTS = [] | |
30 | + | |
31 | + | |
32 | +# Application definition | |
33 | + | |
34 | +INSTALLED_APPS = [ | |
35 | + 'django.contrib.admin', | |
36 | + 'django.contrib.auth', | |
37 | + 'django.contrib.contenttypes', | |
38 | + 'django.contrib.sessions', | |
39 | + 'django.contrib.messages', | |
40 | + 'django.contrib.staticfiles', | |
41 | + | |
42 | + 'widget_tweaks', | |
43 | + 'rolepermissions', | |
44 | + 'rest_framework', | |
45 | + | |
46 | + 'core', | |
47 | + 'app', | |
48 | + 'courses', | |
49 | + 'users', | |
50 | +] | |
51 | + | |
52 | +MIDDLEWARE_CLASSES = [ | |
53 | + 'django.middleware.security.SecurityMiddleware', | |
54 | + 'django.contrib.sessions.middleware.SessionMiddleware', | |
55 | + 'django.middleware.common.CommonMiddleware', | |
56 | + 'django.middleware.csrf.CsrfViewMiddleware', | |
57 | + 'django.contrib.auth.middleware.AuthenticationMiddleware', | |
58 | + 'django.contrib.auth.middleware.SessionAuthenticationMiddleware', | |
59 | + 'django.contrib.messages.middleware.MessageMiddleware', | |
60 | + 'django.middleware.clickjacking.XFrameOptionsMiddleware', | |
61 | + 'django.middleware.locale.LocaleMiddleware', | |
62 | +] | |
63 | + | |
64 | +ROOT_URLCONF = 'amadeus.urls' | |
65 | + | |
66 | +TEMPLATES = [ | |
67 | + { | |
68 | + 'BACKEND': 'django.template.backends.django.DjangoTemplates', | |
69 | + 'DIRS': [], | |
70 | + 'APP_DIRS': True, | |
71 | + 'OPTIONS': { | |
72 | + 'context_processors': [ | |
73 | + 'django.template.context_processors.debug', | |
74 | + 'django.template.context_processors.request', | |
75 | + 'django.contrib.auth.context_processors.auth', | |
76 | + 'django.contrib.messages.context_processors.messages', | |
77 | + ], | |
78 | + }, | |
79 | + }, | |
80 | +] | |
81 | + | |
82 | +WSGI_APPLICATION = 'amadeus.wsgi.application' | |
83 | + | |
84 | + | |
85 | +# Database | |
86 | +# https://docs.djangopr/*oject.com/en/1.9/ref/settings/#databases | |
87 | + | |
88 | +DATABASES = { | |
89 | + 'default': { | |
90 | + 'ENGINE': 'django.db.backends.postgresql', | |
91 | + 'NAME': 'amadeus', | |
92 | + 'USER': 'amadeus_admin', | |
93 | + 'PASSWORD': 'amadeus', | |
94 | + 'HOST': '127.0.0.1', | |
95 | + 'PORT': '5432', | |
96 | + } | |
97 | +} | |
98 | + | |
99 | +# DATABASES = { | |
100 | +# 'default': { | |
101 | +# 'ENGINE': 'django.db.backends.sqlite3', | |
102 | +# 'NAME': os.path.join(BASE_DIR, 'db.sqlite3'), | |
103 | +# } | |
104 | +# } | |
105 | + | |
106 | +#superuser: admin pass: amadeus2358 | |
107 | + | |
108 | +# Password validation | |
109 | +# https://docs.djangoproject.com/en/1.9/ref/settings/#auth-password-validators | |
110 | + | |
111 | +AUTH_PASSWORD_VALIDATORS = [ | |
112 | + { | |
113 | + 'NAME': 'django.contrib.auth.password_validation.UserAttributeSimilarityValidator', | |
114 | + }, | |
115 | + { | |
116 | + 'NAME': 'django.contrib.auth.password_validation.MinimumLengthValidator', | |
117 | + }, | |
118 | + { | |
119 | + 'NAME': 'django.contrib.auth.password_validation.CommonPasswordValidator', | |
120 | + }, | |
121 | + { | |
122 | + 'NAME': 'django.contrib.auth.password_validation.NumericPasswordValidator', | |
123 | + }, | |
124 | +] | |
125 | + | |
126 | + | |
127 | +# Internationalization | |
128 | +# https://docs.djangoproject.com/en/1.9/topics/i18n/ | |
129 | + | |
130 | +LANGUAGE_CODE = 'pt-br' | |
131 | + | |
132 | +TIME_ZONE = 'America/Recife' | |
133 | + | |
134 | +USE_I18N = True | |
135 | + | |
136 | +USE_L10N = True | |
137 | + | |
138 | +USE_TZ = True | |
139 | + | |
140 | + | |
141 | +# Static files (CSS, JavaScript, Images) | |
142 | +# https://docs.djangoproject.com/en/1.9/howto/static-files/ | |
143 | + | |
144 | +STATIC_URL = '/static/' | |
145 | + | |
146 | +# Files | |
147 | +MEDIA_ROOT = os.path.join(os.path.dirname(BASE_DIR), 'uploads') | |
148 | +MEDIA_URL = '/uploads/' | |
149 | + | |
150 | +# Users | |
151 | +LOGIN_REDIRECT_URL = 'app:index' | |
152 | +LOGIN_URL = 'core:home' | |
153 | +AUTH_USER_MODEL = 'users.User' | |
154 | +AUTHENTICATION_BACKENDS = [ | |
155 | + 'django.contrib.auth.backends.ModelBackend', | |
156 | +] | |
157 | +ROLEPERMISSIONS_MODULE = 'amadeus.roles' | |
158 | + | |
159 | +LOGS_URL = 'logs/' | |
160 | +#https://github.com/squ1b3r/Djaneiro | ... | ... |
app/locale/pt_BR/LC_MESSAGES/django.po
1 | +<<<<<<< HEAD | |
1 | 2 | # SOME DESCRIPTIVE TITLE. |
2 | 3 | # Copyright (C) YEAR THE PACKAGE'S COPYRIGHT HOLDER |
3 | 4 | # This file is distributed under the same license as the PACKAGE package. |
... | ... | @@ -128,3 +129,168 @@ msgstr "Metas" |
128 | 129 | |
129 | 130 | #~ msgid "Amadeus" |
130 | 131 | #~ msgstr "Amadeus" |
132 | +======= | |
133 | +# SOME DESCRIPTIVE TITLE. | |
134 | +# Copyright (C) YEAR THE PACKAGE'S COPYRIGHT HOLDER | |
135 | +# This file is distributed under the same license as the PACKAGE package. | |
136 | +# FIRST AUTHOR <EMAIL@ADDRESS>, YEAR. | |
137 | +# | |
138 | +#, fuzzy | |
139 | +msgid "" | |
140 | +msgstr "" | |
141 | +"Project-Id-Version: PACKAGE VERSION\n" | |
142 | +"Report-Msgid-Bugs-To: \n" | |
143 | +"POT-Creation-Date: 2016-09-03 00:18-0300\n" | |
144 | +"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" | |
145 | +"Last-Translator: FULL NAME <EMAIL@ADDRESS>\n" | |
146 | +"Language-Team: LANGUAGE <LL@li.org>\n" | |
147 | +"Language: \n" | |
148 | +"MIME-Version: 1.0\n" | |
149 | +"Content-Type: text/plain; charset=UTF-8\n" | |
150 | +"Content-Transfer-Encoding: 8bit\n" | |
151 | +"Plural-Forms: nplurals=2; plural=(n > 1);\n" | |
152 | + | |
153 | +#: app/templates/app/base.html:10 | |
154 | +msgid "The Project" | |
155 | +msgstr "" | |
156 | + | |
157 | +#: app/templates/app/base.html:11 | |
158 | +msgid "CCTE Group" | |
159 | +msgstr "" | |
160 | + | |
161 | +#: app/templates/app/base.html:14 | |
162 | +msgid "Hi" | |
163 | +msgstr "" | |
164 | + | |
165 | +#: app/templates/app/base.html:16 | |
166 | +#, fuzzy | |
167 | +#| msgid "Profile" | |
168 | +msgid "See Profile" | |
169 | +msgstr "Perfil" | |
170 | + | |
171 | +#: app/templates/app/base.html:17 | |
172 | +msgid "Settings" | |
173 | +msgstr "Configurações" | |
174 | + | |
175 | +#: app/templates/app/base.html:18 | |
176 | +msgid "Logout" | |
177 | +msgstr "Sair" | |
178 | + | |
179 | +#: app/templates/app/index.html:6 | |
180 | +msgid "You have:" | |
181 | +msgstr "" | |
182 | + | |
183 | +#: app/templates/app/index.html:10 | |
184 | +#, fuzzy | |
185 | +#| msgid "Pending tasks" | |
186 | +msgid "Pending Tasks" | |
187 | +msgstr "Tarefas Pendentes" | |
188 | + | |
189 | +#: app/templates/app/index.html:14 | |
190 | +msgid "Users Online" | |
191 | +msgstr "Usuários Online" | |
192 | + | |
193 | +#: app/templates/app/index.html:20 | |
194 | +msgid "You can:" | |
195 | +msgstr "" | |
196 | + | |
197 | +#: app/templates/app/index.html:24 app/templates/home_professor.html:23 | |
198 | +msgid "Create Course" | |
199 | +msgstr "Criar Curso" | |
200 | + | |
201 | +#: app/templates/app/index.html:29 | |
202 | +#, fuzzy | |
203 | +#| msgid "Manage Course" | |
204 | +msgid "Manage Users" | |
205 | +msgstr "Gerenciar Curso" | |
206 | + | |
207 | +#: app/templates/app/index.html:33 | |
208 | +#, fuzzy | |
209 | +#| msgid "Manage Course" | |
210 | +msgid "Manage Courses" | |
211 | +msgstr "Gerenciar Curso" | |
212 | + | |
213 | +#: app/templates/app/index.html:37 | |
214 | +msgid "Gerenciar Categorias" | |
215 | +msgstr "" | |
216 | + | |
217 | +#: app/templates/app/index.html:45 | |
218 | +msgid "Your course(s):" | |
219 | +msgstr "" | |
220 | + | |
221 | +#: app/templates/app/index.html:46 | |
222 | +msgid "No courses subscribed yet" | |
223 | +msgstr "" | |
224 | + | |
225 | +#: app/templates/app/index.html:56 | |
226 | +msgid "Search course:" | |
227 | +msgstr "" | |
228 | + | |
229 | +#: app/templates/app/index.html:62 | |
230 | +msgid "Search" | |
231 | +msgstr "" | |
232 | + | |
233 | +#: app/templates/app/index.html:67 | |
234 | +msgid "Most popular keywords:" | |
235 | +msgstr "" | |
236 | + | |
237 | +#: app/templates/home_professor.html:9 app/templates/home_student.html:9 | |
238 | +msgid "Home" | |
239 | +msgstr "Início" | |
240 | + | |
241 | +#: app/templates/home_professor.html:18 app/templates/home_student.html:18 | |
242 | +msgid "Menu" | |
243 | +msgstr "Menu" | |
244 | + | |
245 | +#: app/templates/home_professor.html:22 | |
246 | +msgid "Pending tasks" | |
247 | +msgstr "Tarefas Pendentes" | |
248 | + | |
249 | +#: app/templates/home_professor.html:24 | |
250 | +msgid "Manage Course" | |
251 | +msgstr "Gerenciar Curso" | |
252 | + | |
253 | +#: app/templates/home_professor.html:31 | |
254 | +msgid "Courses" | |
255 | +msgstr "Cursos" | |
256 | + | |
257 | +#: app/templates/home_professor.html:40 | |
258 | +msgid "Students:" | |
259 | +msgstr "Alunos" | |
260 | + | |
261 | +#: app/templates/home_professor.html:41 | |
262 | +msgid "Beginning:" | |
263 | +msgstr "Começo" | |
264 | + | |
265 | +#: app/templates/home_professor.html:42 | |
266 | +msgid "End:" | |
267 | +msgstr "Fim" | |
268 | + | |
269 | +#: app/templates/home_professor.html:48 | |
270 | +msgid "You didn't create any course yet." | |
271 | +msgstr "Você não criou nenhum curso ainda." | |
272 | + | |
273 | +#: app/templates/home_professor.html:54 app/templates/home_student.html:60 | |
274 | +msgid "Goals" | |
275 | +msgstr "Metas" | |
276 | + | |
277 | +#: app/templates/home_student.html:22 | |
278 | +msgid "Profile" | |
279 | +msgstr "Perfil" | |
280 | + | |
281 | +#: app/templates/home_student.html:23 | |
282 | +msgid "My Courses" | |
283 | +msgstr "Meus Cursos" | |
284 | + | |
285 | +#: app/templates/home_student.html:24 | |
286 | +msgid "Google accounts" | |
287 | +msgstr "Contas do Google" | |
288 | + | |
289 | +#: app/templates/home_student.html:31 | |
290 | +msgid "Notifications" | |
291 | +msgstr "Notificações" | |
292 | + | |
293 | +#: app/templates/home_student.html:63 | |
294 | +msgid "Favorites" | |
295 | +msgstr "Favoritos" | |
296 | +>>>>>>> 6adb9412b8b77c81ef8cc33a0b481885dadb6012 | ... | ... |
app/templates/app/index.html
... | ... | @@ -20,20 +20,20 @@ |
20 | 20 | <h4>{% trans 'You can:' %} </h4> |
21 | 21 | <div class="list-group"> |
22 | 22 | {% if user|has_role:'professor' %} |
23 | - <a href="{% url 'app:course:create' %}" class="list-group-item"> | |
23 | + <a href="{% url 'course:create' %}" class="list-group-item"> | |
24 | 24 | {% trans 'Create Course' %} |
25 | 25 | </a> |
26 | 26 | {% endif %} |
27 | 27 | {% if user|has_role:'professor' %} |
28 | - <a href="{% url 'app:users:manage' %}" class="list-group-item"> | |
28 | + <a href="{% url 'users:manage' %}" class="list-group-item"> | |
29 | 29 | {% trans 'Manage Users' %} |
30 | 30 | </a> |
31 | 31 | {% endif %} |
32 | - <a href="{% url 'app:course:manage' %}" class="list-group-item"> | |
32 | + <a href="{% url 'course:manage' %}" class="list-group-item"> | |
33 | 33 | {% trans 'Manage Courses' %} |
34 | 34 | </a> |
35 | 35 | {% if user|has_role:'professor' %} |
36 | - <a href="{% url 'app:course:manage_cat' %}" class="list-group-item"> | |
36 | + <a href="{% url 'course:manage_cat' %}" class="list-group-item"> | |
37 | 37 | {% trans 'Gerenciar Categorias' %} |
38 | 38 | </a> |
39 | 39 | {% endif %} |
... | ... | @@ -178,4 +178,4 @@ |
178 | 178 | </div> |
179 | 179 | </div> |
180 | 180 | </div> |
181 | -{% endblock %} | |
182 | 181 | \ No newline at end of file |
182 | +{% endblock %} | ... | ... |
... | ... | @@ -0,0 +1,56 @@ |
1 | +{% extends 'base.html' %} | |
2 | + | |
3 | +{% load i18n %} | |
4 | + | |
5 | +{% block breadcrumbs %} | |
6 | + <div class="row"> | |
7 | + <div class="col-md-12"> | |
8 | + <ul class="breadcrumb"> | |
9 | + <li><a href="{% url 'core:home' %}">{% trans 'Home' %}</a></li> | |
10 | + </ul> | |
11 | + </div> | |
12 | + </div> | |
13 | +{% endblock %} | |
14 | + | |
15 | +{% block sidebar %} | |
16 | + <div class="panel panel-primary navigation"> | |
17 | + <div class="panel-heading"> | |
18 | + <h5>{% trans 'Menu' %}</h5> | |
19 | + </div> | |
20 | + <div class="panel-body"> | |
21 | + <ul class="nav nav-pills nav-stacked"> | |
22 | + <li><a href="javascript:void(0)">{% trans 'Pending tasks' %}</a></li> | |
23 | + <li><a href="{% url 'course:create' %}">{% trans 'Create Course' %}</a></li> | |
24 | + <li><a href="{% url 'course:manage' %}">{% trans 'Manage Course' %}</a></li> | |
25 | + </ul> | |
26 | + </div> | |
27 | + </div> | |
28 | +{% endblock %} | |
29 | + | |
30 | +{% block content %} | |
31 | + <h3>{% trans 'Courses' %}</h3> | |
32 | + {% if courses|length > 0 %} | |
33 | + {% for course in courses %} | |
34 | + <div class="panel panel-default courseHome"> | |
35 | + <div class="panel-body"> | |
36 | + <p>{{ course }}</p> | |
37 | + </div> | |
38 | + <div class="panel-footer"> | |
39 | + <ul> | |
40 | + <li>{% trans 'Students:' %} 5</li> | |
41 | + <li>{% trans 'Beginning:' %} {{ course.init_date }}</li> | |
42 | + <li>{% trans 'End:' %} {{ course.end_date }}</li> | |
43 | + </ul> | |
44 | + </div> | |
45 | + </div> | |
46 | + {% endfor %} | |
47 | + {% else %} | |
48 | + <p>{% trans "You didn't create any course yet." %}</p> | |
49 | + {% endif %} | |
50 | +{% endblock %} | |
51 | + | |
52 | +{% block rightbar %} | |
53 | + <div class="well well-lg goal"> | |
54 | + {% trans 'Goals' %} | |
55 | + </div> | |
56 | +{% endblock rightbar %} | ... | ... |
... | ... | @@ -0,0 +1,65 @@ |
1 | +{% extends 'base.html' %} | |
2 | + | |
3 | +{% load i18n %} | |
4 | + | |
5 | +{% block breadcrumbs %} | |
6 | + <div class="row"> | |
7 | + <div class="col-md-12"> | |
8 | + <ul class="breadcrumb"> | |
9 | + <li><a href="{% url 'core:home' %}">{% trans 'Home' %} {{ logged }}</a></li> | |
10 | + </ul> | |
11 | + </div> | |
12 | + </div> | |
13 | +{% endblock %} | |
14 | + | |
15 | +{% block sidebar %} | |
16 | + <div class="panel panel-primary navigation"> | |
17 | + <div class="panel-heading"> | |
18 | + <h5>{% trans 'Menu' %}</h5> | |
19 | + </div> | |
20 | + <div class="panel-body"> | |
21 | + <ul class="nav nav-pills nav-stacked"> | |
22 | + <li><a href="{% url 'users:profile' %}">{% trans 'Profile' %}</a></li> | |
23 | + <li><a href="javascript:void(0)">{% trans 'My Courses' %}</a></li> | |
24 | + <li><a href="javascript:void(0)">{% trans 'Google accounts' %}</a></li> | |
25 | + </ul> | |
26 | + </div> | |
27 | + </div> | |
28 | +{% endblock %} | |
29 | + | |
30 | +{% block content %} | |
31 | + <h3>{% trans 'Notifications' %}</h3> | |
32 | + <div class="panel panel-default"> | |
33 | + <div class="panel-body"> | |
34 | + His course has notified a new activity! | |
35 | + </div> | |
36 | + <div class="panel-footer"> | |
37 | + Go | |
38 | + </div> | |
39 | + </div> | |
40 | + <div class="panel panel-default"> | |
41 | + <div class="panel-body"> | |
42 | + His teacher has notified a new material! | |
43 | + </div> | |
44 | + <div class="panel-footer"> | |
45 | + Go | |
46 | + </div> | |
47 | + </div> | |
48 | + <div class="panel panel-default"> | |
49 | + <div class="panel-body"> | |
50 | + You have a new guardian! | |
51 | + </div> | |
52 | + <div class="panel-footer"> | |
53 | + Go | |
54 | + </div> | |
55 | + </div> | |
56 | +{% endblock %} | |
57 | + | |
58 | +{% block rightbar %} | |
59 | + <div class="well well-lg goal"> | |
60 | + {% trans 'Goals' %} | |
61 | + </div> | |
62 | + <div class="well well-lg favorites"> | |
63 | + {% trans 'Favorites' %} | |
64 | + </div> | |
65 | +{% endblock rightbar %} | ... | ... |
app/urls.py
app/views.py
1 | 1 | from django.shortcuts import render |
2 | -from django.contrib.auth.decorators import login_required | |
2 | +from django.views.generic import TemplateView | |
3 | +from django.contrib.auth.mixins import LoginRequiredMixin | |
4 | +from django.utils.decorators import decorator_from_middleware_with_args | |
5 | +from django.utils.decorators import decorator_from_middleware | |
6 | +from django.utils.decorators import method_decorator | |
7 | +from core.mixins import LogMixin | |
3 | 8 | |
4 | 9 | from courses.models import Course |
5 | 10 | |
6 | -@login_required | |
7 | -def index(request): | |
8 | - context = {} | |
11 | +class AppIndex(LoginRequiredMixin, LogMixin, TemplateView): | |
12 | + log_action = "Acessou home" | |
13 | + template_name = "home_professor.html" | |
9 | 14 | |
10 | - context['courses'] = Course.objects.filter(user = request.user) | |
15 | + def render_to_response(self, context, **response_kwargs): | |
16 | + context = {} | |
11 | 17 | |
12 | - return render(request, "home_app.html", context) | |
13 | 18 | \ No newline at end of file |
19 | + if self.request.user.type_profile == 2: | |
20 | + template = "home_student.html" | |
21 | + context['courses'] = Course.objects.filter(user = self.request.user) | |
22 | + else: | |
23 | + template = self.get_template_names() | |
24 | + context['courses'] = Course.objects.filter(user = self.request.user) | |
25 | + | |
26 | + context['title'] = 'Amadeus' | |
27 | + | |
28 | + return self.response_class(request = self.request, template = template, context = context, using = self.template_engine, **response_kwargs) | |
14 | 29 | \ No newline at end of file | ... | ... |
... | ... | @@ -0,0 +1,31 @@ |
1 | +import os | |
2 | +import datetime | |
3 | +from django.conf import settings | |
4 | +from functools import wraps | |
5 | + | |
6 | +def log_decorator(log_action = ''): | |
7 | + | |
8 | + def _log_decorator(view_function): | |
9 | + | |
10 | + def _decorator(request, *args, **kwargs): | |
11 | + | |
12 | + response = view_function(request, *args, **kwargs) | |
13 | + | |
14 | + if request.user.is_authenticated and request.POST: | |
15 | + date = datetime.datetime.now() | |
16 | + | |
17 | + message = date.strftime("%d/%m/%Y %H:%M:%S") + ' - ' + request.user.username + ' - ' + log_action + '\n' | |
18 | + | |
19 | + file_name = 'log_file_' + date.strftime("%d-%m-%Y") + '.txt' | |
20 | + | |
21 | + log_path = os.path.join(settings.LOGS_URL, file_name) | |
22 | + | |
23 | + log_file = open(log_path,'a+') | |
24 | + log_file.write(message) | |
25 | + log_file.close() | |
26 | + | |
27 | + return response | |
28 | + | |
29 | + return wraps(view_function)(_decorator) | |
30 | + | |
31 | + return _log_decorator | |
0 | 32 | \ No newline at end of file | ... | ... |
core/forms.py
... | ... | @@ -2,12 +2,38 @@ from django import forms |
2 | 2 | |
3 | 3 | from users.models import User |
4 | 4 | |
5 | -class CreateUserForm(forms.ModelForm): | |
5 | +class RegisterUserForm(forms.ModelForm): | |
6 | 6 | |
7 | 7 | password = forms.CharField(label='Senha', widget=forms.PasswordInput) |
8 | + password2 = forms.CharField(label = 'Confirmacao de Senha', widget = forms.PasswordInput) | |
9 | + | |
10 | + MIN_LENGTH = 8 | |
11 | + | |
12 | + def clean_password(self): | |
13 | + password = self.cleaned_data.get('password') | |
14 | + | |
15 | + # At least MIN_LENGTH long | |
16 | + if len(password) < self.MIN_LENGTH: | |
17 | + raise forms.ValidationError("A senha deve conter no minimo %d caracteres." % self.MIN_LENGTH) | |
18 | + | |
19 | + # At least one letter and one non-letter | |
20 | + first_isalpha = password[0].isalpha() | |
21 | + if all(c.isalpha() == first_isalpha for c in password): | |
22 | + raise forms.ValidationError("A senha deve conter pelo menos uma letra e pelo menos um digito ou "\ | |
23 | + "um caractere de pontuacao.") | |
24 | + | |
25 | + return password | |
26 | + | |
27 | + def clean_password2(self): | |
28 | + password = self.cleaned_data.get("password") | |
29 | + password2 = self.cleaned_data.get("password2") | |
30 | + | |
31 | + if password and password2 and password != password2: | |
32 | + raise forms.ValidationError('A confirmmacao de senha esta incorreta') | |
33 | + return password2 | |
8 | 34 | |
9 | 35 | def save(self, commit=True): |
10 | - super(CreateUserForm, self).save(commit=False) | |
36 | + super(RegisterUserForm, self).save(commit=False) | |
11 | 37 | self.instance.set_password(self.cleaned_data['password']) |
12 | 38 | |
13 | 39 | self.instance.save() | ... | ... |
core/locale/pt_BR/LC_MESSAGES/django.po
1 | +<<<<<<< HEAD | |
1 | 2 | # SOME DESCRIPTIVE TITLE. |
2 | 3 | # Copyright (C) YEAR THE PACKAGE'S COPYRIGHT HOLDER |
3 | 4 | # This file is distributed under the same license as the PACKAGE package. |
... | ... | @@ -37,3 +38,68 @@ msgstr "" |
37 | 38 | #: core/templates/index.html:52 |
38 | 39 | msgid "Most popular keywords:" |
39 | 40 | msgstr "" |
41 | +======= | |
42 | +# SOME DESCRIPTIVE TITLE. | |
43 | +# Copyright (C) YEAR THE PACKAGE'S COPYRIGHT HOLDER | |
44 | +# This file is distributed under the same license as the PACKAGE package. | |
45 | +# FIRST AUTHOR <EMAIL@ADDRESS>, YEAR. | |
46 | +# | |
47 | +#, fuzzy | |
48 | +msgid "" | |
49 | +msgstr "" | |
50 | +"Project-Id-Version: PACKAGE VERSION\n" | |
51 | +"Report-Msgid-Bugs-To: \n" | |
52 | +"POT-Creation-Date: 2016-09-03 00:18-0300\n" | |
53 | +"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" | |
54 | +"Last-Translator: FULL NAME <EMAIL@ADDRESS>\n" | |
55 | +"Language-Team: LANGUAGE <LL@li.org>\n" | |
56 | +"Language: \n" | |
57 | +"MIME-Version: 1.0\n" | |
58 | +"Content-Type: text/plain; charset=UTF-8\n" | |
59 | +"Content-Transfer-Encoding: 8bit\n" | |
60 | +"Plural-Forms: nplurals=2; plural=(n > 1);\n" | |
61 | + | |
62 | +#: core/templates/base.html:56 | |
63 | +msgid "Log out" | |
64 | +msgstr "Sair" | |
65 | + | |
66 | +#: core/templates/index.html:30 | |
67 | +msgid "Username" | |
68 | +msgstr "Usuário" | |
69 | + | |
70 | +#: core/templates/index.html:36 | |
71 | +msgid "Password" | |
72 | +msgstr "Senha" | |
73 | + | |
74 | +#: core/templates/index.html:44 | |
75 | +msgid "Remember Email" | |
76 | +msgstr "" | |
77 | + | |
78 | +#: core/templates/index.html:53 | |
79 | +msgid "Guest" | |
80 | +msgstr "" | |
81 | + | |
82 | +#: core/templates/index.html:56 | |
83 | +msgid "Login" | |
84 | +msgstr "Entrar" | |
85 | + | |
86 | +#: core/templates/index.html:65 | |
87 | +msgid "Sign Up" | |
88 | +msgstr "Cadastrar" | |
89 | + | |
90 | +#: core/templates/remember_password.html:18 | |
91 | +msgid "E-mail" | |
92 | +msgstr "E-mail" | |
93 | + | |
94 | +#: core/templates/remember_password.html:22 | |
95 | +msgid "Registration" | |
96 | +msgstr "" | |
97 | + | |
98 | +#: core/templates/remember_password.html:26 | |
99 | +msgid "Send" | |
100 | +msgstr "Enviar" | |
101 | + | |
102 | +#: core/views.py:25 | |
103 | +msgid "E-mail or password are incorrect!" | |
104 | +msgstr "O E-mail e/ou a senha estão incorretos" | |
105 | +>>>>>>> 6adb9412b8b77c81ef8cc33a0b481885dadb6012 | ... | ... |
... | ... | @@ -0,0 +1,21 @@ |
1 | +import os | |
2 | +import datetime | |
3 | +from django.conf import settings | |
4 | + | |
5 | +class LogMixin(object): | |
6 | + log_action = "" | |
7 | + | |
8 | + def dispatch(self, request, *args, **kwargs): | |
9 | + date = datetime.datetime.now() | |
10 | + | |
11 | + message = date.strftime("%d/%m/%Y %H:%M:%S") + ' - ' + request.user.username + ' - ' + self.log_action + '\n' | |
12 | + | |
13 | + file_name = 'log_file_' + date.strftime("%d-%m-%Y") + '.txt' | |
14 | + | |
15 | + log_path = os.path.join(settings.LOGS_URL, file_name) | |
16 | + | |
17 | + log_file = open(log_path,'a+') | |
18 | + log_file.write(message) | |
19 | + log_file.close() | |
20 | + | |
21 | + return super(LogMixin, self).dispatch(request, *args, **kwargs) | |
0 | 22 | \ No newline at end of file | ... | ... |
... | ... | @@ -0,0 +1,41 @@ |
1 | +.navigation{ | |
2 | + margin: 10% 10% 5% 5%; | |
3 | +} | |
4 | +.breadcrumb{ | |
5 | + margin-bottom: 5px; | |
6 | +} | |
7 | +.courseHome{ | |
8 | + text-align: center; | |
9 | +} | |
10 | +.courseHome ul{ | |
11 | + list-style-type: none; | |
12 | + margin: 0; | |
13 | + padding: 0; | |
14 | + overflow: hidden; | |
15 | + margin-left: 2%; | |
16 | +} | |
17 | +.courseHome ul li{ | |
18 | + display:inline; | |
19 | + text-align: center; | |
20 | + padding: 16px; | |
21 | +} | |
22 | +.goal{ | |
23 | + margin: 0%; | |
24 | + margin-top: 10%; | |
25 | + padding-bottom: 200px; | |
26 | +} | |
27 | +.favorites{ | |
28 | + margin: 0%; | |
29 | + margin-top: 20%; | |
30 | + padding-bottom: 200px; | |
31 | +} | |
32 | +.panel-info{ | |
33 | + padding-bottom: 50px; | |
34 | +} | |
35 | +h3{ | |
36 | + text-align: center; | |
37 | +} | |
38 | +h5{ | |
39 | + text-align: center; | |
40 | +} | |
41 | + | ... | ... |
core/templates/base.html
... | ... | @@ -11,9 +11,15 @@ |
11 | 11 | <link rel="stylesheet" href="http://fonts.googleapis.com/css?family=Roboto:300,400,500,700" type="text/css"> |
12 | 12 | <link href="https://fonts.googleapis.com/icon?family=Material+Icons" rel="stylesheet"> |
13 | 13 | |
14 | - <link href="{% static 'bootstrap-3.3.7/css/bootstrap.min.css' %}" rel="stylesheet" type="text/css" /> | |
14 | + <link rel="stylesheet" type="text/css" href="{% static 'bootstrap-3.3.7/css/bootstrap.min.css' %}" /> | |
15 | 15 | <link rel="stylesheet" type="text/css" href="{% static 'material/css/bootstrap-material-design.min.css' %}"> |
16 | 16 | <link rel="stylesheet" type="text/css" href="{% static 'material/css/ripples.min.css' %}"> |
17 | + <link rel="stylesheet" type="text/css" href="{% static 'font-awesome-4.6.3/css/font-awesome.min.css' %}"> | |
18 | + <link rel="stylesheet" type="text/css" href="{% static 'css/base/header.css' %}"> | |
19 | + <link rel="stylesheet" type="text/css" href="{% static 'css/base/amadeus.css' %}"> | |
20 | + <script> | |
21 | + $.material.init(); | |
22 | + </script> | |
17 | 23 | <!--CSS block for specific-app ones --> |
18 | 24 | {% block style %} |
19 | 25 | {% endblock %} |
... | ... | @@ -31,28 +37,36 @@ |
31 | 37 | </head> |
32 | 38 | <body> |
33 | 39 | {% block nav %} |
34 | - <div class="bs-component"> | |
35 | - <div class="navbar navbar-default"> | |
36 | - <div class="container-fluid"> | |
37 | - <div class="navbar-header"> | |
38 | - <button type="button" class="navbar-toggle" data-toggle="collapse" data-target=".navbar-responsive-collapse"> | |
39 | - <span class="icon-bar"></span> | |
40 | - <span class="icon-bar"></span> | |
41 | - <span class="icon-bar"></span> | |
42 | - </button> | |
43 | - <a class="navbar-brand" href="{% url 'app:index' %}"><h3>{% trans 'Amadeus' %}</h3></a> | |
44 | - </div> | |
45 | - </div> | |
46 | - </div> | |
47 | - </div> | |
40 | + <div class="row"> | |
41 | + <div class="navbar navbar-default"> | |
42 | + <div class="container-fluid"> | |
43 | + <div class="navbar-header"> | |
44 | + <button type="button" class="navbar-toggle" data-toggle="collapse" data-target=".navbar-responsive-collapse"> | |
45 | + <span class="icon-bar"></span> | |
46 | + <span class="icon-bar"></span> | |
47 | + <span class="icon-bar"></span> | |
48 | + </button> | |
49 | + <a class="navbar-brand" href="javascript:void(0)"><img class="logo" src="{% static 'img/topo-amadeus.png' %}" alt="Logo"/></a> | |
50 | + </div> | |
51 | + <div class="navbar-collapse collapse navbar-responsive-collapse"> | |
52 | + <ul class="nav navbar-nav navbar-right notifications"> | |
53 | + <li> <a href="#"><i class="fa fa-bell-o" aria-hidden="true"></i></a> </li> | |
54 | + <li> <a href="#"><i class="fa fa-comments" aria-hidden="true"></i></a> </li> | |
55 | + <li> <a href="{% url 'users:profile' %}">{{ user }}</a></li> | |
56 | + <li> <a href="{% url 'core:logout' %}">{% trans 'Log out' %}</a></li> | |
57 | + </ul> | |
58 | + </div> | |
59 | + </div> | |
60 | + </div> | |
61 | + </div> | |
48 | 62 | {% endblock %} |
49 | 63 | |
50 | - <div class="container-fluid"> | |
64 | + <div class="container"> | |
51 | 65 | {% block breadcrumbs %} |
52 | 66 | |
53 | 67 | {% endblock %} |
54 | 68 | <div class="row"> |
55 | - <div class="col-md-2 col-sm-2"> | |
69 | + <div class="col-md-3 col-sm-3"> | |
56 | 70 | {% block sidebar %} |
57 | 71 | |
58 | 72 | {% endblock %} |
... | ... | @@ -62,7 +76,7 @@ |
62 | 76 | |
63 | 77 | {% endblock %} |
64 | 78 | </div> |
65 | - <div class="col-md-4 col-sm-4"> | |
79 | + <div class="col-md-3 col-sm-3"> | |
66 | 80 | {% block rightbar %} |
67 | 81 | |
68 | 82 | {% endblock rightbar %} | ... | ... |
core/templates/index.html
... | ... | @@ -3,165 +3,66 @@ |
3 | 3 | {% load static i18n %} |
4 | 4 | {% load widget_tweaks %} |
5 | 5 | |
6 | -{% block sidebar %} | |
7 | - <form class="form-horizontal" action="" method="post"> | |
8 | - {% csrf_token %} | |
9 | - | |
10 | - {% for error in form.non_field_errors %} | |
11 | - <div class="alert alert-danger"> | |
12 | - {{ error }} | |
13 | - </div> | |
14 | - {% endfor %} | |
15 | - | |
16 | - {% for field in form %} | |
17 | - <div class="form-group {% if form.has_error %} error {% endif %}"> | |
18 | - <label for="{{ field.auto_id }}" class="col-sm-2 control-label">{{ field.label }}</label> | |
19 | - <div class="col-sm-10"> | |
20 | - {% render_field field class='form-control input-sm' %} | |
21 | - {% for error in field.errors %} | |
22 | - <span class="help-block">{{ error }}</span> | |
23 | - {% endfor %} | |
24 | - </div> | |
25 | - </div> | |
26 | - {% endfor %} | |
27 | - <div class="form-group"> | |
28 | - <div class="col-sm-12"> | |
29 | - <input type="submit" class="btn btn-sm btn-success pull-right" value="{% trans 'Entrar' %}" /> | |
30 | - </div> | |
31 | - </div> | |
32 | - </form> | |
6 | +{% block nav %} | |
33 | 7 | {% endblock %} |
34 | 8 | |
35 | 9 | {% block content %} |
36 | - <div class="row"> | |
37 | - <div class="col-sm-12"> | |
38 | - <form class="form-horizontal" method="post"> | |
39 | - <div class="col-sm-10"> | |
40 | - <div class="form-group"> | |
41 | - <label for="search_keyword" class="control-label col-sm-3">{% trans 'Search course:' %} </label> | |
42 | - <div class="col-sm-9"> | |
43 | - <input type="text" class="form-control input-sm" id="search_keyword" /> | |
44 | - </div> | |
45 | - </div> | |
46 | - </div> | |
47 | - <button type="submit" class="btn btn-sm btn-success">{% trans 'Search' %}</button> | |
48 | - </form> | |
10 | + <div class="row logo-row"> | |
11 | + <div class="col-lg-offset-2 col-lg-9"> | |
12 | + <img src="..." class="img-responsive center-block " alt="logo amadeus"> | |
13 | + </div> | |
14 | + </div> | |
49 | 15 | |
50 | - <hr /> | |
16 | + <div class="row "> | |
17 | + <div class="col-lg-9 col-lg-offset-2"> | |
18 | + <div class="card"> | |
19 | + {% if message %} | |
20 | + <div class="alert alert-danger"> | |
21 | + {{message}} | |
22 | + </div> | |
51 | 23 | |
52 | - <h5>{% trans 'Most popular keywords:' %}</h5> | |
53 | - <div class="well"> | |
54 | - <center> | |
55 | - <ul class="cloud"> | |
56 | - <li> | |
57 | - <a href=""> | |
58 | - teste amadeus prospb | |
59 | - </a> | |
60 | - </li> | |
61 | - <li> | |
62 | - <a href=""> | |
63 | - programação fácil | |
64 | - </a> | |
65 | - </li> | |
66 | - <li> | |
67 | - <a href=""> | |
68 | - intermediário | |
69 | - </a> | |
70 | - </li> | |
71 | - <li> | |
72 | - <a href=""> | |
73 | - amadeus | |
74 | - </a> | |
75 | - </li> | |
76 | - <li> | |
77 | - <a href=""> | |
78 | - palavra02 | |
79 | - </a> | |
80 | - </li> | |
81 | - <li> | |
82 | - <a href=""> | |
83 | - programação para iniciantes | |
84 | - </a> | |
85 | - </li> | |
86 | - <li> | |
87 | - <a href=""> | |
88 | - django | |
89 | - </a> | |
90 | - </li> | |
91 | - <li> | |
92 | - <a href=""> | |
93 | - aluno teste | |
94 | - </a> | |
95 | - </li> | |
96 | - <li> | |
97 | - <a href=""> | |
98 | - curso0101 | |
99 | - </a> | |
100 | - </li> | |
101 | - <li> | |
102 | - <a href=""> | |
103 | - kjsdnksa | |
104 | - </a> | |
105 | - </li> | |
106 | - <li> | |
107 | - <a href=""> | |
108 | - palavra01 | |
109 | - </a> | |
110 | - </li> | |
111 | - <li> | |
112 | - <a href=""> | |
113 | - programming | |
114 | - </a> | |
115 | - </li> | |
116 | - <li> | |
117 | - <a href=""> | |
118 | - python | |
119 | - </a> | |
120 | - </li> | |
121 | - <li> | |
122 | - <a href=""> | |
123 | - curso | |
124 | - </a> | |
125 | - </li> | |
126 | - <li> | |
127 | - <a href=""> | |
128 | - mvc | |
129 | - </a> | |
130 | - </li> | |
131 | - <li> | |
132 | - <a href=""> | |
133 | - programação web | |
134 | - </a> | |
135 | - </li> | |
136 | - <li> | |
137 | - <a href=""> | |
138 | - ionic | |
139 | - </a> | |
140 | - </li> | |
141 | - <li> | |
142 | - <a href=""> | |
143 | - framework | |
144 | - </a> | |
145 | - </li> | |
146 | - <li> | |
147 | - <a href=""> | |
148 | - web | |
149 | - </a> | |
150 | - </li> | |
151 | - <li> | |
152 | - <a href=""> | |
153 | - android | |
154 | - </a> | |
155 | - </li> | |
156 | - <li> | |
157 | - <a href=""> | |
158 | - programação | |
159 | - </a> | |
160 | - </li> | |
161 | - </ul> | |
162 | - </center> | |
163 | - </div> | |
164 | - </div> | |
165 | - </div> | |
24 | + {% endif %} | |
25 | + <div class="card-content"> | |
26 | + <div class="card-body"> | |
27 | + <form id="form-login" class="form-group" method="post" action=""> | |
28 | + {% csrf_token %} | |
29 | + <div class="form-group is-empty"> | |
30 | + <label for="inputEmail" class="col-md-4 control-label"> {% trans 'Username' %}</label> | |
31 | + <div class="col-md-8"> | |
32 | + <input form="form-login" type="text" name="username" class="form-control" id="inputEmail" placeholder="Username"> | |
33 | + </div> | |
34 | + </div> | |
35 | + <div class="form-group is-empty"> | |
36 | + <label for="inputPassword" class="col-md-4 control-label"> {% trans 'Password' %}</label> | |
37 | + <div class="col-md-8"> | |
38 | + <input form="form-login" type="password" name="password" class="form-control" id="inputPassword" placeholder="Password"> | |
39 | + </div> | |
40 | + </div> | |
41 | + <div class="col-md-offset-2 col-md-10"> | |
42 | + <div class="checkbox"> | |
43 | + <label> | |
44 | + <input form="form-login" type="checkbox" name="checkbox"><span class="checkbox-material"><span class="check"></span></span> {% trans 'Remember Email' %} | |
45 | + </label> | |
46 | + </div> | |
47 | + </div> | |
48 | + </form> | |
49 | + </div> | |
166 | 50 | |
167 | -{% endblock %} | |
168 | 51 | \ No newline at end of file |
52 | + <footer class="card-footer" style="display: -webkit-box;"> | |
53 | + <div class="col-md-6"> | |
54 | + <button type="button" class="btn btn-flat" formaction="#" style="position: initial;">{% trans 'Guest' %}</button> | |
55 | + </div> | |
56 | + <div class="col-md-6"> | |
57 | + <button type="submite" class="btn btn-flat btn-success" form="form-login" style="position: initial;">{% trans 'Login' %}</button> | |
58 | + </div> | |
59 | + </footer> | |
60 | + </div> | |
61 | + </div> | |
62 | + </div> | |
63 | + </div> | |
64 | + <div class="row"> | |
65 | + <div class="col-lg-offset-2 col-lg-9"> | |
66 | + <a class="btn btn-raised btn-primary btn-lg btn-block" href="{% url 'core:register' %}">{% trans 'Sign Up' %} </a> | |
67 | + </div> | |
68 | + </div> | |
69 | +{% endblock%} | ... | ... |
core/templates/register_user.html
... | ... | @@ -17,12 +17,9 @@ |
17 | 17 | {% endblock %} |
18 | 18 | |
19 | 19 | {% block content %} |
20 | - {% if form.has_error %} | |
21 | - <div class="alert alert-info alert-dismissible" role="alert"> | |
22 | - <button type="button" class="close" data-dismiss="alert" aria-label="Close"> | |
23 | - <span aria-hidden="true">×</span> | |
24 | - </button> | |
25 | - <p>{{ form.error }}</p> | |
20 | + {% if message %} | |
21 | + <div class="alert alert-danger"> | |
22 | + {{message}} | |
26 | 23 | </div> |
27 | 24 | {% endif %} |
28 | 25 | |
... | ... | @@ -30,10 +27,10 @@ |
30 | 27 | {% csrf_token %} |
31 | 28 | {% for field in form %} |
32 | 29 | <div class="form-group{% if form.has_error %} has-error {% endif %}"> |
33 | - <label for="{{ field.auto_id }}">{{ field.label }}</label> | |
30 | + <label for="{{ field.auto_id }}" class="clearfix">{{ field.label }}</label> | |
34 | 31 | {% render_field field class='form-control input-sm' %} |
35 | 32 | <span id="helpBlock" class="help-block">{{ field.help_text }}</span> |
36 | - {% if field.errors.length > 0 %} | |
33 | + {% if field.errors %} | |
37 | 34 | <div class="alert alert-danger alert-dismissible" role="alert"> |
38 | 35 | <button type="button" class="close" data-dismiss="alert" aria-label="Close"> |
39 | 36 | <span aria-hidden="true">×</span> | ... | ... |
... | ... | @@ -0,0 +1,40 @@ |
1 | +{% extends "index.html" %} | |
2 | +{% load i18n %} | |
3 | +{% block content %} | |
4 | + | |
5 | + <div class="row logo-row"> | |
6 | + <div class="col-lg-offset-2 col-lg-9"> | |
7 | + <img src="..." class="img-responsive center-block " alt="logo amadeus"> | |
8 | + </div> | |
9 | + </div> | |
10 | + <div class="row "> | |
11 | + <div class="col-lg-9 col-lg-offset-2"> | |
12 | + <div class="card"> | |
13 | + <div class="card-content"> | |
14 | + | |
15 | + <div class="card-body"> | |
16 | + <form class="form-group "> | |
17 | + <div class="form-group"> | |
18 | + <label for="inputEmail" class="control-label label-static"> {% trans 'E-mail' %}</label> | |
19 | + <input type="email" class="form-control" id="inputEmail" placeholder="Email"> | |
20 | + </div> | |
21 | + <div class="form-group"> | |
22 | + <label for="inputRegistration" class=" control-label"> {% trans 'Registration' %} </label> | |
23 | + <input type="text" class="form-control" id="inputRegistration" placeholder="Registration"> | |
24 | + </div> | |
25 | + <div class="col-lg-offset-4 col-lg-4"> | |
26 | + <button class="btn btn-raised btn-primary btn-lg btn-block">{% trans 'Send' %}</button> | |
27 | + | |
28 | + </div> | |
29 | + | |
30 | + </form> | |
31 | + </div> | |
32 | + | |
33 | + </div> | |
34 | + | |
35 | + | |
36 | + </div> | |
37 | + </div> | |
38 | + </div> | |
39 | + | |
40 | +{% endblock content %} | ... | ... |
core/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 | +from users.models import User | |
5 | +# from django.core import mail | |
2 | 6 | |
3 | -# Create your tests here. | |
7 | +class LoginTestCase(TestCase): | |
8 | + | |
9 | + def setUp(self): | |
10 | + self.client = Client() | |
11 | + | |
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 | + | |
21 | + self.url = reverse('core:home') | |
22 | + | |
23 | + def test_ok(self): | |
24 | + response = self.client.get(self.url) | |
25 | + self.assertEquals(response.status_code, 200) | |
26 | + self.assertTemplateUsed(response, 'index.html') | |
27 | + data = {'username': 'test', 'password': 'testing'} | |
28 | + response = self.client.post(self.url, data) | |
29 | + self.assertRedirects(response, reverse("app:index")) | |
30 | + | |
31 | + # def test_not_ok(self): | |
32 | + # response = self.client.get(self.url) | |
33 | + # self.assertEquals(response.status_code, 200) | |
34 | + # self.assertTemplateUsed(response, 'index.html') | |
35 | + # data = {'username': 'test', 'password': 'senhaerrada'} | |
36 | + # response = self.client.post(self.url, data) | |
37 | + # self.assertTrue('message' in response.context) | |
38 | + # self.assertEquals(response.context['message'], "Email ou senha incorretos!") | ... | ... |
core/urls.py
1 | -from django.conf.urls import url, include | |
2 | -from django.contrib.auth import views as auth_views | |
3 | - | |
4 | -from . import views | |
5 | - | |
6 | -urlpatterns = [ | |
7 | - url(r'^$', views.index, name='index'), | |
8 | - url(r'^register/$', views.CreateUser.as_view(), name='register'), | |
9 | - url(r'^login/$', auth_views.login, {'template_name': 'index.html'}, name='home'), | |
10 | - url(r'^logout/$', auth_views.logout, {'next_page': 'home'}, name='logout'), | |
11 | - | |
12 | -] | |
1 | +from django.conf.urls import url, include | |
2 | +from django.contrib.auth import views as auth_views | |
3 | + | |
4 | +from . import views | |
5 | + | |
6 | + | |
7 | +urlpatterns = [ | |
8 | + url(r'^login/$', views.login, name='home'), | |
9 | + url(r'^register/$', views.RegisterUser.as_view(), name='register'), | |
10 | + url(r'^remember_password/$', views.remember_password, name='remember_password'), | |
11 | + url(r'^logout/$', auth_views.logout, {'next_page': 'core:home'}, name='logout'), | |
12 | +] | ... | ... |
core/views.py
1 | -from rolepermissions.shortcuts import assign_role | |
2 | -from django.utils.translation import ugettext_lazy as _ | |
3 | -from django.core.urlresolvers import reverse_lazy | |
4 | -from django.contrib import messages | |
5 | -from django.shortcuts import render | |
6 | -from django.views.generic import CreateView | |
7 | -from django.http import HttpResponse | |
8 | -from .forms import CreateUserForm | |
9 | -from users.models import User | |
10 | - | |
11 | -def index(request): | |
12 | - context = { | |
13 | - 'subscribed_courses': 'testando' | |
14 | - } | |
15 | - return render(request, "index.html", context) | |
16 | - | |
17 | -class CreateUser(CreateView): | |
18 | - model = User | |
19 | - form_class = CreateUserForm | |
20 | - template_name = 'register_user.html' | |
21 | - | |
22 | - success_url = reverse_lazy('core:home') | |
23 | - | |
24 | - def form_valid(self, form): | |
25 | - form.save() | |
26 | - assign_role(form.instance, 'student') | |
27 | - | |
28 | - messages.success(self.request, _('User successfully registered!')) | |
29 | - | |
30 | - return super(CreateUser, self).form_valid(form) | |
31 | - | |
32 | -def create_account(request): | |
33 | - return render(request, "create_account.html") | |
34 | - | |
35 | -def lembrar_senha(request): | |
36 | - return render(request, "lembrar_senha.html") | |
1 | +from rolepermissions.shortcuts import assign_role | |
2 | +from django.utils.translation import ugettext_lazy as _ | |
3 | +from django.core.urlresolvers import reverse_lazy, reverse | |
4 | +from django.contrib.auth import authenticate, login as login_user | |
5 | +from .decorators import log_decorator | |
6 | +from django.contrib import messages | |
7 | +from django.shortcuts import render, redirect | |
8 | +from django.views.generic import CreateView | |
9 | +from django.http import HttpResponse | |
10 | +from .forms import RegisterUserForm | |
11 | +from users.models import User | |
12 | + | |
13 | +def index(request): | |
14 | + context = { | |
15 | + 'subscribed_courses': 'testando' | |
16 | + } | |
17 | + return render(request, "index.html", context) | |
18 | + | |
19 | +class RegisterUser(CreateView): | |
20 | + model = User | |
21 | + form_class = RegisterUserForm | |
22 | + template_name = 'register_user.html' | |
23 | + | |
24 | + success_url = reverse_lazy('core:home') | |
25 | + | |
26 | + def form_valid(self, form): | |
27 | + form.save() | |
28 | + assign_role(form.instance, 'student') | |
29 | + | |
30 | + messages.success(self.request, _('User successfully registered!')) | |
31 | + | |
32 | + return super(RegisterUser, self).form_valid(form) | |
33 | + | |
34 | +def create_account(request): | |
35 | + return render(request, "create_account.html") | |
36 | + | |
37 | + | |
38 | +def remember_password(request): | |
39 | + return render(request, "remember_password.html") | |
40 | + | |
41 | +@log_decorator('Entrou no sistema') | |
42 | +def login(request): | |
43 | + context = {} | |
44 | + if request.POST: | |
45 | + username = request.POST['username'] | |
46 | + password = request.POST['password'] | |
47 | + user = authenticate(username=username, password=password) | |
48 | + if user is not None: | |
49 | + login_user(request, user) | |
50 | + return redirect(reverse("app:index")) | |
51 | + else: | |
52 | + context["message"] = _("E-mail or password are incorrect!") | |
53 | + return render(request,"index.html",context) | |
54 | + | |
55 | + | |
56 | +# class LoginClass(LoginView): | |
57 | +# template_name='index.html' | |
58 | +# | |
59 | +# def get_context_data(self, **kwargs): | |
60 | +# context = super(LoginClass,self).get_context_data(**kwargs) | |
61 | +# print ("deu certo") | |
62 | +# return context | ... | ... |
courses/forms.py
courses/locale/pt_BR/LC_MESSAGES/django.po
1 | +<<<<<<< HEAD | |
1 | 2 | # SOME DESCRIPTIVE TITLE. |
2 | 3 | # Copyright (C) YEAR THE PACKAGE'S COPYRIGHT HOLDER |
3 | 4 | # This file is distributed under the same license as the PACKAGE package. |
... | ... | @@ -455,3 +456,462 @@ msgstr "" |
455 | 456 | #: courses/views.py:291 |
456 | 457 | msgid "Module deleted successfully!" |
457 | 458 | msgstr "" |
459 | +======= | |
460 | +# SOME DESCRIPTIVE TITLE. | |
461 | +# Copyright (C) YEAR THE PACKAGE'S COPYRIGHT HOLDER | |
462 | +# This file is distributed under the same license as the PACKAGE package. | |
463 | +# FIRST AUTHOR <EMAIL@ADDRESS>, YEAR. | |
464 | +# | |
465 | +#, fuzzy | |
466 | +msgid "" | |
467 | +msgstr "" | |
468 | +"Project-Id-Version: PACKAGE VERSION\n" | |
469 | +"Report-Msgid-Bugs-To: \n" | |
470 | +"POT-Creation-Date: 2016-09-03 00:18-0300\n" | |
471 | +"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" | |
472 | +"Last-Translator: FULL NAME <EMAIL@ADDRESS>\n" | |
473 | +"Language-Team: LANGUAGE <LL@li.org>\n" | |
474 | +"Language: \n" | |
475 | +"MIME-Version: 1.0\n" | |
476 | +"Content-Type: text/plain; charset=UTF-8\n" | |
477 | +"Content-Transfer-Encoding: 8bit\n" | |
478 | +"Plural-Forms: nplurals=2; plural=(n > 1);\n" | |
479 | + | |
480 | +#: courses/forms.py:11 courses/forms.py:25 courses/forms.py:55 | |
481 | +#: courses/models.py:7 courses/models.py:20 courses/models.py:44 | |
482 | +#: courses/templates/category/index.html:38 | |
483 | +msgid "Name" | |
484 | +msgstr "Nome" | |
485 | + | |
486 | +#: courses/forms.py:14 | |
487 | +msgid "Category name" | |
488 | +msgstr "" | |
489 | + | |
490 | +#: courses/forms.py:26 | |
491 | +msgid "Objectives" | |
492 | +msgstr "" | |
493 | + | |
494 | +#: courses/forms.py:27 courses/models.py:23 | |
495 | +msgid "Content" | |
496 | +msgstr "" | |
497 | + | |
498 | +#: courses/forms.py:28 | |
499 | +msgid "Number of studets maximum" | |
500 | +msgstr "Número máximo de estudantes" | |
501 | + | |
502 | +#: courses/forms.py:29 | |
503 | +msgid "Course registration start date" | |
504 | +msgstr "" | |
505 | + | |
506 | +#: courses/forms.py:30 | |
507 | +msgid "Course registration end date" | |
508 | +msgstr "" | |
509 | + | |
510 | +#: courses/forms.py:31 | |
511 | +msgid "Course start date" | |
512 | +msgstr "Data de inicio do Curso" | |
513 | + | |
514 | +#: courses/forms.py:32 | |
515 | +msgid "Course end date" | |
516 | +msgstr "Data de termino do curso" | |
517 | + | |
518 | +#: courses/forms.py:33 courses/models.py:30 | |
519 | +msgid "Image" | |
520 | +msgstr "Imagem" | |
521 | + | |
522 | +#: courses/forms.py:34 courses/models.py:12 courses/models.py:31 | |
523 | +msgid "Category" | |
524 | +msgstr "Categoria" | |
525 | + | |
526 | +#: courses/forms.py:37 | |
527 | +msgid "Course name" | |
528 | +msgstr "" | |
529 | + | |
530 | +#: courses/forms.py:38 | |
531 | +msgid "Course objective" | |
532 | +msgstr "" | |
533 | + | |
534 | +#: courses/forms.py:39 | |
535 | +msgid "Course modules" | |
536 | +msgstr "" | |
537 | + | |
538 | +#: courses/forms.py:40 | |
539 | +msgid "Max number of students that a class can have" | |
540 | +msgstr "" | |
541 | + | |
542 | +#: courses/forms.py:41 | |
543 | +msgid "Date that starts the registration period of the course (dd/mm/yyyy)" | |
544 | +msgstr "" | |
545 | + | |
546 | +#: courses/forms.py:42 | |
547 | +msgid "Date that ends the registration period of the course (dd/mm/yyyy)" | |
548 | +msgstr "" | |
549 | + | |
550 | +#: courses/forms.py:43 | |
551 | +msgid "Date that the course starts (dd/mm/yyyy)" | |
552 | +msgstr "" | |
553 | + | |
554 | +#: courses/forms.py:44 | |
555 | +msgid "Date that the course ends (dd/mm/yyyy)" | |
556 | +msgstr "" | |
557 | + | |
558 | +#: courses/forms.py:45 | |
559 | +msgid "Representative image of the course" | |
560 | +msgstr "" | |
561 | + | |
562 | +#: courses/forms.py:46 | |
563 | +msgid "Category which the course belongs" | |
564 | +msgstr "" | |
565 | + | |
566 | +#: courses/forms.py:56 courses/models.py:46 | |
567 | +msgid "Description" | |
568 | +msgstr "" | |
569 | + | |
570 | +#: courses/forms.py:57 | |
571 | +msgid "Is it visible?" | |
572 | +msgstr "" | |
573 | + | |
574 | +#: courses/forms.py:60 | |
575 | +msgid "Module's name" | |
576 | +msgstr "" | |
577 | + | |
578 | +#: courses/forms.py:61 | |
579 | +msgid "Modules's description" | |
580 | +msgstr "" | |
581 | + | |
582 | +#: courses/forms.py:62 | |
583 | +msgid "Is the module visible?" | |
584 | +msgstr "" | |
585 | + | |
586 | +#: courses/models.py:8 courses/models.py:21 courses/models.py:45 | |
587 | +#: courses/templates/category/index.html:39 | |
588 | +msgid "Slug" | |
589 | +msgstr "" | |
590 | + | |
591 | +#: courses/models.py:9 courses/models.py:25 courses/models.py:48 | |
592 | +msgid "Creation Date" | |
593 | +msgstr "" | |
594 | + | |
595 | +#: courses/models.py:13 courses/templates/category/create.html:16 | |
596 | +#: courses/templates/category/delete.html:15 | |
597 | +#: courses/templates/category/index.html:15 | |
598 | +#: courses/templates/category/update.html:16 | |
599 | +#: courses/templates/category/view.html:15 | |
600 | +msgid "Categories" | |
601 | +msgstr "Categorias" | |
602 | + | |
603 | +#: courses/models.py:22 | |
604 | +msgid "Objectivies" | |
605 | +msgstr "" | |
606 | + | |
607 | +#: courses/models.py:24 | |
608 | +msgid "Maximum Students" | |
609 | +msgstr "" | |
610 | + | |
611 | +#: courses/models.py:26 | |
612 | +msgid "Register Date (Begin)" | |
613 | +msgstr "" | |
614 | + | |
615 | +#: courses/models.py:27 | |
616 | +msgid "Register Date (End)" | |
617 | +msgstr "" | |
618 | + | |
619 | +#: courses/models.py:28 | |
620 | +msgid "Begin of Course Date" | |
621 | +msgstr "" | |
622 | + | |
623 | +#: courses/models.py:29 | |
624 | +msgid "End of Course Date" | |
625 | +msgstr "" | |
626 | + | |
627 | +#: courses/models.py:32 | |
628 | +msgid "User" | |
629 | +msgstr "" | |
630 | + | |
631 | +#: courses/models.py:36 courses/models.py:49 | |
632 | +msgid "Course" | |
633 | +msgstr "Curso" | |
634 | + | |
635 | +#: courses/models.py:37 courses/templates/course/create.html:16 | |
636 | +#: courses/templates/course/delete.html:15 | |
637 | +#: courses/templates/course/filtered.html:8 | |
638 | +#: courses/templates/course/index.html:15 | |
639 | +#: courses/templates/course/update.html:16 | |
640 | +#: courses/templates/course/view.html:15 | |
641 | +#: courses/templates/module/create.html:17 | |
642 | +#: courses/templates/module/delete.html:16 | |
643 | +#: courses/templates/module/index.html:16 | |
644 | +#: courses/templates/module/update.html:17 | |
645 | +msgid "Courses" | |
646 | +msgstr "Cursos" | |
647 | + | |
648 | +#: courses/models.py:47 courses/templates/module/index.html:107 | |
649 | +msgid "Visible" | |
650 | +msgstr "Visível" | |
651 | + | |
652 | +#: courses/models.py:53 | |
653 | +msgid "Module" | |
654 | +msgstr "Modulo" | |
655 | + | |
656 | +#: courses/models.py:54 courses/templates/module/index.html:92 | |
657 | +msgid "Modules" | |
658 | +msgstr "Modulos" | |
659 | + | |
660 | +#: courses/templates/category/create.html:8 | |
661 | +#: courses/templates/category/delete.html:7 | |
662 | +#: courses/templates/category/index.html:7 | |
663 | +#: courses/templates/category/update.html:8 | |
664 | +#: courses/templates/category/view.html:7 | |
665 | +#: courses/templates/course/create.html:8 | |
666 | +#: courses/templates/course/delete.html:7 courses/templates/course/index.html:7 | |
667 | +#: courses/templates/course/update.html:8 courses/templates/course/view.html:7 | |
668 | +#: courses/templates/module/create.html:8 | |
669 | +#: courses/templates/module/delete.html:7 courses/templates/module/index.html:7 | |
670 | +#: courses/templates/module/update.html:8 | |
671 | +msgid "Home" | |
672 | +msgstr "Inicio" | |
673 | + | |
674 | +#: courses/templates/category/create.html:9 | |
675 | +#: courses/templates/category/delete.html:18 | |
676 | +#: courses/templates/category/index.html:18 | |
677 | +#: courses/templates/category/view.html:18 | |
678 | +msgid "Create Category" | |
679 | +msgstr "Criar Categoria" | |
680 | + | |
681 | +#: courses/templates/category/create.html:26 | |
682 | +#: courses/templates/category/update.html:26 | |
683 | +#: courses/templates/course/create.html:26 | |
684 | +#: courses/templates/course/update.html:32 | |
685 | +#: courses/templates/module/create.html:52 | |
686 | +#: courses/templates/module/update.html:52 | |
687 | +msgid "All fields are required" | |
688 | +msgstr "Todos os campos são obrigatótios" | |
689 | + | |
690 | +#: courses/templates/category/create.html:51 | |
691 | +#: courses/templates/category/update.html:51 | |
692 | +#: courses/templates/course/create.html:51 | |
693 | +#: courses/templates/course/update.html:57 | |
694 | +#: courses/templates/module/create.html:77 | |
695 | +#: courses/templates/module/update.html:77 | |
696 | +msgid "Save" | |
697 | +msgstr "Salvar" | |
698 | + | |
699 | +#: courses/templates/category/delete.html:8 | |
700 | +#: courses/templates/category/index.html:8 | |
701 | +msgid "Manage Categories" | |
702 | +msgstr "" | |
703 | + | |
704 | +#: courses/templates/category/delete.html:26 | |
705 | +msgid "Are you sure you want to delete the category" | |
706 | +msgstr "" | |
707 | + | |
708 | +#: courses/templates/category/delete.html:27 | |
709 | +#: courses/templates/course/delete.html:28 | |
710 | +#: courses/templates/module/delete.html:50 | |
711 | +msgid "Yes" | |
712 | +msgstr "Sim" | |
713 | + | |
714 | +#: courses/templates/category/delete.html:28 | |
715 | +#: courses/templates/course/delete.html:29 | |
716 | +#: courses/templates/module/delete.html:51 | |
717 | +msgid "No" | |
718 | +msgstr "Não" | |
719 | + | |
720 | +#: courses/templates/category/index.html:40 | |
721 | +msgid "Actions" | |
722 | +msgstr "" | |
723 | + | |
724 | +#: courses/templates/category/index.html:59 | |
725 | +msgid "No categories found" | |
726 | +msgstr "" | |
727 | + | |
728 | +#: courses/templates/category/update.html:9 | |
729 | +#: courses/templates/category/view.html:21 | |
730 | +msgid "Edit Category" | |
731 | +msgstr "" | |
732 | + | |
733 | +#: courses/templates/category/view.html:24 | |
734 | +msgid "Remove Category" | |
735 | +msgstr "" | |
736 | + | |
737 | +#: courses/templates/category/view.html:32 | |
738 | +msgid "Name:" | |
739 | +msgstr "" | |
740 | + | |
741 | +#: courses/templates/category/view.html:33 | |
742 | +msgid "Slug:" | |
743 | +msgstr "" | |
744 | + | |
745 | +#: courses/templates/course/create.html:9 | |
746 | +#: courses/templates/course/delete.html:18 | |
747 | +#: courses/templates/course/filtered.html:11 | |
748 | +#: courses/templates/course/index.html:18 courses/templates/course/view.html:25 | |
749 | +#: courses/templates/module/create.html:20 | |
750 | +#: courses/templates/module/delete.html:19 | |
751 | +#: courses/templates/module/index.html:26 | |
752 | +#: courses/templates/module/update.html:20 | |
753 | +msgid "Create Course" | |
754 | +msgstr "" | |
755 | + | |
756 | +#: courses/templates/course/delete.html:27 | |
757 | +msgid "Are you sure you want to delete the couse" | |
758 | +msgstr "" | |
759 | + | |
760 | +#: courses/templates/course/filtered.html:19 | |
761 | +#: courses/templates/course/index.html:26 | |
762 | +msgid "Categories:" | |
763 | +msgstr "" | |
764 | + | |
765 | +#: courses/templates/course/index.html:8 | |
766 | +msgid "Manage Courses" | |
767 | +msgstr "" | |
768 | + | |
769 | +#: courses/templates/course/index.html:80 | |
770 | +msgid "students tops" | |
771 | +msgstr "" | |
772 | + | |
773 | +#: courses/templates/course/index.html:86 | |
774 | +msgid "Subscribe Period:" | |
775 | +msgstr "" | |
776 | + | |
777 | +#: courses/templates/course/index.html:88 courses/templates/course/view.html:59 | |
778 | +#: courses/templates/module/index.html:83 | |
779 | +msgid "Period:" | |
780 | +msgstr "" | |
781 | + | |
782 | +#: courses/templates/course/index.html:104 | |
783 | +msgid "No courses found" | |
784 | +msgstr "" | |
785 | + | |
786 | +#: courses/templates/course/update.html:9 courses/templates/course/view.html:28 | |
787 | +#: courses/templates/module/create.html:26 | |
788 | +#: courses/templates/module/delete.html:25 | |
789 | +#: courses/templates/module/index.html:29 | |
790 | +#: courses/templates/module/update.html:26 | |
791 | +msgid "Edit Course" | |
792 | +msgstr "" | |
793 | + | |
794 | +#: courses/templates/course/update.html:19 | |
795 | +#: courses/templates/course/view.html:21 | |
796 | +#: courses/templates/module/create.html:29 | |
797 | +#: courses/templates/module/delete.html:9 | |
798 | +#: courses/templates/module/delete.html:28 | |
799 | +#: courses/templates/module/index.html:9 courses/templates/module/index.html:22 | |
800 | +#: courses/templates/module/update.html:29 | |
801 | +msgid "Manage Modules" | |
802 | +msgstr "" | |
803 | + | |
804 | +#: courses/templates/course/update.html:22 | |
805 | +#: courses/templates/course/view.html:31 | |
806 | +#: courses/templates/module/create.html:32 | |
807 | +#: courses/templates/module/delete.html:31 | |
808 | +#: courses/templates/module/index.html:32 | |
809 | +#: courses/templates/module/update.html:32 | |
810 | +msgid "Participants" | |
811 | +msgstr "" | |
812 | + | |
813 | +#: courses/templates/course/view.html:18 | |
814 | +#: courses/templates/module/create.html:23 | |
815 | +#: courses/templates/module/delete.html:22 | |
816 | +#: courses/templates/module/index.html:19 | |
817 | +#: courses/templates/module/update.html:23 | |
818 | +msgid "Course Info" | |
819 | +msgstr "" | |
820 | + | |
821 | +#: courses/templates/course/view.html:34 | |
822 | +#: courses/templates/module/create.html:35 | |
823 | +#: courses/templates/module/delete.html:34 | |
824 | +#: courses/templates/module/index.html:35 | |
825 | +#: courses/templates/module/update.html:35 | |
826 | +msgid "Course avaliations" | |
827 | +msgstr "" | |
828 | + | |
829 | +#: courses/templates/course/view.html:37 | |
830 | +#: courses/templates/module/create.html:38 | |
831 | +#: courses/templates/module/delete.html:37 | |
832 | +#: courses/templates/module/index.html:38 | |
833 | +#: courses/templates/module/update.html:38 | |
834 | +msgid "Duplicate Course" | |
835 | +msgstr "" | |
836 | + | |
837 | +#: courses/templates/course/view.html:40 | |
838 | +#: courses/templates/module/create.html:41 | |
839 | +#: courses/templates/module/delete.html:40 | |
840 | +#: courses/templates/module/index.html:41 | |
841 | +#: courses/templates/module/update.html:41 | |
842 | +msgid "Delete Course" | |
843 | +msgstr "" | |
844 | + | |
845 | +#: courses/templates/course/view.html:56 | |
846 | +msgid "Subscribes:" | |
847 | +msgstr "" | |
848 | + | |
849 | +#: courses/templates/course/view.html:66 | |
850 | +msgid "Objectives:" | |
851 | +msgstr "" | |
852 | + | |
853 | +#: courses/templates/course/view.html:69 | |
854 | +msgid "Work Plan:" | |
855 | +msgstr "" | |
856 | + | |
857 | +#: courses/templates/module/create.html:10 | |
858 | +#: courses/templates/module/index.html:70 | |
859 | +msgid "Create Module" | |
860 | +msgstr "" | |
861 | + | |
862 | +#: courses/templates/module/delete.html:49 | |
863 | +msgid "Are you sure you want to delete the module" | |
864 | +msgstr "" | |
865 | + | |
866 | +#: courses/templates/module/index.html:80 | |
867 | +msgid "students maximum" | |
868 | +msgstr "" | |
869 | + | |
870 | +#: courses/templates/module/index.html:109 | |
871 | +msgid "Invisible" | |
872 | +msgstr "" | |
873 | + | |
874 | +#: courses/templates/module/index.html:125 | |
875 | +msgid "No modules found" | |
876 | +msgstr "" | |
877 | + | |
878 | +#: courses/templates/module/update.html:10 | |
879 | +msgid "Edit Module" | |
880 | +msgstr "" | |
881 | + | |
882 | +#: courses/views.py:48 | |
883 | +msgid "Course created successfully!" | |
884 | +msgstr "" | |
885 | + | |
886 | +#: courses/views.py:70 | |
887 | +msgid "Course edited successfully!" | |
888 | +msgstr "" | |
889 | + | |
890 | +#: courses/views.py:92 | |
891 | +msgid "Course deleted successfully!" | |
892 | +msgstr "" | |
893 | + | |
894 | +#: courses/views.py:142 | |
895 | +msgid "Category created successfully!" | |
896 | +msgstr "" | |
897 | + | |
898 | +#: courses/views.py:164 | |
899 | +msgid "Category edited successfully!" | |
900 | +msgstr "" | |
901 | + | |
902 | +#: courses/views.py:185 | |
903 | +msgid "Category deleted successfully!" | |
904 | +msgstr "" | |
905 | + | |
906 | +#: courses/views.py:237 | |
907 | +msgid "Module created successfully!" | |
908 | +msgstr "" | |
909 | + | |
910 | +#: courses/views.py:268 | |
911 | +msgid "Module edited successfully!" | |
912 | +msgstr "" | |
913 | + | |
914 | +#: courses/views.py:291 | |
915 | +msgid "Module deleted successfully!" | |
916 | +msgstr "" | |
917 | +>>>>>>> 6adb9412b8b77c81ef8cc33a0b481885dadb6012 | ... | ... |
... | ... | @@ -0,0 +1,23 @@ |
1 | +{% extends 'app/base.html' %} | |
2 | + | |
3 | +{% load static i18n %} | |
4 | +{% load widget_tweaks %} | |
5 | + | |
6 | +{% block breadcrumbs %} | |
7 | + <ol class="breadcrumb"> | |
8 | + <li><a href="{% url 'app:index' %}">{% trans 'Home' %}</a></li> | |
9 | + <li class="active">{% trans 'Home Course' %}</li> | |
10 | + </ol> | |
11 | +{% endblock %} | |
12 | + | |
13 | +{% block sidebar %} | |
14 | + <div class="list-group"> | |
15 | + <a href="{% url 'course:manage' %}" class="list-group-item"> | |
16 | + {% trans 'Courses' %} | |
17 | + </a> | |
18 | + </div> | |
19 | +{% endblock %} | |
20 | + | |
21 | +{% block content %} | |
22 | + | |
23 | +{% endblock %} | ... | ... |
courses/tests/test_views.py
... | ... | @@ -12,52 +12,76 @@ class CourseViewTestCase(TestCase): |
12 | 12 | |
13 | 13 | def setUp(self): |
14 | 14 | self.client = Client() |
15 | - | |
16 | - self.user = User.objects.create_user(username = 'test', email = 'testing@amadeus.com', is_staff = True, is_active = True, password = 'testing') | |
17 | - assign_role(self.user, 'system_admin') | |
18 | - | |
19 | - category = Category(name = 'Categoria Teste', slug = 'categoria_teste') | |
20 | - category.save() | |
21 | 15 | |
22 | - course = Course(name = 'Curso Teste', slug = 'curso_teste', max_students = 50, init_register_date = '2016-08-26', end_register_date = '2016-10-01', init_date = '2016-10-05', end_date = '2017-10-05', category = category) | |
23 | - course.save() | |
16 | + self.user = User.objects.create_user( | |
17 | + username = 'test', | |
18 | + email = 'testing@amadeus.com', | |
19 | + is_staff = True, | |
20 | + is_active = True, | |
21 | + password = 'testing' | |
22 | + ) | |
23 | + assign_role(self.user, 'system_admin') | |
24 | 24 | |
25 | - self.category = category | |
26 | - self.course = course | |
25 | + self.category = Category( | |
26 | + name = 'Categoria Teste', | |
27 | + slug = 'categoria_teste' | |
28 | + ) | |
29 | + self.category.save() | |
30 | + | |
31 | + self.course = Course( | |
32 | + name = 'Curso Teste', | |
33 | + slug = 'curso_teste', | |
34 | + max_students = 50, | |
35 | + init_register_date = '2016-08-26', | |
36 | + end_register_date = '2016-10-01', | |
37 | + init_date = '2016-10-05', | |
38 | + end_date = '2017-10-05', | |
39 | + category = self.category | |
40 | + ) | |
41 | + self.course.save() | |
27 | 42 | |
28 | 43 | def test_index(self): |
29 | 44 | self.client.login(username='test', password='testing') |
30 | - | |
31 | - url = reverse('app:course:manage') | |
32 | - | |
45 | + | |
46 | + url = reverse('course:manage') | |
47 | + | |
33 | 48 | response = self.client.get(url) |
34 | 49 | |
35 | 50 | self.assertEquals(response.status_code, 200) |
36 | 51 | self.assertTemplateUsed(response, 'course/index.html') |
37 | 52 | |
38 | 53 | def test_index_not_logged(self): |
39 | - url = reverse('app:course:manage') | |
40 | - | |
54 | + url = reverse('course:manage') | |
55 | + | |
41 | 56 | response = self.client.get(url, follow = True) |
42 | 57 | |
43 | - self.assertRedirects(response, '%s?next=%s' % (reverse('home'), url), 302, 200) | |
58 | + self.assertRedirects(response, '%s?next=%s' % (reverse('core:home'), url), 302, 200) | |
44 | 59 | |
45 | 60 | def test_create(self): |
46 | 61 | self.client.login(username='test', password='testing') |
47 | 62 | |
48 | - url = reverse('app:course:create') | |
49 | - | |
50 | - response = self.client.get(url) | |
51 | - | |
52 | - self.assertEquals(response.status_code, 200) | |
63 | + url = reverse('course:create') | |
64 | + data = { | |
65 | + "name": 'Curso Teste', | |
66 | + "slug":'curso_teste', | |
67 | + "max_students": 50, | |
68 | + "init_register_date": '2016-08-26', | |
69 | + "end_register_date": '2016-10-01', | |
70 | + "init_date":'2016-10-05', | |
71 | + "end_date":'2017-10-05', | |
72 | + "category": self.category | |
73 | + } | |
74 | + | |
75 | + response = self.client.post(url, data, format='json') | |
76 | + self.assertEqual(response.status_code, 200) | |
53 | 77 | self.assertTemplateUsed(response, 'course/create.html') |
54 | 78 | |
55 | 79 | def test_create_not_logged(self): |
56 | - url = reverse('app:course:create') | |
57 | - | |
80 | + url = reverse('course:create') | |
81 | + | |
58 | 82 | response = self.client.get(url, follow = True) |
59 | 83 | |
60 | - self.assertRedirects(response, '%s?next=%s' % (reverse('home'), url), 302, 200) | |
84 | + self.assertRedirects(response, '%s?next=%s' % (reverse('core:home'), url), 302, 200) | |
61 | 85 | |
62 | 86 | def test_create_no_permission(self): |
63 | 87 | self.user = User.objects.create_user(username = 'student', email = 'student@amadeus.com', type_profile = 2, is_staff = False, is_active = True, password = 'testing') |
... | ... | @@ -66,8 +90,8 @@ class CourseViewTestCase(TestCase): |
66 | 90 | |
67 | 91 | self.client.login(username='student', password='testing') |
68 | 92 | |
69 | - url = reverse('app:course:create') | |
70 | - | |
93 | + url = reverse('course:create') | |
94 | + | |
71 | 95 | response = self.client.get(url) |
72 | 96 | |
73 | 97 | self.assertEquals(response.status_code, 403) |
... | ... | @@ -76,7 +100,7 @@ class CourseViewTestCase(TestCase): |
76 | 100 | def test_update(self): |
77 | 101 | self.client.login(username = 'test', password = 'testing') |
78 | 102 | |
79 | - url = reverse('app:course:update', kwargs = {'slug': self.course.slug}) | |
103 | + url = reverse('course:update', kwargs = {'slug': self.course.slug}) | |
80 | 104 | |
81 | 105 | response = self.client.get(url) |
82 | 106 | |
... | ... | @@ -84,11 +108,11 @@ class CourseViewTestCase(TestCase): |
84 | 108 | self.assertTemplateUsed(response, 'course/update.html') |
85 | 109 | |
86 | 110 | def test_update_not_logged(self): |
87 | - url = reverse('app:course:update', kwargs = {'slug': self.course.slug}) | |
88 | - | |
111 | + url = reverse('course:update', kwargs = {'slug': self.course.slug}) | |
112 | + | |
89 | 113 | response = self.client.get(url, follow = True) |
90 | 114 | |
91 | - self.assertRedirects(response, '%s?next=%s' % (reverse('home'), url), 302, 200) | |
115 | + self.assertRedirects(response, '%s?next=%s' % (reverse('core:home'), url), 302, 200) | |
92 | 116 | |
93 | 117 | def test_update_no_permission(self): |
94 | 118 | self.user = User.objects.create_user(username = 'student', email = 'student@amadeus.com', type_profile = 2, is_staff = False, is_active = True, password = 'testing') |
... | ... | @@ -97,8 +121,8 @@ class CourseViewTestCase(TestCase): |
97 | 121 | |
98 | 122 | self.client.login(username='student', password='testing') |
99 | 123 | |
100 | - url = reverse('app:course:update', kwargs = {'slug': self.course.slug}) | |
101 | - | |
124 | + url = reverse('course:update', kwargs = {'slug': self.course.slug}) | |
125 | + | |
102 | 126 | response = self.client.get(url) |
103 | 127 | |
104 | 128 | self.assertEquals(response.status_code, 403) |
... | ... | @@ -106,7 +130,7 @@ class CourseViewTestCase(TestCase): |
106 | 130 | def test_view(self): |
107 | 131 | self.client.login(username = 'test', password = 'testing') |
108 | 132 | |
109 | - url = reverse('app:course:view', kwargs = {'slug': self.course.slug}) | |
133 | + url = reverse('course:view', kwargs = {'slug': self.course.slug}) | |
110 | 134 | |
111 | 135 | response = self.client.get(url) |
112 | 136 | |
... | ... | @@ -114,8 +138,8 @@ class CourseViewTestCase(TestCase): |
114 | 138 | self.assertTemplateUsed(response, 'course/view.html') |
115 | 139 | |
116 | 140 | def test_update_not_logged(self): |
117 | - url = reverse('app:course:view', kwargs = {'slug': self.course.slug}) | |
118 | - | |
141 | + url = reverse('course:view', kwargs = {'slug': self.course.slug}) | |
142 | + | |
119 | 143 | response = self.client.get(url, follow = True) |
120 | 144 | |
121 | - self.assertRedirects(response, '%s?next=%s' % (reverse('home'), url), 302, 200) | |
122 | 145 | \ No newline at end of file |
146 | + self.assertRedirects(response, '%s?next=%s' % (reverse('core:home'), url), 302, 200) | ... | ... |
courses/views.py
... | ... | @@ -15,7 +15,7 @@ from .models import Course, Module, Category |
15 | 15 | |
16 | 16 | class IndexView(LoginRequiredMixin, generic.ListView): |
17 | 17 | |
18 | - login_url = '/' | |
18 | + login_url = reverse_lazy("core:home") | |
19 | 19 | redirect_field_name = 'next' |
20 | 20 | queryset = Course.objects.all() |
21 | 21 | template_name = 'course/index.html' |
... | ... | @@ -31,33 +31,33 @@ class IndexView(LoginRequiredMixin, generic.ListView): |
31 | 31 | class CreateView(LoginRequiredMixin, HasRoleMixin, generic.edit.CreateView): |
32 | 32 | |
33 | 33 | allowed_roles = ['professor', 'system_admin'] |
34 | - login_url = '/' | |
34 | + login_url = reverse_lazy("core:home") | |
35 | 35 | redirect_field_name = 'next' |
36 | 36 | template_name = 'course/create.html' |
37 | 37 | form_class = CourseForm |
38 | - success_url = reverse_lazy('app:course:manage') | |
39 | - | |
38 | + success_url = reverse_lazy('course:manage') | |
40 | 39 | def form_valid(self, form): |
41 | 40 | self.object = form.save(commit = False) |
42 | 41 | self.object.slug = slugify(self.object.name) |
42 | + print('Fooooiiii!!') | |
43 | 43 | self.object.save() |
44 | 44 | |
45 | 45 | return super(CreateView, self).form_valid(form) |
46 | 46 | |
47 | 47 | def render_to_response(self, context, **response_kwargs): |
48 | 48 | messages.success(self.request, _('Course created successfully!')) |
49 | - | |
49 | + | |
50 | 50 | return self.response_class(request=self.request, template=self.get_template_names(), context=context, using=self.template_engine) |
51 | 51 | |
52 | 52 | class UpdateView(LoginRequiredMixin, HasRoleMixin, generic.UpdateView): |
53 | 53 | |
54 | 54 | allowed_roles = ['professor', 'system_admin'] |
55 | - login_url = '/' | |
55 | + login_url = reverse_lazy("core:home") | |
56 | 56 | redirect_field_name = 'next' |
57 | 57 | template_name = 'course/update.html' |
58 | 58 | model = Course |
59 | 59 | form_class = CourseForm |
60 | - success_url = reverse_lazy('app:course:manage') | |
60 | + success_url = reverse_lazy('course:manage') | |
61 | 61 | |
62 | 62 | def form_valid(self, form): |
63 | 63 | self.object = form.save(commit = False) |
... | ... | @@ -68,12 +68,12 @@ class UpdateView(LoginRequiredMixin, HasRoleMixin, generic.UpdateView): |
68 | 68 | |
69 | 69 | def render_to_response(self, context, **response_kwargs): |
70 | 70 | messages.success(self.request, _('Course edited successfully!')) |
71 | - | |
71 | + | |
72 | 72 | return self.response_class(request=self.request, template=self.get_template_names(), context=context, using=self.template_engine) |
73 | 73 | |
74 | 74 | class View(LoginRequiredMixin, generic.DetailView): |
75 | 75 | |
76 | - login_url = '/' | |
76 | + login_url = reverse_lazy("core:home") | |
77 | 77 | redirect_field_name = 'next' |
78 | 78 | model = Course |
79 | 79 | context_object_name = 'course' |
... | ... | @@ -82,20 +82,20 @@ class View(LoginRequiredMixin, generic.DetailView): |
82 | 82 | class DeleteView(LoginRequiredMixin, HasRoleMixin, generic.DeleteView): |
83 | 83 | |
84 | 84 | allowed_roles = ['professor', 'system_admin'] |
85 | - login_url = '/' | |
85 | + login_url = reverse_lazy("core:home") | |
86 | 86 | redirect_field_name = 'next' |
87 | 87 | model = Course |
88 | 88 | template_name = 'course/delete.html' |
89 | - success_url = reverse_lazy('app:course:manage') | |
89 | + success_url = reverse_lazy('course:manage') | |
90 | 90 | |
91 | 91 | def render_to_response(self, context, **response_kwargs): |
92 | 92 | messages.success(self.request, _('Course deleted successfully!')) |
93 | - | |
93 | + | |
94 | 94 | return self.response_class(request=self.request, template=self.get_template_names(), context=context, using=self.template_engine) |
95 | 95 | |
96 | 96 | class FilteredView(LoginRequiredMixin, generic.ListView): |
97 | 97 | |
98 | - login_url = '/' | |
98 | + login_url = reverse_lazy("core:home") | |
99 | 99 | redirect_field_name = 'next' |
100 | 100 | template_name = 'course/filtered.html' |
101 | 101 | context_object_name = 'courses' |
... | ... | @@ -115,7 +115,7 @@ class FilteredView(LoginRequiredMixin, generic.ListView): |
115 | 115 | |
116 | 116 | class IndexCatView(LoginRequiredMixin, generic.ListView): |
117 | 117 | |
118 | - login_url = '/' | |
118 | + login_url = reverse_lazy("core:home") | |
119 | 119 | redirect_field_name = 'next' |
120 | 120 | queryset = Category.objects.all() |
121 | 121 | template_name = 'category/index.html' |
... | ... | @@ -125,11 +125,11 @@ class IndexCatView(LoginRequiredMixin, generic.ListView): |
125 | 125 | class CreateCatView(LoginRequiredMixin, HasRoleMixin, generic.edit.CreateView): |
126 | 126 | |
127 | 127 | allowed_roles = ['professor', 'system_admin'] |
128 | - login_url = '/' | |
128 | + login_url = reverse_lazy("core:home") | |
129 | 129 | redirect_field_name = 'next' |
130 | 130 | template_name = 'category/create.html' |
131 | 131 | form_class = CategoryForm |
132 | - success_url = reverse_lazy('app:course:manage_cat') | |
132 | + success_url = reverse_lazy('course:manage_cat') | |
133 | 133 | |
134 | 134 | def form_valid(self, form): |
135 | 135 | self.object = form.save(commit = False) |
... | ... | @@ -140,18 +140,18 @@ class CreateCatView(LoginRequiredMixin, HasRoleMixin, generic.edit.CreateView): |
140 | 140 | |
141 | 141 | def render_to_response(self, context, **response_kwargs): |
142 | 142 | messages.success(self.request, _('Category created successfully!')) |
143 | - | |
143 | + | |
144 | 144 | return self.response_class(request=self.request, template=self.get_template_names(), context=context, using=self.template_engine) |
145 | 145 | |
146 | 146 | class UpdateCatView(LoginRequiredMixin, HasRoleMixin, generic.UpdateView): |
147 | 147 | |
148 | 148 | allowed_roles = ['professor', 'system_admin'] |
149 | - login_url = '/' | |
149 | + login_url = reverse_lazy("core:home") | |
150 | 150 | redirect_field_name = 'next' |
151 | 151 | template_name = 'category/update.html' |
152 | 152 | model = Category |
153 | 153 | form_class = CategoryForm |
154 | - success_url = reverse_lazy('app:course:manage_cat') | |
154 | + success_url = reverse_lazy('course:manage_cat') | |
155 | 155 | |
156 | 156 | def form_valid(self, form): |
157 | 157 | self.object = form.save(commit = False) |
... | ... | @@ -162,33 +162,33 @@ class UpdateCatView(LoginRequiredMixin, HasRoleMixin, generic.UpdateView): |
162 | 162 | |
163 | 163 | def render_to_response(self, context, **response_kwargs): |
164 | 164 | messages.success(self.request, _('Category edited successfully!')) |
165 | - | |
165 | + | |
166 | 166 | return self.response_class(request=self.request, template=self.get_template_names(), context=context, using=self.template_engine) |
167 | 167 | |
168 | 168 | class ViewCat(LoginRequiredMixin, generic.DetailView): |
169 | - login_url = '/' | |
169 | + login_url = reverse_lazy("core:home") | |
170 | 170 | redirect_field_name = 'next' |
171 | 171 | model = Category |
172 | 172 | template_name = 'category/view.html' |
173 | 173 | context_object_name = 'category' |
174 | 174 | |
175 | 175 | class DeleteCatView(LoginRequiredMixin, HasRoleMixin, generic.DeleteView): |
176 | - | |
176 | + | |
177 | 177 | allowed_roles = ['professor', 'system_admin'] |
178 | - login_url = '/' | |
178 | + login_url = reverse_lazy("core:home") | |
179 | 179 | redirect_field_name = 'next' |
180 | 180 | model = Category |
181 | 181 | template_name = 'category/delete.html' |
182 | - success_url = reverse_lazy('app:course:manage_cat') | |
182 | + success_url = reverse_lazy('course:manage_cat') | |
183 | 183 | |
184 | 184 | def render_to_response(self, context, **response_kwargs): |
185 | 185 | messages.success(self.request, _('Category deleted successfully!')) |
186 | - | |
186 | + | |
187 | 187 | return self.response_class(request=self.request, template=self.get_template_names(), context=context, using=self.template_engine) |
188 | 188 | |
189 | 189 | class ModulesView(LoginRequiredMixin, generic.ListView): |
190 | 190 | |
191 | - login_url = '/' | |
191 | + login_url = reverse_lazy("core:home") | |
192 | 192 | redirect_field_name = 'next' |
193 | 193 | template_name = 'module/index.html' |
194 | 194 | context_object_name = 'modules' |
... | ... | @@ -208,13 +208,13 @@ class ModulesView(LoginRequiredMixin, generic.ListView): |
208 | 208 | class CreateModView(LoginRequiredMixin, HasRoleMixin, generic.edit.CreateView): |
209 | 209 | |
210 | 210 | allowed_roles = ['professor', 'system_admin'] |
211 | - login_url = '/' | |
211 | + login_url = reverse_lazy("core:home") | |
212 | 212 | redirect_field_name = 'next' |
213 | 213 | template_name = 'module/create.html' |
214 | 214 | form_class = ModuleForm |
215 | 215 | |
216 | 216 | def get_success_url(self): |
217 | - return reverse_lazy('app:course:manage_mods', kwargs={'slug' : self.object.course.slug}) | |
217 | + return reverse_lazy('course:manage_mods', kwargs={'slug' : self.object.course.slug}) | |
218 | 218 | |
219 | 219 | def get_context_data(self, **kwargs): |
220 | 220 | course = get_object_or_404(Course, slug = self.kwargs.get('slug')) |
... | ... | @@ -235,20 +235,20 @@ class CreateModView(LoginRequiredMixin, HasRoleMixin, generic.edit.CreateView): |
235 | 235 | |
236 | 236 | def render_to_response(self, context, **response_kwargs): |
237 | 237 | messages.success(self.request, _('Module created successfully!')) |
238 | - | |
238 | + | |
239 | 239 | return self.response_class(request=self.request, template=self.get_template_names(), context=context, using=self.template_engine) |
240 | 240 | |
241 | 241 | class UpdateModView(LoginRequiredMixin, HasRoleMixin, generic.UpdateView): |
242 | 242 | |
243 | 243 | allowed_roles = ['professor', 'system_admin'] |
244 | - login_url = '/' | |
244 | + login_url = reverse_lazy("core:home") | |
245 | 245 | redirect_field_name = 'next' |
246 | 246 | template_name = 'module/update.html' |
247 | 247 | model = Module |
248 | 248 | form_class = ModuleForm |
249 | 249 | |
250 | 250 | def get_success_url(self): |
251 | - return reverse_lazy('app:course:manage_mods', kwargs={'slug' : self.object.course.slug}) | |
251 | + return reverse_lazy('course:manage_mods', kwargs={'slug' : self.object.course.slug}) | |
252 | 252 | |
253 | 253 | def get_context_data(self, **kwargs): |
254 | 254 | course = get_object_or_404(Course, slug = self.kwargs.get('slug_course')) |
... | ... | @@ -266,19 +266,19 @@ class UpdateModView(LoginRequiredMixin, HasRoleMixin, generic.UpdateView): |
266 | 266 | |
267 | 267 | def render_to_response(self, context, **response_kwargs): |
268 | 268 | messages.success(self.request, _('Module edited successfully!')) |
269 | - | |
269 | + | |
270 | 270 | return self.response_class(request=self.request, template=self.get_template_names(), context=context, using=self.template_engine) |
271 | 271 | |
272 | 272 | class DeleteModView(LoginRequiredMixin, HasRoleMixin, generic.DeleteView): |
273 | 273 | |
274 | 274 | allowed_roles = ['professor', 'system_admin'] |
275 | - login_url = '/' | |
275 | + login_url = reverse_lazy("core:home") | |
276 | 276 | redirect_field_name = 'next' |
277 | 277 | model = Module |
278 | 278 | template_name = 'module/delete.html' |
279 | 279 | |
280 | 280 | def get_success_url(self): |
281 | - return reverse_lazy('app:course:manage_mods', kwargs={'slug' : self.object.course.slug}) | |
281 | + return reverse_lazy('course:manage_mods', kwargs={'slug' : self.object.course.slug}) | |
282 | 282 | |
283 | 283 | def get_context_data(self, **kwargs): |
284 | 284 | course = get_object_or_404(Course, slug = self.kwargs.get('slug_course')) |
... | ... | @@ -289,5 +289,5 @@ class DeleteModView(LoginRequiredMixin, HasRoleMixin, generic.DeleteView): |
289 | 289 | |
290 | 290 | def render_to_response(self, context, **response_kwargs): |
291 | 291 | messages.success(self.request, _('Module deleted successfully!')) |
292 | - | |
292 | + | |
293 | 293 | return self.response_class(request=self.request, template=self.get_template_names(), context=context, using=self.template_engine) | ... | ... |
db.sqlite3
No preview for this file type
... | ... | @@ -0,0 +1,6 @@ |
1 | +02/09/2016 23:34:45 - zambom - Entrou no sistema | |
2 | +02/09/2016 23:34:45 - zambom - Acessou home | |
3 | +02/09/2016 23:55:55 - jailson - Entrou no sistema | |
4 | +02/09/2016 23:55:55 - jailson - Acessou home | |
5 | +02/09/2016 23:56:05 - jailson - Acessou home | |
6 | +02/09/2016 23:56:25 - jailson - Acessou home | ... | ... |
... | ... | @@ -0,0 +1,52 @@ |
1 | +05/09/2016 02:41:58 - matheuslins - Entrou no sistema | |
2 | +05/09/2016 02:41:58 - matheuslins - Acessou home | |
3 | +05/09/2016 02:43:00 - matheuslins - Acessou home | |
4 | +05/09/2016 02:43:14 - matheuslins - Entrou no sistema | |
5 | +05/09/2016 02:43:14 - matheuslins - Acessou home | |
6 | +05/09/2016 02:43:18 - matheuslins - Acessou home | |
7 | +05/09/2016 02:44:46 - matheuslins - Acessou home | |
8 | +05/09/2016 02:45:32 - matheuslins - Entrou no sistema | |
9 | +05/09/2016 02:45:32 - matheuslins - Acessou home | |
10 | +05/09/2016 03:09:26 - matheuslins - Acessou home | |
11 | +05/09/2016 03:09:29 - matheuslins - Acessou home | |
12 | +05/09/2016 03:11:13 - matheuslins - Acessou home | |
13 | +05/09/2016 04:07:13 - test - Entrou no sistema | |
14 | +05/09/2016 04:07:13 - test - Acessou home | |
15 | +05/09/2016 04:08:48 - test - Entrou no sistema | |
16 | +05/09/2016 04:08:48 - test - Acessou home | |
17 | +05/09/2016 04:09:55 - test - Entrou no sistema | |
18 | +05/09/2016 04:09:55 - test - Acessou home | |
19 | +05/09/2016 04:12:37 - test - Entrou no sistema | |
20 | +05/09/2016 04:12:37 - test - Acessou home | |
21 | +05/09/2016 04:13:00 - test - Entrou no sistema | |
22 | +05/09/2016 04:13:00 - test - Acessou home | |
23 | +05/09/2016 04:13:23 - test - Entrou no sistema | |
24 | +05/09/2016 04:13:23 - test - Acessou home | |
25 | +05/09/2016 04:15:02 - test - Entrou no sistema | |
26 | +05/09/2016 04:15:02 - test - Acessou home | |
27 | +05/09/2016 04:20:19 - matheuslins - Entrou no sistema | |
28 | +05/09/2016 04:20:19 - matheuslins - Acessou home | |
29 | +05/09/2016 04:21:11 - matheuslins - Acessou home | |
30 | +05/09/2016 04:36:46 - test - Entrou no sistema | |
31 | +05/09/2016 04:36:46 - test - Acessou home | |
32 | +05/09/2016 04:37:23 - test - Entrou no sistema | |
33 | +05/09/2016 04:37:23 - test - Acessou home | |
34 | +05/09/2016 04:37:41 - test - Entrou no sistema | |
35 | +05/09/2016 04:37:41 - test - Acessou home | |
36 | +05/09/2016 04:38:01 - test - Entrou no sistema | |
37 | +05/09/2016 04:38:01 - test - Acessou home | |
38 | +05/09/2016 04:38:23 - test - Entrou no sistema | |
39 | +05/09/2016 04:38:23 - test - Acessou home | |
40 | +05/09/2016 04:38:39 - test - Entrou no sistema | |
41 | +05/09/2016 04:38:39 - test - Acessou home | |
42 | +05/09/2016 04:39:39 - test - Entrou no sistema | |
43 | +05/09/2016 04:39:39 - test - Acessou home | |
44 | +05/09/2016 04:40:28 - matheuslins - Acessou home | |
45 | +05/09/2016 13:14:23 - ailson - Acessou home | |
46 | +05/09/2016 13:17:28 - ailson - Entrou no sistema | |
47 | +05/09/2016 13:17:38 - ailson - Entrou no sistema | |
48 | +05/09/2016 13:18:20 - ailson - Entrou no sistema | |
49 | +05/09/2016 13:18:57 - ailson - Entrou no sistema | |
50 | +05/09/2016 15:04:41 - ailson - Acessou home | |
51 | +05/09/2016 15:16:39 - ailson - Acessou home | |
52 | +05/09/2016 15:41:52 - ailson - Acessou home | ... | ... |
users/forms.py
... | ... | @@ -25,4 +25,10 @@ class UserForm(forms.ModelForm): |
25 | 25 | |
26 | 26 | class Meta: |
27 | 27 | model = User |
28 | - fields = ['username', 'name', 'email', 'birth_date', 'city', 'state', 'gender', 'type_profile', 'cpf', 'phone', 'image', 'is_staff', 'is_active'] | |
29 | 28 | \ No newline at end of file |
29 | + fields = ['username', 'name', 'email', 'birth_date', 'city', 'state', 'gender', 'type_profile', 'cpf', 'phone', 'image', 'is_staff', 'is_active'] | |
30 | + | |
31 | +class EditUserForm(forms.ModelForm): | |
32 | + | |
33 | + class Meta: | |
34 | + model = User | |
35 | + fields = ['username', 'name', 'email', 'birth_date', 'city', 'state', 'gender', 'cpf', 'phone', 'image'] | |
30 | 36 | \ No newline at end of file | ... | ... |
users/locale/pt_BR/LC_MESSAGES/django.po
1 | +<<<<<<< HEAD | |
1 | 2 | # SOME DESCRIPTIVE TITLE. |
2 | 3 | # Copyright (C) YEAR THE PACKAGE'S COPYRIGHT HOLDER |
3 | 4 | # This file is distributed under the same license as the PACKAGE package. |
... | ... | @@ -227,3 +228,235 @@ msgstr "" |
227 | 228 | #: users/views.py:125 |
228 | 229 | msgid "Profile edited successfully!" |
229 | 230 | msgstr "" |
231 | +======= | |
232 | +# SOME DESCRIPTIVE TITLE. | |
233 | +# Copyright (C) YEAR THE PACKAGE'S COPYRIGHT HOLDER | |
234 | +# This file is distributed under the same license as the PACKAGE package. | |
235 | +# FIRST AUTHOR <EMAIL@ADDRESS>, YEAR. | |
236 | +# | |
237 | +#, fuzzy | |
238 | +msgid "" | |
239 | +msgstr "" | |
240 | +"Project-Id-Version: PACKAGE VERSION\n" | |
241 | +"Report-Msgid-Bugs-To: \n" | |
242 | +"POT-Creation-Date: 2016-09-03 00:18-0300\n" | |
243 | +"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" | |
244 | +"Last-Translator: FULL NAME <EMAIL@ADDRESS>\n" | |
245 | +"Language-Team: LANGUAGE <LL@li.org>\n" | |
246 | +"Language: \n" | |
247 | +"MIME-Version: 1.0\n" | |
248 | +"Content-Type: text/plain; charset=UTF-8\n" | |
249 | +"Content-Transfer-Encoding: 8bit\n" | |
250 | +"Plural-Forms: nplurals=2; plural=(n > 1);\n" | |
251 | + | |
252 | +#: users/forms.py:10 | |
253 | +msgid "Password" | |
254 | +msgstr "Senha" | |
255 | + | |
256 | +#: users/models.py:10 | |
257 | +msgid "Login" | |
258 | +msgstr "Entrar" | |
259 | + | |
260 | +#: users/models.py:13 | |
261 | +msgid "" | |
262 | +"Type a valid username. This fields should only contain letters, numbers and " | |
263 | +"the characteres: @/./+/-/_ ." | |
264 | +msgstr "" | |
265 | + | |
266 | +#: users/models.py:16 | |
267 | +msgid "" | |
268 | +"A short name that will be used to identify you in the platform and to access " | |
269 | +"it" | |
270 | +msgstr "" | |
271 | + | |
272 | +#: users/models.py:17 | |
273 | +msgid "Mail" | |
274 | +msgstr "" | |
275 | + | |
276 | +#: users/models.py:18 | |
277 | +msgid "Name" | |
278 | +msgstr "Nome" | |
279 | + | |
280 | +#: users/models.py:19 | |
281 | +msgid "City" | |
282 | +msgstr "Cidade" | |
283 | + | |
284 | +#: users/models.py:20 | |
285 | +msgid "State" | |
286 | +msgstr "Estado" | |
287 | + | |
288 | +#: users/models.py:21 | |
289 | +msgid "Gender" | |
290 | +msgstr "Genero" | |
291 | + | |
292 | +#: users/models.py:21 | |
293 | +msgid "Male" | |
294 | +msgstr "Masculino" | |
295 | + | |
296 | +#: users/models.py:21 | |
297 | +msgid "Female" | |
298 | +msgstr "Feminino" | |
299 | + | |
300 | +#: users/models.py:22 | |
301 | +msgid "Image" | |
302 | +msgstr "Imagem" | |
303 | + | |
304 | +#: users/models.py:23 | |
305 | +msgid "Birth Date" | |
306 | +msgstr "" | |
307 | + | |
308 | +#: users/models.py:24 | |
309 | +msgid "Phone" | |
310 | +msgstr "Telefone" | |
311 | + | |
312 | +#: users/models.py:25 users/templates/users/profile.html:42 | |
313 | +msgid "Cpf" | |
314 | +msgstr "" | |
315 | + | |
316 | +#: users/models.py:26 | |
317 | +msgid "Type" | |
318 | +msgstr "" | |
319 | + | |
320 | +#: users/models.py:26 | |
321 | +msgid "Professor" | |
322 | +msgstr "" | |
323 | + | |
324 | +#: users/models.py:26 | |
325 | +msgid "Student" | |
326 | +msgstr "Aluno" | |
327 | + | |
328 | +#: users/models.py:27 | |
329 | +msgid "Create Date" | |
330 | +msgstr "" | |
331 | + | |
332 | +#: users/models.py:28 | |
333 | +msgid "Administrador" | |
334 | +msgstr "" | |
335 | + | |
336 | +#: users/models.py:29 | |
337 | +msgid "Active" | |
338 | +msgstr "" | |
339 | + | |
340 | +#: users/models.py:37 | |
341 | +msgid "User" | |
342 | +msgstr "Usuário" | |
343 | + | |
344 | +#: users/models.py:38 | |
345 | +msgid "Users" | |
346 | +msgstr "Usuários" | |
347 | + | |
348 | +#: users/templates/list_users.html:8 users/templates/list_users.html:15 | |
349 | +#: users/templates/users/index.html:8 | |
350 | +msgid "Manage Users" | |
351 | +msgstr "Gerenciar Usuários" | |
352 | + | |
353 | +#: users/templates/list_users.html:14 users/templates/users/create.html:8 | |
354 | +#: users/templates/users/edit_profile.html:8 users/templates/users/index.html:7 | |
355 | +#: users/templates/users/profile.html:8 users/templates/users/update.html:8 | |
356 | +#: users/templates/users/view.html:7 | |
357 | +msgid "Home" | |
358 | +msgstr "Início" | |
359 | + | |
360 | +#: users/templates/list_users.html:23 | |
361 | +msgid "Add user" | |
362 | +msgstr "Adicionar usuário" | |
363 | + | |
364 | +#: users/templates/list_users.html:24 | |
365 | +msgid "Send email" | |
366 | +msgstr "Enviar e-mail" | |
367 | + | |
368 | +#: users/templates/users/create.html:9 | |
369 | +msgid "New User" | |
370 | +msgstr "" | |
371 | + | |
372 | +#: users/templates/users/create.html:16 users/templates/users/index.html:15 | |
373 | +#: users/templates/users/update.html:16 users/templates/users/view.html:15 | |
374 | +msgid "System Users" | |
375 | +msgstr "" | |
376 | + | |
377 | +#: users/templates/users/create.html:19 users/templates/users/index.html:18 | |
378 | +#: users/templates/users/update.html:19 users/templates/users/view.html:18 | |
379 | +msgid "New Account" | |
380 | +msgstr "" | |
381 | + | |
382 | +#: users/templates/users/create.html:22 users/templates/users/index.html:21 | |
383 | +#: users/templates/users/update.html:22 users/templates/users/view.html:27 | |
384 | +msgid "Send Mail" | |
385 | +msgstr "" | |
386 | + | |
387 | +#: users/templates/users/create.html:32 | |
388 | +#: users/templates/users/edit_profile.html:29 | |
389 | +#: users/templates/users/update.html:32 | |
390 | +msgid "All fields are required" | |
391 | +msgstr "" | |
392 | + | |
393 | +#: users/templates/users/create.html:57 | |
394 | +#: users/templates/users/edit_profile.html:64 | |
395 | +#: users/templates/users/update.html:57 | |
396 | +msgid "Save" | |
397 | +msgstr "" | |
398 | + | |
399 | +#: users/templates/users/edit_profile.html:9 | |
400 | +#: users/templates/users/edit_profile.html:19 | |
401 | +#: users/templates/users/profile.html:19 | |
402 | +msgid "Edit Profile" | |
403 | +msgstr "" | |
404 | + | |
405 | +#: users/templates/users/edit_profile.html:16 | |
406 | +#: users/templates/users/profile.html:9 users/templates/users/profile.html:16 | |
407 | +msgid "Profile" | |
408 | +msgstr "" | |
409 | + | |
410 | +#: users/templates/users/index.html:56 users/templates/users/profile.html:32 | |
411 | +#: users/templates/users/view.html:39 | |
412 | +msgid "Administrator" | |
413 | +msgstr "" | |
414 | + | |
415 | +#: users/templates/users/index.html:74 | |
416 | +msgid "No users found" | |
417 | +msgstr "" | |
418 | + | |
419 | +#: users/templates/users/profile.html:36 users/templates/users/view.html:43 | |
420 | +msgid "Mail:" | |
421 | +msgstr "" | |
422 | + | |
423 | +#: users/templates/users/profile.html:39 users/templates/users/view.html:46 | |
424 | +msgid "Phone:" | |
425 | +msgstr "" | |
426 | + | |
427 | +#: users/templates/users/profile.html:45 | |
428 | +msgid "Birth date" | |
429 | +msgstr "" | |
430 | + | |
431 | +#: users/templates/users/update.html:9 | |
432 | +msgid "Edit user" | |
433 | +msgstr "" | |
434 | + | |
435 | +#: users/templates/users/view.html:21 | |
436 | +msgid "View User Account" | |
437 | +msgstr "" | |
438 | + | |
439 | +#: users/templates/users/view.html:24 | |
440 | +msgid "Edit User Account" | |
441 | +msgstr "" | |
442 | + | |
443 | +#: users/templates/users/view.html:49 | |
444 | +msgid "Cpf:" | |
445 | +msgstr "" | |
446 | + | |
447 | +#: users/templates/users/view.html:52 | |
448 | +msgid "Birth date:" | |
449 | +msgstr "" | |
450 | + | |
451 | +#: users/views.py:47 | |
452 | +msgid "User created successfully!" | |
453 | +msgstr "" | |
454 | + | |
455 | +#: users/views.py:76 | |
456 | +msgid "User edited successfully!" | |
457 | +msgstr "" | |
458 | + | |
459 | +#: users/views.py:125 | |
460 | +msgid "Profile edited successfully!" | |
461 | +msgstr "" | |
462 | +>>>>>>> 6adb9412b8b77c81ef8cc33a0b481885dadb6012 | ... | ... |
users/tests.py
1 | -from django.test import TestCase | |
1 | +from django.test import TestCase, Client | |
2 | +from rolepermissions.shortcuts import assign_role | |
3 | +from django.core.urlresolvers import reverse | |
4 | +from .models import * | |
5 | +from .forms import * | |
2 | 6 | |
3 | 7 | # Create your tests here. |
8 | +class TestCreateUser(TestCase): | |
9 | + | |
10 | + def setUp(self): | |
11 | + self.client = Client() | |
12 | + | |
13 | + self.user = User.objects.create_user( | |
14 | + username = 'test', | |
15 | + email = 'testing@amadeus.com', | |
16 | + is_staff = True, | |
17 | + is_active = True, | |
18 | + password = 'testing' | |
19 | + ) | |
20 | + assign_role(self.user, 'system_admin') | |
21 | + | |
22 | + def test_edit_users(self): | |
23 | + self.client.login(username='test', password='testing') | |
24 | + | |
25 | + url = reverse('users:edit_profile', kwargs={'pk': self.user.id}) | |
26 | + data = EditUserForm(self.data['email']).data | |
27 | + data['email'] = "testing2@amadeus.com" | |
28 | + | |
29 | + response = self.client.put(url, data, format='json') | |
30 | + self.assertEqual(response.status_code, 200) | |
31 | + self.assertEqual(response.data['email'], data['email']) | |
32 | + | |
33 | + | |
34 | + | |
35 | + | |
36 | + | ... | ... |
users/urls.py
... | ... | @@ -8,5 +8,5 @@ urlpatterns = [ |
8 | 8 | url(r'^usuario/editar/(?P<username>[\w_-]+)/$', views.Update.as_view(), name='update'), |
9 | 9 | url(r'^usuario/dados/(?P<username>[\w_-]+)/$', views.View.as_view(), name='view'), |
10 | 10 | url(r'^perfil/$', views.Profile.as_view(), name='profile'), |
11 | - url(r'^perfil/editar/$', views.EditProfile.as_view(), name='edit_profile'), | |
12 | -] | |
13 | 11 | \ No newline at end of file |
12 | + url(r'^perfil/editar/(?P<username>[\w_-]+)/$', views.EditProfile.as_view(), name='edit_profile'), | |
13 | +] | ... | ... |
users/views.py
... | ... | @@ -10,9 +10,9 @@ from .models import User |
10 | 10 | from .forms import UserForm, ProfileForm |
11 | 11 | |
12 | 12 | class UsersListView(HasRoleMixin, LoginRequiredMixin, generic.ListView): |
13 | - | |
13 | + | |
14 | 14 | allowed_roles = ['system_admin'] |
15 | - login_url = '/' | |
15 | + login_url = reverse_lazy("core:home") | |
16 | 16 | redirect_field_name = 'next' |
17 | 17 | template_name = 'list_users.html' |
18 | 18 | context_object_name = 'users' |
... | ... | @@ -25,12 +25,12 @@ class UsersListView(HasRoleMixin, LoginRequiredMixin, generic.ListView): |
25 | 25 | class Create(HasRoleMixin, LoginRequiredMixin, generic.edit.CreateView): |
26 | 26 | |
27 | 27 | allowed_roles = ['system_admin'] |
28 | - login_url = '/' | |
28 | + login_url = reverse_lazy("core:home") | |
29 | 29 | redirect_field_name = 'next' |
30 | 30 | template_name = 'users/create.html' |
31 | 31 | form_class = UserForm |
32 | 32 | context_object_name = 'acc' |
33 | - success_url = reverse_lazy('app:user:manage') | |
33 | + success_url = reverse_lazy('user:manage') | |
34 | 34 | |
35 | 35 | def form_valid(self, form): |
36 | 36 | self.object = form.save(commit = False) |
... | ... | @@ -51,7 +51,7 @@ class Create(HasRoleMixin, LoginRequiredMixin, generic.edit.CreateView): |
51 | 51 | class Update(HasRoleMixin, LoginRequiredMixin, generic.UpdateView): |
52 | 52 | |
53 | 53 | allowed_roles = ['system_admin'] |
54 | - login_url = '/' | |
54 | + login_url = reverse_lazy("core:home") | |
55 | 55 | redirect_field_name = 'next' |
56 | 56 | template_name = 'users/update.html' |
57 | 57 | slug_field = 'username' |
... | ... | @@ -59,11 +59,11 @@ class Update(HasRoleMixin, LoginRequiredMixin, generic.UpdateView): |
59 | 59 | context_object_name = 'acc' |
60 | 60 | model = User |
61 | 61 | form_class = UserForm |
62 | - success_url = reverse_lazy('app:users:manage') | |
62 | + success_url = reverse_lazy('users:manage') | |
63 | 63 | |
64 | 64 | def form_valid(self, form): |
65 | 65 | self.object = form.save(commit = False) |
66 | - | |
66 | + | |
67 | 67 | if self.object.type_profile == 2: |
68 | 68 | assign_role(self.object, 'student') |
69 | 69 | elif self.object.type_profile == 1: |
... | ... | @@ -72,14 +72,14 @@ class Update(HasRoleMixin, LoginRequiredMixin, generic.UpdateView): |
72 | 72 | assign_role(self.object, 'system_admin') |
73 | 73 | |
74 | 74 | self.object.save() |
75 | - | |
75 | + | |
76 | 76 | messages.success(self.request, _('User edited successfully!')) |
77 | 77 | |
78 | 78 | return super(Update, self).form_valid(form) |
79 | - | |
79 | + | |
80 | 80 | class View(LoginRequiredMixin, generic.DetailView): |
81 | 81 | |
82 | - login_url = '/' | |
82 | + login_url = reverse_lazy("core:home") | |
83 | 83 | redirect_field_name = 'next' |
84 | 84 | model = User |
85 | 85 | context_object_name = 'acc' |
... | ... | @@ -89,18 +89,18 @@ class View(LoginRequiredMixin, generic.DetailView): |
89 | 89 | |
90 | 90 | class Profile(LoginRequiredMixin, generic.DetailView): |
91 | 91 | |
92 | - login_url = '/' | |
92 | + login_url = reverse_lazy("core:home") | |
93 | 93 | redirect_field_name = 'next' |
94 | 94 | context_object_name = 'user' |
95 | 95 | template_name = 'users/profile.html' |
96 | 96 | |
97 | 97 | def get_object(self): |
98 | 98 | user = get_object_or_404(User, username = self.request.user.username) |
99 | - return user | |
99 | + return user | |
100 | 100 | |
101 | 101 | class EditProfile(LoginRequiredMixin, generic.UpdateView): |
102 | 102 | |
103 | - login_url = '/' | |
103 | + login_url = reverse_lazy("core:home") | |
104 | 104 | redirect_field_name = 'next' |
105 | 105 | template_name = 'users/edit_profile.html' |
106 | 106 | form_class = UserForm |
... | ... | @@ -112,7 +112,7 @@ class EditProfile(LoginRequiredMixin, generic.UpdateView): |
112 | 112 | |
113 | 113 | def form_valid(self, form): |
114 | 114 | self.object = form.save(commit = False) |
115 | - | |
115 | + | |
116 | 116 | if self.object.type_profile == 2: |
117 | 117 | assign_role(self.object, 'student') |
118 | 118 | elif self.object.type_profile == 1: |
... | ... | @@ -124,4 +124,4 @@ class EditProfile(LoginRequiredMixin, generic.UpdateView): |
124 | 124 | |
125 | 125 | messages.success(self.request, _('Profile edited successfully!')) |
126 | 126 | |
127 | - return super(EditProfile, self).form_valid(form) | |
128 | 127 | \ No newline at end of file |
128 | + return super(EditProfile, self).form_valid(form) | ... | ... |