summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorkinitrupti2016-10-04 12:01:02 +0530
committerkinitrupti2016-10-04 12:01:02 +0530
commit15ab83ff1b57dab493ac366d866f3e26765599eb (patch)
tree0a9364c4c3c8b38182a2bfda3b97f859c084affe
parentc5c3c7b6c4794d960ead6137d251cd9b8f423aa4 (diff)
downloadPython-TBC-Interface-15ab83ff1b57dab493ac366d866f3e26765599eb.tar.gz
Python-TBC-Interface-15ab83ff1b57dab493ac366d866f3e26765599eb.tar.bz2
Python-TBC-Interface-15ab83ff1b57dab493ac366d866f3e26765599eb.zip
Upgraded to django 1.9
-rw-r--r--PythonTBC/settings.py51
-rw-r--r--PythonTBC/urls.py16
-rw-r--r--commentingapp/views.py2
-rw-r--r--tbc/forms.py2
-rw-r--r--tbc/models.py6
-rw-r--r--tbc/urls.py107
-rw-r--r--tbc/views.py2
-rw-r--r--tbc_error_page/views.py2
8 files changed, 110 insertions, 78 deletions
diff --git a/PythonTBC/settings.py b/PythonTBC/settings.py
index 28eda1d..e73bc25 100644
--- a/PythonTBC/settings.py
+++ b/PythonTBC/settings.py
@@ -4,7 +4,7 @@ from os.path import *
from local import *
DEBUG = True
-TEMPLATE_DEBUG = DEBUG
+#TEMPLATE_DEBUG = DEBUG
ADMINS = (
@@ -94,11 +94,11 @@ STATICFILES_FINDERS = (
SECRET_KEY = 'a8zm$)bj&k9p2$1*biby#mo5fga#8$sr4&cmz%h=vum-xkbkme'
# List of callables that know how to import templates from various sources.
-TEMPLATE_LOADERS = (
- 'django.template.loaders.filesystem.Loader',
- 'django.template.loaders.app_directories.Loader',
+#TEMPLATE_LOADERS = (
+# 'django.template.loaders.filesystem.Loader',
+# 'django.template.loaders.app_directories.Loader',
# 'django.template.loaders.eggs.Loader',
-)
+#)
MIDDLEWARE_CLASSES = (
'django.middleware.common.CommonMiddleware',
@@ -115,15 +115,15 @@ ROOT_URLCONF = 'PythonTBC.urls'
# Python dotted path to the WSGI application used by Django's runserver.
WSGI_APPLICATION = 'PythonTBC.wsgi.application'
-TEMPLATE_DIRS = (
+#TEMPLATE_DIRS = (
# Put strings here, like "/home/html/django_templates" or "C:/www/django/templates".
# Always use forward slashes, even on Windows.
# Don't forget to use absolute paths, not relative paths.
- join(PROJDIR, '../tbc/templates'),
- join(PROJDIR, '../tbc/static/uploads'),
- join(PROJDIR, '../comments/templates'),
- LOCAL_template_dirs,
-)
+# join(PROJDIR, '../tbc/templates'),
+# join(PROJDIR, '../tbc/static/uploads'),
+# join(PROJDIR, '../comments/templates'),
+# LOCAL_template_dirs,
+#)
INSTALLED_APPS = (
'django.contrib.auth',
'django.contrib.contenttypes',
@@ -138,13 +138,40 @@ INSTALLED_APPS = (
# 'django.contrib.admindocs',
'tbc',
'comments',
- 'south',
+ #'south',
'commentingapp',
'tbc_error_page',
'taggit',
'taggit_templatetags2',
)
+TEMPLATES = [
+ {
+ 'BACKEND': 'django.template.backends.django.DjangoTemplates',
+ 'DIRS': [
+ 'join(PROJDIR, "../tbc/templates")',
+ 'join(PROJDIR, "../tbc/static/uploads")',
+ 'join(PROJDIR, "../comments/templates")',
+ 'LOCAL_template_dirs',
+],
+ #'APP_DIRS': True,
+
+ 'OPTIONS': {
+ 'debug': DEBUG,
+ 'context_processors': [
+ 'django.template.context_processors.debug',
+ 'django.template.context_processors.request',
+ 'django.contrib.auth.context_processors.auth',
+ 'django.contrib.messages.context_processors.messages',
+ ],
+ 'loaders': [
+ 'django.template.loaders.filesystem.Loader',
+ 'django.template.loaders.app_directories.Loader',
+
+],
+ },
+ },
+]
SESSION_SERIALIZER = 'django.contrib.sessions.serializers.JSONSerializer'
diff --git a/PythonTBC/urls.py b/PythonTBC/urls.py
index 34bc0f6..473dad1 100644
--- a/PythonTBC/urls.py
+++ b/PythonTBC/urls.py
@@ -1,5 +1,7 @@
from django.conf.urls import patterns, include, url
-
+import tbc_error_page.views
+import commentingapp.views
+import django.contrib.sitemaps.views
# Uncomment the next two lines to enable the admin:
from django.contrib import admin
admin.autodiscover()
@@ -9,7 +11,7 @@ sitemaps = {
'book': TbcBookSitemap,
}
-urlpatterns = patterns('',
+urlpatterns = [
# Examples:
# url(r'^$', 'PythonTBC.views.home', name='home'),
# url(r'^PythonTBC/', include('PythonTBC.foo.urls')),
@@ -20,12 +22,12 @@ urlpatterns = patterns('',
# Uncomment the next line to enable the admin:
url(r'^admin', include(admin.site.urls)),
url(r'^', include('tbc.urls', namespace='tbc')),
- url(r'^sitemap\.xml$', 'django.contrib.sitemaps.views.sitemap', {'sitemaps': sitemaps}),
+ url(r'^sitemap\.xml$', django.contrib.sitemaps.views.sitemap, {'sitemaps': sitemaps}),
- url(r'^admin-tools/commenting', 'commentingapp.views.commenting', name = 'commenting'),
- url(r'^admin-tools/error_page', 'tbc_error_page.views.error', name = 'error_page'),
- url(r'^admin-tools/broken_page', 'tbc_error_page.views.broken', name = 'broken_page'),
+ url(r'^admin-tools/commenting', commentingapp.views.commenting, name = 'commenting'),
+ url(r'^admin-tools/error_page', tbc_error_page.views.error, name = 'error_page'),
+ url(r'^admin-tools/broken_page', tbc_error_page.views.broken, name = 'broken_page'),
-)
+]
diff --git a/commentingapp/views.py b/commentingapp/views.py
index 66606b7..80f37e8 100644
--- a/commentingapp/views.py
+++ b/commentingapp/views.py
@@ -1,6 +1,6 @@
from django.shortcuts import render, render_to_response
from django.contrib.auth.decorators import login_required
-from django.core.context_processors import csrf
+from django.template.context_processors import csrf
from .models import Url, Comments
from django.db.models import Q
from collections import Counter
diff --git a/tbc/forms.py b/tbc/forms.py
index aa3b477..effe45b 100644
--- a/tbc/forms.py
+++ b/tbc/forms.py
@@ -16,7 +16,7 @@ class UserProfileForm(forms.ModelForm):
self.fields['about_proj'].label = "How did you come to know about the project"
class Meta:
model = Profile
- exclude = ('user')
+ exclude = ('user',)
widgets = {
'about':forms.TextInput(attrs={'placeholder':'Tell us about yourself'}),
'dob':forms.TextInput(attrs={'placeholder':'mm/dd/yyyy'}),
diff --git a/tbc/models.py b/tbc/models.py
index 7deb31c..8cb6c06 100644
--- a/tbc/models.py
+++ b/tbc/models.py
@@ -82,7 +82,7 @@ class Profile(models.Model):
about_proj = models.CharField(max_length=50, choices=ABOUT_PROJ)
city = models.CharField(max_length=50, default=None)
state = models.CharField(max_length=50, default=None)
- pin_code = models.IntegerField(max_length=6, default=None)
+ pin_code = models.IntegerField(default=None)
def __unicode__(self):
name = self.user.first_name or 'Profile'
return '%s'%(name)
@@ -103,7 +103,7 @@ class Book(models.Model):
isbn = models.CharField(max_length=50)
edition = models.CharField(max_length=15)
year_of_pub = models.CharField(max_length=4)
- no_chapters = models.IntegerField(max_length=2, default=0, blank=True)
+ no_chapters = models.IntegerField(default=0, blank=True)
contributor = models.ForeignKey(Profile)
reviewer = models.ForeignKey(Reviewer)
approved = models.BooleanField(default=False)
@@ -144,7 +144,7 @@ class TempBook(models.Model):
isbn = models.CharField(max_length=50)
edition = models.CharField(max_length=15)
year_of_pub = models.CharField(max_length=4)
- no_chapters = models.IntegerField(max_length=2)
+ no_chapters = models.IntegerField()
def __unicode__(self):
name = self.title or 'Book'
return '%s'%(name)
diff --git a/tbc/urls.py b/tbc/urls.py
index 3db075b..4177f2f 100644
--- a/tbc/urls.py
+++ b/tbc/urls.py
@@ -1,61 +1,64 @@
from django.conf.urls import patterns, include, url
+from django.conf import settings
+from django.conf.urls.static import static
+from django.contrib import admin
+import tbc.views
-
-urlpatterns = patterns('',
- url(r'^$', 'tbc.views.home', name='home'),
- url(r'^internship-forms/$', 'tbc.views.internship_forms', name='internship_forms'),
- url(r'^about-pythontbc/$', 'tbc.views.about_pytbc', name='about_pytbc'),
+urlpatterns = [
+ url(r'^$', tbc.views.home, name='home'),
+ url(r'^internship-forms/$', tbc.views.internship_forms, name='internship_forms'),
+ url(r'^about-pythontbc/$', tbc.views.about_pytbc, name='about_pytbc'),
- url(r'^sample-notebook/$', 'tbc.views.sample_ipynb', name='sample_ipynb'),
- url(r'^register/$', 'tbc.views.user_register', name='user_register'),
- url(r'^login/$', 'tbc.views.user_login', name='user_login'),
- url(r'^logout/$', 'tbc.views.user_logout', name='user_logout'),
- url(r'^profile/$', 'tbc.views.user_profile', name='user_profile'),
- url(r'^update-profile/$', 'tbc.views.update_profile', name='update_profile'),
- url(r'^forgot-password/$', 'tbc.views.forgot_password', name='forgot_password'),
- url(r'^update-password/$', 'tbc.views.update_password', name='update_password'),
- url(r'^admin-tools/$', 'tbc.views.admin_tools', name='admin_tools'),
+ url(r'^sample-notebook/$', tbc.views.sample_ipynb, name='sample_ipynb'),
+ url(r'^register/$', tbc.views.user_register, name='user_register'),
+ url(r'^login/$', tbc.views.user_login, name='user_login'),
+ url(r'^logout/$', tbc.views.user_logout, name='user_logout'),
+ url(r'^profile/$', tbc.views.user_profile, name='user_profile'),
+ url(r'^update-profile/$', tbc.views.update_profile, name='update_profile'),
+ url(r'^forgot-password/$', tbc.views.forgot_password, name='forgot_password'),
+ url(r'^update-password/$', tbc.views.update_password, name='update_password'),
+ url(r'^admin-tools/$', tbc.views.admin_tools, name='admin_tools'),
- url(r'^submit-proposal/$', 'tbc.views.submit_proposal', name='submit_proposal'),
- url(r'^submit-aicte-proposal/$', 'tbc.views.list_aicte', name='list_aicte'),
- url(r'^submit-aicte-proposal/(?P<aicte_book_id>\d+)/$', 'tbc.views.submit_aicte_proposal', name='submit_aicte_proposal'),
- url(r'^submit-book/$', 'tbc.views.submit_book', name='submit_book'),
- url(r'^submit-sample/$', 'tbc.views.submit_sample', name='submit_sample'),
- url(r'^submit-sample/(?P<proposal_id>\d+)$', 'tbc.views.submit_sample', name='submit_sample'),
- url(r'^submit-sample/(?P<proposal_id>\d+)/(?P<old_notebook_id>\d+)$', 'tbc.views.submit_sample', name='submit_sample'),
- url(r'^confirm-book-details/$', 'tbc.views.confirm_book_details', name='confirm_book_details'),
- url(r'^submit-book-old/$', 'tbc.views.submit_book', name='submit_book'),
- url(r'^submit-code/$', 'tbc.views.submit_code', name='submit_code'),
- url(r'^submit-code-old/(?P<book_id>\d+)$', 'tbc.views.submit_code_old', name='submit_code_old'),
- url(r'^update-content/(?P<book_id>\d+)$', 'tbc.views.update_content', name='update_content'),
- url(r'^get-zip/(?P<book_id>\d+)$', 'tbc.views.get_zip', name='get_zip'),
- url(r'^browse-books/$', 'tbc.views.browse_books', name='browse_books'),
- url(r'^browse-books/(?P<category>.+)$', 'tbc.views.browse_books', name='browse_books'),
- url(r'^convert-notebook/(?P<notebook_path>.+)$', 'tbc.views.convert_notebook', name='convert_notebook'),
- url(r'^book-details/(?P<book_id>\d+)/$', 'tbc.views.book_details', name='book_details'),
- url(r'^completed-books/$', 'tbc.views.completed_books', name='completed_books'),
- url(r'^completed-books/(?P<category>.+)$', 'tbc.views.completed_books', name='completed_books'),
- url(r'^books-under-progress/$', 'tbc.views.books_under_progress', name='books_under_progress'),
- url(r'^redirect-ipynb/(?P<notebook_path>.+)$', 'tbc.views.redirect_to_ipynb', name='redirect_to_ipynb'),
- url(r'^get-certificate/$', 'tbc.views.get_certificate', name='get_certificate'),
- url(r'^get-certificate/(?P<book_id>\d+)/$', 'tbc.views.get_certificate', name='get_certificate'),
+ url(r'^submit-proposal/$', tbc.views.submit_proposal, name='submit_proposal'),
+ url(r'^submit-aicte-proposal/$', tbc.views.list_aicte, name='list_aicte'),
+ url(r'^submit-aicte-proposal/(?P<aicte_book_id>\d+)/$', tbc.views.submit_aicte_proposal, name='submit_aicte_proposal'),
+ url(r'^submit-book/$', tbc.views.submit_book, name='submit_book'),
+ url(r'^submit-sample/$', tbc.views.submit_sample, name='submit_sample'),
+ url(r'^submit-sample/(?P<proposal_id>\d+)$', tbc.views.submit_sample, name='submit_sample'),
+ url(r'^submit-sample/(?P<proposal_id>\d+)/(?P<old_notebook_id>\d+)$', tbc.views.submit_sample, name='submit_sample'),
+ url(r'^confirm-book-details/$', tbc.views.confirm_book_details, name='confirm_book_details'),
+ url(r'^submit-book-old/$', tbc.views.submit_book, name='submit_book'),
+ url(r'^submit-code/$', tbc.views.submit_code, name='submit_code'),
+ url(r'^submit-code-old/(?P<book_id>\d+)$', tbc.views.submit_code_old, name='submit_code_old'),
+ url(r'^update-content/(?P<book_id>\d+)$', tbc.views.update_content, name='update_content'),
+ url(r'^get-zip/(?P<book_id>\d+)$', tbc.views.get_zip, name='get_zip'),
+ url(r'^browse-books/$', tbc.views.browse_books, name='browse_books'),
+ url(r'^browse-books/(?P<category>.+)$', tbc.views.browse_books, name='browse_books'),
+ url(r'^convert-notebook/(?P<notebook_path>.+)$', tbc.views.convert_notebook, name='convert_notebook'),
+ url(r'^book-details/(?P<book_id>\d+)/$', tbc.views.book_details, name='book_details'),
+ url(r'^completed-books/$', tbc.views.completed_books, name='completed_books'),
+ url(r'^completed-books/(?P<category>.+)$', tbc.views.completed_books, name='completed_books'),
+ url(r'^books-under-progress/$', tbc.views.books_under_progress, name='books_under_progress'),
+ url(r'^redirect-ipynb/(?P<notebook_path>.+)$', tbc.views.redirect_to_ipynb, name='redirect_to_ipynb'),
+ url(r'^get-certificate/$', tbc.views.get_certificate, name='get_certificate'),
+ url(r'^get-certificate/(?P<book_id>\d+)/$', tbc.views.get_certificate, name='get_certificate'),
- url(r'^book-review/$', 'tbc.views.book_review', name='book_review'),
- url(r'^proposal-review/$', 'tbc.views.review_proposals', name='review_proposals'),
- url(r'^proposal-review/(?P<proposal_id>\d+)/(?P<textbook_id>\d+)$', 'tbc.views.review_proposals', name='review_proposals'),
- url(r'^disapprove-sample-notebook/(?P<proposal_id>\d+)$', 'tbc.views.disapprove_proposal', name='disapprove_proposal'),
- url(r'^allot-book/(?P<proposal_id>\d+)$', 'tbc.views.allot_book', name='allot_book'),
- url(r'^reject-proposal/(?P<proposal_id>\d+)$', 'tbc.views.reject_proposal', name='reject_proposal'),
- url(r'^book-review/(?P<book_id>\d+)$', 'tbc.views.book_review', name='book_review'),
- url(r'^approve-book/(?P<book_id>\d+)$', 'tbc.views.approve_book', name='approve_book'),
- url(r'^notify-changes/(?P<book_id>\d+)$', 'tbc.views.notify_changes', name='notify_changes'),
- url(r'^brokenbooks/$', 'tbc.views.get_broken_books', name='broken_books'),
- url(r'^link-image/$', 'tbc.views.link_image', name='link_image'),
- url(r'^books/$', 'tbc.views.books', name='books'),
- url(r'^edit-book/(?P<book_id>\d+)/$', 'tbc.views.edit_book', name='edit_book'),
+ url(r'^book-review/$', tbc.views.book_review, name='book_review'),
+ url(r'^proposal-review/$', tbc.views.review_proposals, name='review_proposals'),
+ url(r'^proposal-review/(?P<proposal_id>\d+)/(?P<textbook_id>\d+)$', tbc.views.review_proposals, name='review_proposals'),
+ url(r'^disapprove-sample-notebook/(?P<proposal_id>\d+)$', tbc.views.disapprove_proposal, name='disapprove_proposal'),
+ url(r'^allot-book/(?P<proposal_id>\d+)$', tbc.views.allot_book, name='allot_book'),
+ url(r'^reject-proposal/(?P<proposal_id>\d+)$', tbc.views.reject_proposal, name='reject_proposal'),
+ url(r'^book-review/(?P<book_id>\d+)$', tbc.views.book_review, name='book_review'),
+ url(r'^approve-book/(?P<book_id>\d+)$', tbc.views.approve_book, name='approve_book'),
+ url(r'^notify-changes/(?P<book_id>\d+)$', tbc.views.notify_changes, name='notify_changes'),
+ url(r'^brokenbooks/$', tbc.views.get_broken_books, name='broken_books'),
+ url(r'^link-image/$', tbc.views.link_image, name='link_image'),
+ url(r'^books/$', tbc.views.books, name='books'),
+ url(r'^edit-book/(?P<book_id>\d+)/$', tbc.views.edit_book, name='edit_book'),
# ajax urls
- url(r'^ajax/matching-books/$', 'tbc.views.ajax_matching_books', name='AjaxMatchingBooks'),
+ url(r'^ajax/matching-books/$', tbc.views.ajax_matching_books, name='AjaxMatchingBooks'),
-)
+]
diff --git a/tbc/views.py b/tbc/views.py
index d14093e..5e6a2a1 100644
--- a/tbc/views.py
+++ b/tbc/views.py
@@ -3,7 +3,7 @@ from django.contrib.contenttypes.models import ContentType
from django.http import HttpResponse, HttpResponseRedirect, Http404
from django.shortcuts import render_to_response, redirect
from django.views.decorators.csrf import csrf_exempt
-from django.core.context_processors import csrf
+from django.template.context_processors import csrf
from django.contrib.auth import authenticate, login, logout
from django.contrib.admin.models import CHANGE
from django.contrib.auth.decorators import login_required
diff --git a/tbc_error_page/views.py b/tbc_error_page/views.py
index d788afa..b165f1c 100644
--- a/tbc_error_page/views.py
+++ b/tbc_error_page/views.py
@@ -1,7 +1,7 @@
from django.shortcuts import render_to_response
from .models import Error, Broken, get_json_from_file
from django.contrib.auth.decorators import login_required
-from django.core.context_processors import csrf
+from django.template.context_processors import csrf
from django.http import Http404
from tbc.views import is_reviewer