Actually it looks like he is just getting extra links, which seems to remind me of a Safari issue and the Doc type that is set. If I remember correctly I ran into an issue similar to this where Safari was attempting to fix my HTML to fit my specified Doc-Type. So if I had to guess I would say that what ever Doc-Type you are setting does not allow <li> to be a child of the <a> tag. Try moving your link inside the <li> and see if it still produced unexpected results.
Dj Gilcrease OpenRPG Developer ~~http://www.openrpg.com On Thu, Dec 4, 2008 at 7:58 PM, Malcolm Tredinnick <[EMAIL PROTECTED]> wrote: > > > On Thu, 2008-12-04 at 18:49 -0800, DragonSlayre wrote: >> Hi, >> >> for some reason my hyperlink is not coming out as I expect it to. >> Here is my code in my template: >> >> <ul class="little_category"> >> {% for category in categories %} >> <a href="{% url category-listing category.name|lower %}"> >> <li class="{{ parent.name|lower }}" style="border:solid red >> 1px;">{{ category.name }}</li> >> </a> >> {% endfor %} >> </ul> >> >> The outcome is the following html code: >> >> <ul class="little_category"> >> <a href="/listings/category/books/"> </a> >> <li class="goods" style="border: 1px solid red;"> >> <a href="/listings/category/books/">Books</a> >> </li> >> <a href="/listings/category/books/"> </a> >> </ul> >> >> I've checked and I only have one 'little' category - the Books >> category. >> I'm expecting the html to appear as the following: >> >> <ul class="little_category"> >> <a href="/listings/category/books/"> >> <li class="goods" style="border: 1px solid red;">Books</li> >> </a> >> </ul> >> >> Does anybody know what might be going on? > > Doesn't seem to be any Django problem here, but you'll want to look at > carefully at your view function, or possible your model definition. > > It seems that category.name is not returning what you think it should. > Since that is the only thing your template is inserting insider the "li" > element, and since the output shows a URL in there, that is what > category.name must be returning. > > You haven't shown us what "categories" contains or what the "category" > object is, so I can only go on what you've pasted. But the thing between > the <li> and </li> tags is indicative of the problem. You are actually > seeing exactly the right template output for one item in the list (one > link outside the "li" element and something inside the "li" element), > but the inserted content -- the non-template stuff -- is not what > expected. Since that's the portion that is generated by your own code > and data, that's the place to start looking. > > Regards, > Malcolm > > > > > --~--~---------~--~----~------------~-------~--~----~ 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 [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/django-users?hl=en -~----------~----~----~----~------~----~------~--~---