Browse Source

upgrade to django 1.4, remove unneeded dependencies

master
Sanjay Bhangar 6 years ago
parent
commit
2148ac7e2b
  1. 7
      requirements.txt
  2. 15
      rizk/egypt/views.py
  3. 32
      rizk/settings.py
  4. 2
      rizk/static/js/rizk.js

7
requirements.txt

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

15
rizk/egypt/views.py

@ -2,10 +2,10 @@
from django.shortcuts import render_to_response
from django.http import HttpResponse
from django.shortcuts import get_object_or_404
from oxdjango.shortcuts import render_to_json_response
from django.core.mail import send_mail
from models import *
from settings import GOOGLE_MAPS_API_KEY as gkey
import json
QUESTIONS = {
'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?'
}
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):
features = []
for l in Location.objects.all():

32
rizk/settings.py

@ -16,12 +16,23 @@ ADMINS = (
MANAGERS = ADMINS
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.
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.
DATABASES = {
'default': {
'ENGINE': 'django.contrib.gis.db.backends.postgis',
'NAME': 'rizk',
# '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:
# 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.
TEMPLATE_LOADERS = (
'django.template.loaders.filesystem.load_template_source',
'django.template.loaders.app_directories.load_template_source',
'django.template.loaders.filesystem.Loader',
'django.template.loaders.app_directories.Loader',
# 'django.template.loaders.eggs.load_template_source',
)
@ -77,7 +88,7 @@ MIDDLEWARE_CLASSES = (
'django.middleware.common.CommonMiddleware',
'django.contrib.sessions.middleware.SessionMiddleware',
'django.contrib.auth.middleware.AuthenticationMiddleware',
'debug_toolbar.middleware.DebugToolbarMiddleware',
# 'debug_toolbar.middleware.DebugToolbarMiddleware',
)
ROOT_URLCONF = 'urls'
@ -97,8 +108,7 @@ INSTALLED_APPS = (
'django.contrib.admin',
'django.contrib.gis',
'egypt',
'debug_toolbar',
'django_extensions',
# 'django_extensions'
)
#overwrite default settings with local settings

2
rizk/static/js/rizk.js

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

Loading…
Cancel
Save