Commit 56939716 by muhammad-ammar

upgrade django

parent 47c2d63d
...@@ -7,7 +7,8 @@ os.environ.setdefault('DJANGO_SETTINGS_MODULE', 'VEDA.settings.local') ...@@ -7,7 +7,8 @@ os.environ.setdefault('DJANGO_SETTINGS_MODULE', 'VEDA.settings.local')
from django.conf import settings from django.conf import settings
from rest_framework import routers from rest_framework import routers
# from rest_framework.routers import DefaultRouter # from rest_framework.routers import DefaultRouter
from django.conf.urls import patterns, include, url from django.conf.urls import include, url
from django.contrib.auth import login, logout
from django.contrib import admin from django.contrib import admin
from VEDA_OS01 import views, transcripts from VEDA_OS01 import views, transcripts
...@@ -22,13 +23,12 @@ router.register(r'urls', views.URLViewSet) ...@@ -22,13 +23,12 @@ router.register(r'urls', views.URLViewSet)
urlpatterns = [ urlpatterns = [
url(r'^admin/', admin.site.urls), url(r'^admin/', admin.site.urls),
url(r'^static/(?P<path>.*)$', 'django.views.static.serve', {'document_root': settings.STATIC_ROOT}),
# Front End # Front End
url(r'^', include('frontend.urls')), url(r'^', include('frontend.urls')),
# API # API
url(r'^login/', views.user_login), url(r'^login/', views.user_login),
url(r'^accounts/login/$', 'django.contrib.auth.views.login', ), url(r'^accounts/login/$', login),
url(r'^accounts/logout/$', 'django.contrib.auth.views.logout'), url(r'^accounts/logout/$', logout),
url(r'^o/', include('oauth2_provider.urls', namespace='oauth2_provider')), url(r'^o/', include('oauth2_provider.urls', namespace='oauth2_provider')),
url(r'^api/', include(router.urls)), url(r'^api/', include(router.urls)),
# Transcript credentials handler view # Transcript credentials handler view
......
...@@ -108,9 +108,6 @@ class CreateOauthAppClientTests(TestCase): ...@@ -108,9 +108,6 @@ class CreateOauthAppClientTests(TestCase):
}, },
{ {
'client_id': ' ', 'client_id': ' ',
},
{
'client_id': None,
} }
) )
@ddt.unpack @ddt.unpack
......
from django.conf.urls import * from django.conf.urls import url, include
from django.contrib import admin from django.contrib import admin
admin.autodiscover() admin.autodiscover()
from django.views.generic import TemplateView from django.views.generic import TemplateView
import views import views
urlpatterns = patterns( urlpatterns = [
'', # '',
(r'^$', views.index), url(r'^$', views.index),
(r'^robots\.txt$', TemplateView.as_view(template_name='robots.txt', content_type='text/plain')), url(r'^robots\.txt$', TemplateView.as_view(template_name='robots.txt', content_type='text/plain')),
(r'^admin/', include(admin.site.urls)),
# Input Form # Input Form
(r'cat/', views.input_form), url(r'cat/', views.input_form),
# Data Validation # Data Validation
(r'institution_validator/', views.institution_name), url(r'institution_validator/', views.institution_name),
(r'inst_id_validate/', views.inst_id_validate), url(r'inst_id_validate/', views.inst_id_validate),
(r'institution_data/', views.institution_data), url(r'institution_data/', views.institution_data),
(r'new_institution/', views.new_institution), url(r'new_institution/', views.new_institution),
(r'course_id_validate/', views.course_id_validate), url(r'course_id_validate/', views.course_id_validate),
(r'course_add/', views.course_add), url(r'course_add/', views.course_add),
# Uploads # Uploads
(r'upload/', views.upload_alpha_1), url(r'upload/', views.upload_alpha_1),
(r'upload_success/', views.upload_success), url(r'upload_success/', views.upload_success),
(r'about_input/', views.about_input), url(r'about_input/', views.about_input),
) ]
...@@ -9,7 +9,7 @@ import hashlib ...@@ -9,7 +9,7 @@ import hashlib
import uuid import uuid
from django.http import HttpResponse from django.http import HttpResponse
from django.template import RequestContext, loader from django.template import loader
from django.http import HttpResponseRedirect from django.http import HttpResponseRedirect
from frontend_env import * from frontend_env import *
...@@ -36,10 +36,10 @@ def index(request): ...@@ -36,10 +36,10 @@ def index(request):
linkers = links linkers = links
template = loader.get_template('index.html') template = loader.get_template('index.html')
context = RequestContext(request, ({ context = {
'links': linkers, 'links': linkers,
'auth': auth 'auth': auth
})) }
return HttpResponse(template.render(context)) return HttpResponse(template.render(context))
...@@ -57,10 +57,14 @@ def input_form(request): ...@@ -57,10 +57,14 @@ def input_form(request):
inst_list = json.dumps(VC1.inst_list) inst_list = json.dumps(VC1.inst_list)
template = loader.get_template('course_form.html') template = loader.get_template('course_form.html')
context = RequestContext(request, ({
return HttpResponse(
template.render(
{
'institution_list': inst_list 'institution_list': inst_list
})) }
return HttpResponse(template.render(context)) )
)
def institution_name(request): def institution_name(request):
...@@ -191,24 +195,19 @@ def upload_alpha_1(request): ...@@ -191,24 +195,19 @@ def upload_alpha_1(request):
).digest()) ).digest())
template = loader.get_template('upload_video.html') template = loader.get_template('upload_video.html')
context = RequestContext( context = {
request, ({
'policy': policy, 'policy': policy,
'signature': signature, 'signature': signature,
'abvid_serial': abvid_serial, 'abvid_serial': abvid_serial,
'access_key': auth_dict['veda_access_key_id'], 'access_key': auth_dict['veda_access_key_id'],
'upload_bucket': auth_dict['veda_upload_bucket'], 'upload_bucket': auth_dict['veda_upload_bucket'],
}) }
)
return HttpResponse(template.render(context)) return HttpResponse(template.render(context))
def upload_success(request): def upload_success(request):
template = loader.get_template('upload_success.html') template = loader.get_template('upload_success.html')
context = RequestContext( return HttpResponse(template.render({}))
request, ({})
)
return HttpResponse(template.render(context))
def about_input(request): def about_input(request):
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment