From 0c8906ffbde96473ceeaa6fe66416b0cc14dd315 Mon Sep 17 00:00:00 2001 From: j <0x006A@0x2620.org> Date: Wed, 7 Oct 2009 21:43:46 +0200 Subject: [PATCH] update oxjs params and setUrl, some more user functions --- backend/urls.py | 6 +++++- backend/views.py | 12 +----------- settings.py | 2 ++ static/js/ui.js | 7 ++++++- {backend => utils}/decorators.py | 0 5 files changed, 14 insertions(+), 13 deletions(-) rename {backend => utils}/decorators.py (100%) diff --git a/backend/urls.py b/backend/urls.py index 9f6d8611e..f738b46bf 100644 --- a/backend/urls.py +++ b/backend/urls.py @@ -28,7 +28,6 @@ urlpatterns = patterns("oxdb.backend.views", (r'^archive/(?P.+)/remove', 'remove_file'), (r'^file/parse', 'file_parse'), (r'^subtitle/get', 'subtitles'), - (r'^preferences', 'preferences'), # Example: # (r'^oxdata/', include('oxdata.foo.urls')), @@ -40,3 +39,8 @@ urlpatterns = patterns("oxdb.backend.views", # Uncomment the next line to enable the admin: # (r'^admin/(.*)', admin.site.root), ) + +#add user urls. login, logout, preferences etc +import user_management.urls +urlpatterns += user_management.urls.urlpatterns + diff --git a/backend/views.py b/backend/views.py index 9ae724e44..9dead9057 100644 --- a/backend/views.py +++ b/backend/views.py @@ -5,7 +5,6 @@ import re from datetime import datetime from urllib2 import unquote -from django.db import models from django.db.models import Q, Avg, Count from django.contrib.auth.models import User from django.shortcuts import render_to_response, get_object_or_404, get_list_or_404 @@ -14,10 +13,10 @@ from django.core.paginator import Paginator from django.contrib.auth.decorators import login_required from django.utils import simplejson as json from oxdb.utils.shortcuts import render_to_json_response +from oxdb.utils.decorators import login_required_json import models import utils -from decorators import login_required_json ''' field.length -> movie.sort.all()[0].field @@ -359,13 +358,4 @@ def file_parse(request): response = utils.parsePath(request.POST['path']) return render_to_json_response(response) -''' -POST preferences/get?key= -POST preferences/set?key=&value -''' -@login_required_json -def preferences(request): - oshash = request.POST['oshash'] - return '' - diff --git a/settings.py b/settings.py index 68870a799..9d7249bb3 100644 --- a/settings.py +++ b/settings.py @@ -22,6 +22,8 @@ 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. +#CACHE_BACKEND = 'memcached://127.0.0.1:11211/' + # Local time zone for this installation. Choices can be found here: # http://en.wikipedia.org/wiki/List_of_tz_zones_by_name # although not all choices may be available on all operating systems. diff --git a/static/js/ui.js b/static/js/ui.js index 0ef86b494..e782515d9 100644 --- a/static/js/ui.js +++ b/static/js/ui.js @@ -727,7 +727,7 @@ $(function() { sort: user.prefs.sortGroups, order: user.prefs.orderGroups, url: "/json/find", - params: ["g=country"] + params: {g:"country"} }).attr({ id: "groups" }); @@ -1062,6 +1062,11 @@ $(function() { }).attr({ id: "find" }).appendTo($topMenu.$element).trigger("blur"); + $find.change(function(that) { + var q = $(this).val(); + $main.setUrl("/json/find", {q:q}); + $mainBrowser.setUrl("/json/find", {g:"country", q:q}); + }); /* $find = $("") diff --git a/backend/decorators.py b/utils/decorators.py similarity index 100% rename from backend/decorators.py rename to utils/decorators.py