upgrade to django 1.4, remove unneeded dependencies

This commit is contained in:
Sanjay Bhangar 2018-03-09 20:26:31 +05:30
parent 99964fd8ab
commit 2148ac7e2b
4 changed files with 38 additions and 18 deletions

View File

@ -1,6 +1,3 @@
-e svn+http://code.djangoproject.com/svn/django/branches/releases/1.2.X/#egg=django Django==1.4
ox
South
elementtree
django-extensions django-extensions
django-debug-toolbar # django-debug-toolbar

View File

@ -2,10 +2,10 @@
from django.shortcuts import render_to_response from django.shortcuts import render_to_response
from django.http import HttpResponse from django.http import HttpResponse
from django.shortcuts import get_object_or_404 from django.shortcuts import get_object_or_404
from oxdjango.shortcuts import render_to_json_response
from django.core.mail import send_mail from django.core.mail import send_mail
from models import * from models import *
from settings import GOOGLE_MAPS_API_KEY as gkey from settings import GOOGLE_MAPS_API_KEY as gkey
import json
QUESTIONS = { QUESTIONS = {
'1problems': 'What problems do flyover and skywalk projects create?', '1problems': 'What problems do flyover and skywalk projects create?',
@ -13,6 +13,19 @@ QUESTIONS = {
'3stories': 'Do you have any stories about flyovers or skywalks in Mumbai or elsewhere?' '3stories': 'Do you have any stories about flyovers or skywalks in Mumbai or elsewhere?'
} }
def render_to_json_response(dictionary, content_type="text/json", status=200):
indent=None
if settings.DEBUG:
content_type = "text/javascript"
indent = 2
if settings.JSON_DEBUG:
print json.dumps(dictionary, indent=2)
if 'status' in dictionary and 'code' in dictionary['status']:
status = dictionary['status']['code']
return HttpResponse(json.dumps(dictionary, indent=indent),
content_type=content_type, status=status)
def geojson(request): def geojson(request):
features = [] features = []
for l in Location.objects.all(): for l in Location.objects.all():

View File

@ -16,12 +16,23 @@ ADMINS = (
MANAGERS = ADMINS MANAGERS = ADMINS
GOOGLE_MAPS_API_KEY = 'ABQIAAAAsn1j-ZGGtRgZ9aMJPCZbRxQ7qtcPomt5R65jYWcqt6293S9jUBRFELNu52BN---sow276q3W0R-Hvg' GOOGLE_MAPS_API_KEY = 'ABQIAAAAsn1j-ZGGtRgZ9aMJPCZbRxQ7qtcPomt5R65jYWcqt6293S9jUBRFELNu52BN---sow276q3W0R-Hvg'
DATABASE_ENGINE = 'mysql' # 'postgresql_psycopg2', 'postgresql', 'mysql', 'sqlite3' or 'oracle'.
DATABASE_NAME = 'rizk' # Or path to database file if using sqlite3. DATABASES = {
DATABASE_USER = 'root' # Not used with sqlite3. 'default': {
DATABASE_PASSWORD = '' # Not used with sqlite3. 'ENGINE': 'django.contrib.gis.db.backends.postgis',
DATABASE_HOST = '' # Set to empty string for localhost. Not used with sqlite3. 'NAME': 'rizk',
DATABASE_PORT = '' # Set to empty string for default. Not used with sqlite3. # 'USER': ,
# 'PASSWORD': env('POSTGRES_PASSWORD'),
# 'HOST':
}
}
# DATABASE_ENGINE = 'mysql' # 'postgresql_psycopg2', 'postgresql', 'mysql', 'sqlite3' or 'oracle'.
# DATABASE_NAME = 'rizk' # Or path to database file if using sqlite3.
# DATABASE_USER = 'root' # Not used with sqlite3.
# DATABASE_PASSWORD = '' # Not used with sqlite3.
# DATABASE_HOST = '' # Set to empty string for localhost. Not used with sqlite3.
# DATABASE_PORT = '' # Set to empty string for default. Not used with sqlite3.
# Local time zone for this installation. Choices can be found here: # Local time zone for this installation. Choices can be found here:
# http://en.wikipedia.org/wiki/List_of_tz_zones_by_name # http://en.wikipedia.org/wiki/List_of_tz_zones_by_name
@ -68,8 +79,8 @@ TEMPLATE_CONTEXT_PROCESSORS = (
# List of callables that know how to import templates from various sources. # List of callables that know how to import templates from various sources.
TEMPLATE_LOADERS = ( TEMPLATE_LOADERS = (
'django.template.loaders.filesystem.load_template_source', 'django.template.loaders.filesystem.Loader',
'django.template.loaders.app_directories.load_template_source', 'django.template.loaders.app_directories.Loader',
# 'django.template.loaders.eggs.load_template_source', # 'django.template.loaders.eggs.load_template_source',
) )
@ -77,7 +88,7 @@ MIDDLEWARE_CLASSES = (
'django.middleware.common.CommonMiddleware', 'django.middleware.common.CommonMiddleware',
'django.contrib.sessions.middleware.SessionMiddleware', 'django.contrib.sessions.middleware.SessionMiddleware',
'django.contrib.auth.middleware.AuthenticationMiddleware', 'django.contrib.auth.middleware.AuthenticationMiddleware',
'debug_toolbar.middleware.DebugToolbarMiddleware', # 'debug_toolbar.middleware.DebugToolbarMiddleware',
) )
ROOT_URLCONF = 'urls' ROOT_URLCONF = 'urls'
@ -97,8 +108,7 @@ INSTALLED_APPS = (
'django.contrib.admin', 'django.contrib.admin',
'django.contrib.gis', 'django.contrib.gis',
'egypt', 'egypt',
'debug_toolbar', # 'django_extensions'
'django_extensions',
) )
#overwrite default settings with local settings #overwrite default settings with local settings

View File

@ -96,7 +96,7 @@ $(function() {
$('.eventSelected').removeClass('eventSelected'); $('.eventSelected').removeClass('eventSelected');
$(this).addClass('eventSelected'); $(this).addClass('eventSelected');
} }
var eventId = $(this).data('id'); var eventId = $(this).attr('data-id');
$('#media').html("Loading..."); $('#media').html("Loading...");
$.getJSON("eventMedia", {'id': eventId}, function(data) { $.getJSON("eventMedia", {'id': eventId}, function(data) {
// console.log(data); // console.log(data);