I'm thinking a bit about the concept of Django aggregates. I don't quite "get" how they can be used in my case. Basically i have a three-tier hierarchy of objects in my model, and the lowest object (Bar) contain values I want to aggregate.
class Bar(models.Model):
amount = models.FloatField()
class Foo(models.Model):
bars = mod...
I'm having some trouble figuring out the best/Djangoic way to do this. I'm creating something like an interactive textbook. It has modules, which are more or less like chapters. Each module page needs to list the topics in that module, grouped into sections.
My question is how I can ensure that they list in the correct order in the temp...
I would like something similar to the string formatting from the standard library.
'%' Percentage. Multiplies the number
by 100 and displays in fixed ('f')
format, followed by a percent sign.
...
I need to amend QuerySet data when i return it to a template.
for example, model.objects.all() returns a date (with other fields), but i also want to return the number of days since that date has passed. This is so that in the template, i can say "you last logged in 4 days ago".
What is the best way to do this?
...
i am trying to print a list of all the Conferences and for each conference, print its 3 Speakers.
in my template i have:
{% if conferences %}
<ul>
{% for conference in conferences %}
<li>{{ conference.date }}</li>
{% for speakers in conference.speakers %}
<li>{{ co...
Using Django templates in Google App Engine (on Python), is it possible to compare a template variable to an integer in an {% if %} block?
views.py:
class MyHandler(webapp.RequestHandler):
def get(self):
foo_list = db.GqlQuery(...)
...
template_values['foos'] = foo_list
template_values['foo_count'] =...
I have a middleware that does some processing. On certain conditions it raises an exception and the user sees my 500.html template - correctly responding to 500 http status.
Now, on some exceptions I would like to render different template than default 500.html. Is it possible/how to achieve that?
...
I just installed django-compress into /Library/Frameworks/Python.framework/Versions/2.6/lib/python2.6/site-packages/compress.
I added 'compress' to INSTALLED_APPS.
In my template file, I wrote {% load compressed %}. I got the error:
'compressed' is not a valid tag
library: Could not load template
library from
django.templat...
Hi guy's im using a Django app newsletter, but i want to translate the message's from the app to Spanish.. how ill translate in my template?
thanks
...
I'm using the Django Feeds Framework and it's really nice, very intuitive and easy to use. But, I think there is a problem when creating links to feeds in HTML.
For example:
<link rel="alternate" type="application/rss+xml" title="{{ feed_title }}" href="{{ url_of_feed }}" />
Link's HREF attribute can be easily found out, just use rev...
In which cases is it better to create template tags (and load them into the template), than creating a context processor (which fills the request automatically)?
e.g. I have a dynamic menu that has to be included into all templates, so I'm putting it into my base.html. What is the preferred usage: context processor or custom template ta...
I'm trying to output in bibtex format in Django and the template looks like this:
@{{ pubentry.type }{,
author = {{% for author in pubentry.authors.all %}{{ author.first_name }} {{ author.middle_name }} {{ author.last_name }}{% if not forloop.last %} and {% endif %}
{% endfor %}},
title = {{{ pubentry.title }}},...
I am new to the Django framework.
On Django's admin index page I'd like to get rid of the "s" at the end of my model names.
Example:
<div class="module">
<table summary="Models available in the my application.">
<caption><a href="" class="section">My application</a></caption>
<tr>
<th scope="row"><a ...
I'm in the process of re-setting up my Django development environment after reinstalling my OS. We use django-photologue with our project, which I installed using easy_install. However, I'm getting a template error on every template that has a photologue photo:
TemplateSyntaxError at /newsroom/news/
Caught an exception while render...
I have created a template for 500 http error.
I have insert my template 500.html in:
1) /project/
2) /project/templates/
3) /python2.5/
4) /python2.5/templates/
.
but I always get this error:
TemplateDoesNotExist: 500.html
Same problem for Http 404 error.
WHY ???
...
I'm trying to extend the basic user registration form and profile included in satchmo store, but I'm in problems with that.
This what I've done:
Create a new app "extendedprofile"
Wrote a models.py that extends the satchmo_store.contact.models class and add the custom name fields.
wrote an admin.py that unregister the Contact class ...
I have a Customer table and one of the fields here is for Status....I want to have the background colour of the cell containing this field to be set according to it's value e.g green for the status "Closed"; yellow for the status "Pending" and so on.
What's the best way to do this...possibly something that'll be easy to modify if need ...
Hi guys, there is any way to make a Break Page with django for using with large articles?
thanks
...
Hi, I' m trying to build a Django TemplateLoader, but I can't make it 'see' either the current Context or Request, so I can't really do much with it.
Does anyone know how I can make a Django TemplateLoader do this?
Many Thanks
Joe
...
In my base.html file, I am using
{% if user.is_authenticated %}
<a href="#">{{user.username}}</a>
{% else %} <a href="/acc/login/">log in</a>
Here, even if the user is logged in, the log in button shows up.
Now when I click on the log in link, it shows the username and also the normal login view, saying user is logged in.
So, what's w...