I have this model with an get_absolute_url method.



class Country(models.Model):
    country_cd = models.CharField(max_length=2, primary_key=True)
    country = models.CharField(max_length=80, blank=True)
    slug = models.CharField(max_length=80, blank=True)
    class Meta:
        db_table = u'country'

    def __unicode__(self):
        return self.country

    def get_absolute_url(self):
        return 'lobby/country/%s/' % self.slug


using this in a template

{% for country in country_list %}

<li><a href ="{{country.get_absolute_url }}">{{ country.country }}</
a></li>

gets me a list of countries.

*Algeria
*Australia
*Afghanistan
etc

But when I put my mouse over the links or click on the links instead
of getting   'http://localhost:8000/lobby/country/algeria' for
example, I get
 'http://localhost:8000/lobby/country/lobby/country/egypt'. Anyone
have an idea of why its adding the extra text onto the url? I've done
this before and have not have a problem. In fact the code and
templates are from another app and they work just fine.


--~--~---------~--~----~------------~-------~--~----~
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