> On Jan 1, 3:23 pm,waltbrad<waltb...@hotmail.com> wrote:
>
> > Okay, I'm getting closer.

Well, I got all my templates to work.  Could someone tell me if it was
just me missing something or if there are mistakes in that book in
regards to tagging?  I've been following along with the Hedged Down
website and they have said nothing about that. But in the
link_detail.html template in the book it says this:

{% if object.tags.count %}
     <p>This link is tagged with
     {% for tag in object.categories.all %}
             <a href="{{ tag.get_absolute_url }}">{{ tag.title }}</a>
             {% if forloop.last %}{% else %}
                     {% ifequal forloop.revcounter0 1 %}and {% else
%}, {% endifequal %}
             {% endif %}
     {% endfor %}
</p>
{% else %}
<p>This link doesn't have any tags.</p>

Now when I used this none of the tags would show up on the pages. I
always got "This link doesn't have any tags".
Then it hit me that the Link model doesn't have a category field. So
the "for tag in object.categories.all" code wouldn't work.

But, ultimately, what I had to do was load tagging_tags into the
template and use the template tags that are related to the django-
tagging application.  So, the code for having the template distinguish
between a link and an entry tag went like this:

<ul>
     {% load tagging_tags %}
     {% for item in object_list %}
          {% tagged_objects item in coltrane.Entry as goods %}
          {% if goods %}
               <li>
                     <a href="{% url entry-tag tag=item.name %}">
{{ item.name }}</a>
               </li>
          {% else %}
                <li>
                      <a href="{% url link-tag tag=item.name %}">
{{ item.name }}</a>
                </li>
          {% endif %}
      {% endfor %}
</ul>

I also had to load tagging_tags into the link_detail.html and work
with those tags to get the tags to show up for that page.

But at this point, I no longer need any help, but I sure would like to
know why nobody else mentioned this when blogging about this book.
And if there was an easier way to do this then the way I chose.
--~--~---------~--~----~------------~-------~--~----~
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