misc: drop unused template variable model (#31205)
This commit is contained in:
parent
6792df1742
commit
e2eff9d82a
|
@ -1,7 +1,6 @@
|
|||
from django.contrib import admin
|
||||
|
||||
from .models import ApiUser, TemplateVar, AccessRight
|
||||
from .models import ApiUser, AccessRight
|
||||
|
||||
admin.site.register(ApiUser)
|
||||
admin.site.register(TemplateVar)
|
||||
admin.site.register(AccessRight)
|
||||
|
|
|
@ -1,15 +0,0 @@
|
|||
# -*- coding: utf-8 -*-
|
||||
|
||||
from django.conf import settings
|
||||
from .models import TemplateVar
|
||||
|
||||
def template_vars(request):
|
||||
"""
|
||||
returns a dict with all the template vars, build from settings and database
|
||||
"""
|
||||
vars = {}
|
||||
if hasattr(settings, 'TEMPLATE_VARS'):
|
||||
vars.update(settings.TEMPLATE_VARS)
|
||||
vars.update(dict((obj.name, obj.value) for obj in TemplateVar.objects.all()))
|
||||
|
||||
return vars
|
|
@ -86,14 +86,6 @@ class ApiUser(models.Model):
|
|||
api_user.save()
|
||||
|
||||
|
||||
class TemplateVar(models.Model):
|
||||
name = models.CharField(max_length=64)
|
||||
value = models.CharField(max_length=128)
|
||||
|
||||
def __unicode__(self):
|
||||
return u'%s - %s' % (self.name, self.value)
|
||||
|
||||
|
||||
class InheritanceManager(ModelUtilsInheritanceManager):
|
||||
|
||||
def get_slug(self, slug, request=None):
|
||||
|
|
|
@ -100,7 +100,6 @@ TEMPLATES = [
|
|||
'django.template.context_processors.tz',
|
||||
'django.contrib.messages.context_processors.messages',
|
||||
'django.template.context_processors.request',
|
||||
'passerelle.base.context_processors.template_vars',
|
||||
],
|
||||
},
|
||||
},
|
||||
|
|
|
@ -39,27 +39,10 @@ from zeep import Client
|
|||
from zeep.cache import InMemoryCache
|
||||
from zeep.transports import Transport
|
||||
|
||||
from passerelle.base.context_processors import template_vars
|
||||
from passerelle.base.models import ApiUser, AccessRight, BaseResource
|
||||
from passerelle.base.signature import check_query, check_url
|
||||
|
||||
|
||||
def get_template_vars():
|
||||
"""
|
||||
returns the template vars as dict, to be used in apps code
|
||||
"""
|
||||
from django.http import HttpRequest
|
||||
return template_vars(HttpRequest())
|
||||
|
||||
|
||||
def render_template_vars(value):
|
||||
"""
|
||||
renders the template vars in a string
|
||||
"""
|
||||
template = Template(value)
|
||||
return template.render(Context(get_template_vars()))
|
||||
|
||||
|
||||
def response_for_json(request, data):
|
||||
response = HttpResponse(content_type='application/json')
|
||||
json_str = json.dumps(data)
|
||||
|
|
Loading…
Reference in New Issue