only load site.json once

This commit is contained in:
j 2011-01-03 19:55:51 +05:30
parent 63bf8825a2
commit bff70fcc64
2 changed files with 5 additions and 7 deletions

View file

@ -9,6 +9,7 @@ from django.conf import settings
from ox.utils import json
from app.models import site_config
class UserProfile(models.Model):
reset_token = models.TextField(blank=True, null=True, unique=True)
@ -50,9 +51,7 @@ def get_user_json(user):
def get_ui(user):
with open(os.path.join(settings.PROJECT_ROOT, 'templates', 'site.json')) as f:
site = json.load(f)
return site['user']['ui']
return site_config['user']['ui']
'''
return {
"columns": ["id", "title", "director", "country", "year", "language", "genre"],

View file

@ -19,7 +19,7 @@ import ox
import models
from api.actions import actions
from app.models import site_config
class SigninForm(forms.Form):
username = forms.TextInput()
@ -100,9 +100,8 @@ def signout(request):
if request.user.is_authenticated():
response = json_response(text='logged out')
logout(request)
with open(os.path.join(settings.PROJECT_ROOT, 'templates', 'site.json')) as f:
site = json.load(f)
response['data']['user'] = site['user']
response['data']['user'] = site_config['user']
return render_to_json_response(response)
actions.register(signout)