I'm going to take a flier and guess that you want this to be conditional on
the name of the class of an instance passed in the context.  That is, you
have a model class Foo, maybe another named Bar that you have an instance of
the class, e.g.; x = Foo.objects.get(pk=1), and that you're passing it into
a template, e.g.; context(..., model=x,...).

In this case, try something like:

{% ifequal model.__class__.__name__ "Foo" %}
...

Remember, you can always temporarily add something like {{ model.name }} to
the text to see what you're comparing to that string.

Bill

On Wed, Sep 2, 2009 at 11:44 AM, Sandra Django <sandradja...@gmail.com>wrote:

> Hi friends, Can I do a condition depending on my model name? For example, I
> did that:
> {% ifequal model.name "Mymodelname" %}
>      do something
> {% endifequal %}
>
> But don't work. Someone could help me?
>
> >
>

--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@googlegroups.com
To unsubscribe from this group, send email to 
django-users+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to