only load site.json once
This commit is contained in:
parent
63bf8825a2
commit
bff70fcc64
2 changed files with 5 additions and 7 deletions
|
@ -9,6 +9,7 @@ from django.conf import settings
|
||||||
|
|
||||||
from ox.utils import json
|
from ox.utils import json
|
||||||
|
|
||||||
|
from app.models import site_config
|
||||||
|
|
||||||
class UserProfile(models.Model):
|
class UserProfile(models.Model):
|
||||||
reset_token = models.TextField(blank=True, null=True, unique=True)
|
reset_token = models.TextField(blank=True, null=True, unique=True)
|
||||||
|
@ -50,9 +51,7 @@ def get_user_json(user):
|
||||||
|
|
||||||
|
|
||||||
def get_ui(user):
|
def get_ui(user):
|
||||||
with open(os.path.join(settings.PROJECT_ROOT, 'templates', 'site.json')) as f:
|
return site_config['user']['ui']
|
||||||
site = json.load(f)
|
|
||||||
return site['user']['ui']
|
|
||||||
'''
|
'''
|
||||||
return {
|
return {
|
||||||
"columns": ["id", "title", "director", "country", "year", "language", "genre"],
|
"columns": ["id", "title", "director", "country", "year", "language", "genre"],
|
||||||
|
|
|
@ -19,7 +19,7 @@ import ox
|
||||||
import models
|
import models
|
||||||
|
|
||||||
from api.actions import actions
|
from api.actions import actions
|
||||||
|
from app.models import site_config
|
||||||
|
|
||||||
class SigninForm(forms.Form):
|
class SigninForm(forms.Form):
|
||||||
username = forms.TextInput()
|
username = forms.TextInput()
|
||||||
|
@ -100,9 +100,8 @@ def signout(request):
|
||||||
if request.user.is_authenticated():
|
if request.user.is_authenticated():
|
||||||
response = json_response(text='logged out')
|
response = json_response(text='logged out')
|
||||||
logout(request)
|
logout(request)
|
||||||
with open(os.path.join(settings.PROJECT_ROOT, 'templates', 'site.json')) as f:
|
|
||||||
site = json.load(f)
|
response['data']['user'] = site_config['user']
|
||||||
response['data']['user'] = site['user']
|
|
||||||
return render_to_json_response(response)
|
return render_to_json_response(response)
|
||||||
actions.register(signout)
|
actions.register(signout)
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue