I'm looking for the templates engine for Java with syntax like in Django templates or Twig (PHP). Is it exists?
Update:
The target is to have same templates files for different languages.
File index.tpl
{{head}}
{{ var|escape }}
{{body}}
can be rendered from python (Django) code as well as from PHP, using Twig.
I'm looking for Java ...
Hi,
is there a way to create a Django snippet that has logic?
I think about something like contact template tag:
{% contact_form %}
with template:
<form action="send_contact_form" method="POST">...</form>
with logic:
def send_contact_form():
...
I want to be able to use it anywhere in my projects. It should work only by sp...
Hi folks...I have a dictionary with embedded objects, which looks something like this:
notes = {
2009: [<Note: Test note>, <Note: Another test note>],
2010: [<Note: Third test note>, <Note: Fourth test note>],
}
I'm trying to access each of the note objects inside a django template, and having a helluva time navigating to them...
My models:
class Order(models.Model):
ordered_by = models.ForeignKey(User)
reasons = models.ManyToManyField(Reason)
class Reason(models.Model):
description = models.CharField()
Basically a user creates an order and gives reasons for that order. ie, john has two orders (one for pencils because he is out AND because he doesn...
Hi All,
I'm a little stuck trying to get my head around a django template.
I have 2 objects, a cluster and a node
I would like a simple page that lists...
[Cluster 1]
[associated node 1]
[associated node 2]
[associated node 3]
[Cluster 2]
[associated node 4]
[associated node 5]
[associated node 6]
I've been using Django for about ...
Here's a common situation that I have and wish to avoid creating tedious loops and fiddling with html tables:
I have a model Movie, which is has fkeys to Director and to Genre.
How can I elegantly render a simple data table that has on one axis the different Directors, on another axis the different Genres, and inside each cell the coun...
I have a problem with needing to provide multiple model backed forms on the same page. I understand how to do this with single forms, i.e. just create both the forms call them something different then use the appropriate names in the template.
Now how exactly do you expand that solution to work with modelformsets? The wrinkle, of cour...
I'm rendering a template with a management command (something I need
for producing documentation in my native language). So I've no request
object, so no RequestContext. Is there a way I can force the template
rendering process to lookup translation strings from a particular
language other than English?
...
I'm using
{% url facebook_xd_receiver %}
in one of my HTML files. This works just fine when I run my project using the command
python manage.py runserver
But the same project stops running and gives me a "TemplateSyntaxError" at the line
{% url facebook_xd_receiver %}
Can anyone please tell me what could be the difference betwe...
Hey,
I want to do something like
return render_to_response("http://docs.google.com/View?id=bla", args)
and serve an external page with django arguments. Django doesn't like this (it looks for templates in very particular places).
What's the easiest way make this work? Right now I'm thinking to use urllib to save the page to somewh...
I have a problem with my accented characters. Django admin saves my data without encoding to something like "á"
Example: if im trying to use a word like "Canción", i would like it to save in this way: Canción, and not Canción.
i have in my SETTING: DEFAULT_CHARSET = 'utf-8'
i have in my mysql database: utf8_general_ci
I...
Lets say I have an application with a structure such as:
System
set date
set name
set something
Other
set death ray target
calibrate
and I want to have "back" and "next" buttons on a page. The catch is, if you're going in via the "wizard", I want the nav path to be something like "set name" -> "set death ray target" -> "set ...
def _table_(request,id,has_permissions):
dict = {}
dict.update(get_newdata(request,rid))
return render_to_response('home/_display.html',context_instance=RequestContext(request,{'dict': dict, 'rid' : rid, 'has_permissions' : str(has_permissions)}))
In templates the code is as,
{% if has_permissions == "1" %}
<input type="b...
In models,
class Getdata(models.Model):
title = models.CharField(max_length=255)
state = models.CharField(max_length=2, choices=STATE, default="0")
name = models.ForeignKey(School)
created_by = models.ForeignKey(profile)
def __unicode__(self):
return self.id()
In templates
<form>
<input type="submit" s...
Hi All,
What I'd like to do (for a recent changes 'widget' - not a django widget in this case) is pass a urlname into my template as a variable, then use it like so: {% url sitechangeobject.urlname %} Where urlname is a string containing a valid name for a url.
Is this possible? The template keeps breaking saying it can't find sitechan...
I have built a Macro language for my users that is based upon the Django template language. Users enter into UITextFields their template/macro snippets that can be rendered in the context of larger documents. So I have large multi-line string snippets of django template code that should be populated with variables that are also stored ...
How do you print out "{{text}}" in a Django template? If I type it into a Django html template it gets interpreted as the variable text. I want the actual text:
{{text}}
To appear in the html output.
...
I am looking for a basic Django application that "looks good" and has basic menus etc. that I could adapt for my own use. I am not doing any fancy processing of user input, but I do want to reuse an existing templates so that I don't have to worry about writing my own CSS/HTML to get clean, valid good looking webpages. Many of the Djan...
<?php
session_start();
$_SESSION['username'] = "johndoe" // Must be already set
?>
How to write equivalent code for the above in django
...
Hello !
I am obviously victim of some dark magic...
Here is a template that I render :
context = Context({'my_cube': c})
template = Template(
'{% load cube_templatetags %}'
'{{ my_cube|inspect }} {{ my_cube.measure }}'
)
Here is the implementation of the inspect filter :
def inspect_object(obj):
return obj.measure()
He...