Hi. Instead of manually writing the url, you can instead use the {% url %} tag, then Django would figure out what the correct url is. If you are using url tags you should considder using named urls. The link with url tag would end up something like this: <a href="{% url mysite.library.views.listing_view id=n.id % }">{{n.list_channel}}</a>
read about the url tag in the Django Doc http://docs.djangoproject.com/en/dev/ref/templates/builtins/?from=olddocs#url -Briel Praveen skrev: > MODELS.py > > class Listing_channels(models.Model): > list_channel = models.CharField(max_length = 20) > visibility = models.BooleanField() > > def __unicode__(self): > return self.list_channel > > class Listing(models.Model): > name = models.CharField(max_length=20) > description = models.TextField(max_length = 100) > website = models.URLField() > timing = models.CharField(max_length=20) > channels = models.ForeignKey(Listing_channels) > visibility = models.BooleanField() > > def __unicode__(self): > return self.name > > URLS.py > > (r'^category/listing_view/(?P<id>\w+)/ > $','mysite.library.views.listing_view'), > > VIEWS.py > > def listing_view(request, id): > report_list = get_object_or_404(Listing_channels, pk = id) > listing_result = Listing_channels.objects.all() > r = report_list. listing_set.all() > print r > return render_to_response("list_listing.html", {'report_list' : > report_list,'r':r,'listing_result':listing_result}) > > > list_listing.html > > <div id="leftpart"> > <h3>Sight Seeings</h3> > <ul> > {%if listing_result %} > {% for n in listing_result %} > <li><a href="{{n.id}}">{{n.list_channel}}</a></li> > {% endfor %} > {% else %} > <p>not available</p> > {% endif %} > </ul> > </div> > <div class="one"> > {% if report_list %} > > <table> > <tr> > <td colspan="2" style="padding-left:140px;" > height="100px"><b>Sight > Seeings Details</b></td> > </tr> > <tr> > <td colspan="2" align="center"></td> > </tr> > {% for t in r %} > <tr> > <td>{{ t.name }}</td> > </tr> > <tr> > <td>{{ t.timing }}</td> > </tr> > <tr> > <td>{{ t.description }}</td> > </tr> > <tr> > <td><a href="#">{{ t.website }}</a></td> > </tr> > <tr><td></td></tr> > {% endfor %} > </table> > {% else %} > <p><b>No names found<b></p> > > {% endif %} > </div> > > I am displaying Listing_channels and Listing on same page. if some one > click on any Listing_channels the corresponding Listing must display > on same page. that is why i am also sending the Listing_channels > object to list_listing.html page. if some one click first time on > Listing_channels it shows the url > http://127.0.0.1:8000/category/listing_view/1/ > but second time it appends 1 at the end and the url becomes > http://127.0.0.1:8000/category/listing_view/1/1 > > I am trying to display like frameset left side all channels and right > side description of that channel. --~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---