I've made a Django site, but I've drank the Koolaid and I want to make an IPhone version. After putting much thought into I've come up with two options:
Make a whole other site, like i.xxxx.com. Tie it into the same database using Django's sites framework.
Find some time of middleware that reads the user-agent, and changes the templa...
I have a Google App Engine that has a form. When the user clicks on the submit button, AJAX operation will be called, and the server will output something to append to the end of the very page where it comes from. How, I have a Django template, and I intend to use jquery. I have the following view:
<html>
<head>
<title></title>
<script...
I need to perform a filtered query from within a django template, to get a set of objects equivalent to python code within a view:
queryset = Modelclass.objects.filter(somekey=foo)
In my template I would like to do
{% for object in data.somekey_set.FILTER %}
but I just can't seem to find out how to write FILTER.
...
In my django application I am using a template to construct email body, one of the parameters is url, note there are two parametes separated by ampersand in the url.
t = loader.get_template("sometemplate")
c = Context({
'foo': 'bar',
'url': 'http://127.0.0.1/test?a=1&b=2',
})
print t.render(c)
Af...
Given a Django.db models class:
class P(models.Model):
type = models.ForeignKey(Type) # Type is another models.Model class
name = models.CharField()
where one wishes to create a new P with a specified type, i.e. how does one make "type" to be a default, hidden field (from the user), where type is given likeso:
http://x.y/P/new?...
Am working with django Publisher example, I want to list all the publishers in the db via my list_publisher.html template, my template looks like;
{% extends "admin/base_site.html" %}
{% block title %}List of books by publisher{% endblock %}
{% block content %}
<div id="content-main">
<h1>List of publisher:</h1>
{%regroup publisher by...
I'm trying to do the following in my Django template:
{% for embed in embeds %}
{% embed2 = embed.replace("<", "<") %}
{{embed2}}<br />
{% endfor %}
However, I always get an invalid block or some syntax error when I do anything like that (by that I mean {% %} code inside a loop). Python doesn't have {} to si...
Hi!
I have a django project pro1 with several apps: app1, app2, app3 and so on. I want to display some top level template that contains blocks from each and every app:
example_base_template.html:
[header /]
[left nav bar]{{ app1 rendered template }}[/left nav bar]
[right nav bar]{{ app2 rendered template }}[/right nav bar]
[center secti...
I have a list of objects, each with it's own checkbox, where the user can select multiple of these. The list is a result of a query.
How can I mark in the view which checkboxes are already selected? There doesn't seem to be an in operator in the template language.
I want something along the lines of:
<input {% if id in selectedIds %}c...
I have a list of articles, and each article belongs to a section.
class Section(models.Model):
name = models.CharField(max_length=200)
def __unicode__(self):
return self.name
class Article(models.Model):
section = models.ForeignKey(Section)
headline = models.CharField(max_length=200)
# ...
I want to display the article...
Hello,
When i render a page using the Django template renderer, i can pass in a dictionary variable containing various values so i can manipulate them in the page using {{ myVar }}.
Is there a way to access the same variable in Javascript (perhaps using the DOM, i don't know how Django makes the variables accessible), i want to be able...
For 2 child template files inheriting a block, the {{ block.super }} does not resolve
Python 2.5.2, Django 1.0, Windows XP SP3
Sample skeleton code for files involved:
base.html
item_base.html
show_info_for_all_items.html
show_info_for_single_item.html
FILE : base.html
{% block content %}
{% endblock %}
FILE : item_base.html
{%...
I have my models and i would like to make use of the Django change_form template to edit my data, currently i have created my own template that works fine but lacks some of the basic stuff that change_form template might have, like fields validation.
Please give examples showing how i should call the template from my view, and what obje...
I'm trying to make a pull down menu post a form when the user selects (releases the mouse) on one of the options from the menu. This code works fine in FF but Safari, for some reason, doesn't submit the form. I re-wrote the code using jquery to see if jquery's .submit() implementation handled the browser quirks better. Same result, wo...
I am writing a custom tag in Django that should output a value stored in a user session, but I cannot find a way to access the session object from within a custom tag function. Is there any way to do this, without manually assigning the session object to a context variable?
...
Pretty new to this scene and trying to find some documentation to adopt best practices. We're building a fairly large content site which will consist of various media catalogs and I'm trying to find some comparable data / architectural models so that we can get a better idea of the approach we should use using a framework we've never ma...
I have a Client and Groupe Model.
A Client can be part of multiple groups.
Clients that are part of a group can use its group's free rental rate at anytime but only once. That is where the intermediary model (ClientGroupe) comes in with that extra data.
For now, when I try to save the m2m data, it just dies and says I should use the C...
I have a class Person which can have several Homes, each one with one or many Phone numbers.
I have defined the classes, but now i am trying to create a view wich list every person, with all its homes and all the phone numbers for each home address... something like:
john smith
123 fake str
305-99-8877
305-99-8876
321 oak road
44...
I have two completely different forms in one template. How to process them in one view? How can I distinguish which of the forms was submitted? How can I use prefix to acomplish that? Or maybe it's better to write separate views?
regards
chriss
...
I have two templatetags in my app which contain forms which show entries in db. When I alter data or add new entry to db, the forms show the old data. While in admin panel everything is correct (updated). When I restart the server (I mean manage.py runserver) forms show updated db entries. How to make the forms show updated data?
regard...