Double curly brackets {{ }} are used for variable substitution. These
brackets: {% %} are used for template tags, of which the for loop is
one. So you want:
{% for et in entity.entity_type.all %}
Yours,
Eric
On May 25, 2008, at 6:59 PM, M.Ganesh wrote:
>
> Hi All,
>
> Unable to find a relevent info in the mail archives/ documentation.
> I am
> getting this error :
>
> TemplateSyntaxError at /contacts/entity/8/show/
> Could not parse the remainder: ' et in entity.entity_type.all' from
> 'for
> et in entity.entity_type.all'
>
> #my model
> class entity(models.Model):
> name = models.CharField(max_length=25, unique=True, db_index=True)
> full_name = models.CharField(max_length=100)
> entity_type = models.ManyToManyField(entity_type, blank=True)
>
> def __unicode__(self):
> return self.name
>
> class Admin:
> list_display = ('name', 'full_name')
>
> class Meta:
> ordering = ["name"]
> app_label = 'contacts'
>
>
> class entity_type(models.Model):
> name = models.CharField(max_length=50)
>
> def __unicode__(self):
> return self.name
>
> class Admin:
> pass
>
> class Meta:
> ordering = ["name"]
> app_label = 'contacts'
>
> #my template_snippet
> {{ entity.name }}<br>
> {{ entity.full_name }}<br>
> {{entity.entity_type.count }}<br><br>
> {{ for et in entity.entity_type.all }} <---- {{ for et in
> entity.entity_type_set.all }} also doesn't work
> {{ et.name }}<br>
> {{ endfor}}
>
> How do I get a list of entity_type given a entity instance?
>
> Thanks in advance
>
> Regards Ganesh
>
>
> >
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups
"Django users" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at
http://groups.google.com/group/django-users?hl=en
-~----------~----~----~----~------~----~------~--~---