hi I am new to django..and was trying out the permalink method I have defined a get_absolute_url for my Entry class and used permalink.
class MyEntry(models.Model): pub_time=models.DateTimeField(default=datetime.now) mycategory=models.ForeignKey() def __unicode__(self): return "%s%s"%(self.mycategory.name,self.pub_time) def get_absolute_url(self): return ('myapp_entry_detail',[self.id]) get_absolute_url=models.permalink(get_absolute_url) In my urls/entries.py I have given these url mappings (r'^(?P<id>\d+)/$' ,'myapp.views.entry_detail','myapp_entry_detail'), (r'^$','myapp.views.entry_archive_index'), and in the archive template am using the get_absolute_url like {% for x in object_list %} <a href="{{x.get_absolute_url }}" > {{x}} </a> {% endfor %} where object_list is passed to the template in entry_index method def entry_archive_index(request): entryset=MyEntry.objects.all() entry_info={'object_list' : entryset} return render_to_response('myapp/myentry_archive.html',entry_info) Still when the archive page shows all the created entries,the link on them doesn't point to the entry detail url which should be like myapp/ 1/ where 1 is the id of created entry. (When I hardcode 'return "/myapp/%i/"% self.id ' in the get_absolute_url of the class ,it works.But I know that is not the correct way ) When I checked the source of archive page the url part looks like this <a href="" > MyCat2009-12-27 01:00:36 </a> Can someone give me some pointer to correct this? thanks jim -- You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to django-us...@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.