Re: Rendering ManyToManyField in template

2008-01-03 Thread Rodrigo Culagovski
Rajesh, I was missing the ".all" attribute in my previous attempts. Thanks, Rodrigo On Jan 3, 7:17 pm, Rajesh Dhawan <[EMAIL PROTECTED]> wrote: > Hi, > > > > > {% block content %} > > {{articulo}} > > > > identificadores:{{articulo.identificadores}} > > > > {% endblock %} >

Re: Rendering ManyToManyField in template

2008-01-03 Thread Rajesh Dhawan
Hi, > > {% block content %} > {{articulo}} > > identificadores:{{articulo.identificadores}} > > {% endblock %} Since you can have many identificadores, you need to do something like this in your template: {% for ix in articulo.identificadores.all %} {{ ix.identificador }}

Re: Rendering ManyToManyField in template

2008-01-03 Thread Rodrigo Culagovski
Fixed it, in the class definition: @property def ids(self): return ' - '.join([a['identificador'] for a in self.identificadores.values()]) On Jan 3, 6:36 pm, Rodrigo Culagovski <[EMAIL PROTECTED]> wrote: > I forgot to show the identificadores class: > > --- > class Identificador(mo

Re: Rendering ManyToManyField in template

2008-01-03 Thread Rodrigo Culagovski
I forgot to show the identificadores class: --- class Identificador(models.Model): identificador = models.CharField(max_length=200,unique=True) def __unicode__ (self): return self.identificador class Admin: pass class Meta: verbose_name_plural = "identif

Rendering ManyToManyField in template

2008-01-03 Thread Rodrigo Culagovski
Hi, I am trying to render the contents of a ManyToManyField in a template. However, when viewing the page, instead of the contents, it shows: "" I understand why this is happening, sort of, but haven't been able to fix it. The field is called "identificadores", deifned in the class "Articulo" as