Is there any way to add template tags into javascript and css files? I would use it for anything from passing in urls to media url links (image paths, etc) to conditional javascript based on user permissions.
I just had a thought that maybe I can serve it up as if it were a template but have the url as my javascript file. Is that the o...
Hi. I have a view like this:
def form1(request):
if request.method == 'POST':
form = SyncJobForm(request.POST)
if form.is_valid():
# do something
in_progress = True
return render_to_response('form1.html', {'in_progress': in_progress})
I would like to know how to set it to refresh the templat...
Hi, does anyone know how this could properly be written in Django?
{{ mu.expiry_date|default:"{% trans 'Free User' %}"}}
Obviously, the above does not work since it contains a tag within a tag's filter.
...
if(len(f1) > 0):
for qs in profile_map:
up = Profile.objects.get(pk=qs.emp.id)
t_name = up.first_name + up.last_name
t_arr.append((q.profile.id,emp_name))
response_dictionary.update({'tarr':t_arr})
render_to_response('project/profile_table.html',context_instance=RequestContext(request,{'response_dict...
I don't know whether it's possible, but I'd like to be able to write something like the following:
{% with var1 var2 var3 as some_list %}
{{ some_list|maximum }}
{% endwith %}
Creating a list on the fly from an arbitrary number of template variables and/or literals seems useful, so I'm hopeful that I've overlooked something simple...
I'm trying to install django lfc on my server. Apart of zilions of different problems I've encountered now I'm struggling with TemplateDoesNotExist.
In my settings file I have set TEMPLATE_DIRS variable like this :
TEMPLATE_DIRS = (
"/home/snow4life/lfc/templates",
"/home/snow4life/lfc_theme/templates"
...
For example, I have a template file called:
filter.html
{{ title }}
code...
What I'd like to do is, on a separate template:
{% with "Filter by Types" as title %}
{% include "filter.html" %}
{% endwith %}
Currently it can't be done. Could someone explain why that is and an alternative way to achieve this?
Background context:
T...
This is more of a best-practices question, and given that I'm quite tired it mightn't make much sense.
I've been putting together a blog app as a learning experience and as an actual part of a website I am developing.
I've designed it like most apps so that you can list blog posts by multiple criteria i.e.
/blog/categories/
/blog/au...
Currently
I have an inclusion tag that is coded something like this:
@register.inclusion_tag('forms/my_insert.html', takes_context=True)
def my_insert(context):
# set up some other variables for the context
return context
In my template, I include it by putting in {% my_insert %}
New Feature Request
We now want to test a ne...