What's the best way to generate HTML which has a heading for each Category, and Products under that category in a Django template?
I toyed with the idea of having a passing a dictionary, or an ordered list...
...
I'm having some trouble using get_absolute_url in a template. It seems to work fine if I just pass in one of my store objects and say {{ store.get_absolute_url }}, but if I have to iterate through a dictionary of stores and then use the get_absolute_url function, it returns nothing. Exactly what I'm doing is below:
class Store(Ethical...
I can't post image because I'm new so here's a link of what I want.
So, I have the model on the left and I want the view on the right.
As of now, I'm looping over every thread I'm interested in. Template code:
{% for thread in threadlist %}
{% for post in thread.postlist %}
...
Model code:
class Thread (models.Model):
...
def po...
Jinja2 and Mako are both apparently pretty fast.
How do these compare to (the less featured but probably good enough for what I'm doing) string.Template ?
...
Hi guys, im using django-registration, all is fine, the confirmation email was sending in plain text, but know im fixed and is sending in html, but i have a litter problem... the html code is showing:
<a href="http://www.example.com/accounts/activate/46656b86eefc490baf4170134429d83068642139/">http://www. example.com/accounts/activate...
Hello ,
I have two models ,
class A(models.Model):
id = models.AutoField(primary_key=True)
name = models.CharField(max_length=200)
type = models.CHarFIeld(max_length=200)
..
..
..
class B(models.Model):
a= models.ForeignKey(A)
state = models.CharField(max_length=200)
now when i am seeing the page of class A i...
The django template doc mentions the following for extending templates:
{% extends variable %}
Where do I define the variable? Is it from the views.py?
...
hello, I want to call a function from my model at a template such as:
class ChannelStatus(models.Model):
..............................
..............................
def get_related_deltas(self,epk):
mystring = ""
if not self.get_error_code_delta(epk):
return mystring
else:
for i in self.get_listof_ou...
Hi,
is there anything built-in in Django templates that will allow me to compare two values? Similar to ifequal.
If not - what is the best solution for this?
...
Hello All,
I have a custom filter user_tz which takes user as an argument. It works fine everywhere, but when I tried to use this filter in the regroup tag it fails saying that user does not exist.
The code:
{% regroup proj_messages.object_list by created_on|user_tz:user as proj_message_list %}
This is the error I am getting:
Caught ...
hi all,
i am using django for development. retriving some text with newline from database. but when i render it to template and print in template do not show newline char.
what is the porblem ??
plz any one , if can help me
BR//
Nazmul
...
I review docs but I am lost... some problem with it:
{% load i18n %}
{% blocktrans %}
{{ wpis.entry.lastChangeDate|timesince }}
{% endblocktrans %}
Raise:
`KeyError: u'wpis.entry.lastChangeDate | timesince'`
Of course, without blocktrans all works fine.
So, what is simples way to translate few words? (I am interesting polish lang...
I'd like to display only the numbers that lie in the thousands position for a value i.e. 193000 will be displayed as 193 and so on. How do I achieve this, maybe at the template level?
...
I'm rendering a form. I would like to put a mark next to all the fields that must be filled in. Simple stuff usually... but I've no idea how to access that information!
{% if field.required %}REQUIRED!!{% endif %}
doesn't bring any love...
...
I'm trying to make a custom view in Django admin. I'm reading from this site, Simple Django Admin Preview, but I have a problem:
ValueError: invalid literal for int() with base 10: '13/preview'
Here is my url.py:
url(r'^admin/diligencias/diligencia/(?P<object_id>\d+)/preview/$','preview'),
Here is my view.py:
@staff_member_require...
I'm trying to make a Preview function. I'm reading this blog, Django Admin Preview, but now I have the following error and I don't know what it means.
Traceback (most recent call last):
File "/home/user/webapps/django/lib/python2.5/django/core/handlers/base.py", line 92, in get_response
response = callback(request, *cal...
Hi all,
I am trying to create a drop down list box with the selected value equal to a value passed from the template values, but with no success. Can anyone take a look and show me what I am doing wrong.
<select name="movie">
{% for movie in movies %}
{% ifequal movie.id selected_movie.id %}
<option value="{{movie.k...
Hi guys, good morning :), somebody know how use Openx (php app) with Django?, i need to use openx or similar soft for ads.
Thanks :)
...
I would like to provide the same content inside 2 different base files.
So I'm trying to do this:
page1.html:
{% extends "base1.html" %}
{% include "commondata.html" %}
page2.html:
{% extends "base2.html" %}
{% include "commondata.html" %}
The problem is that I can't seem to use both extends and include. Is there some way to d...
Hi all,
I have problem about django template-db query relationship.
For example, I created two tables in db (e.g. Menu & Submenu). Submenu, as you can guess, has a ForeignKey relationship with Menu.
On the template side how can Ido db-query according to this relationship. I want to have a link for Menu such as:
{% for menu in menu_li...