title: Django how the urls are resolved?
body: <p>Im reviewing a sample DJango code and trying to understand how the urls are resolved?</p>
  
  <p>list.html</p>
  
  <h3>Categories</h3>
  
  <pre><code>{% for c in active_categories %}
      &lt;a href="{{c.get_absolute_url}}"&gt;{{c.name}}&lt;/a&gt;&lt;br /&gt;
  {% endfor %}
  </code></pre>
  
  <p>urls.py</p>
  
  <pre><code>from django.conf.urls import *
  
  urlpatterns = patterns('ecomstore.catalog.views',
              (r'^$','index',{'template_name':'catalog/index.html'},'catalog_home'),
              (r'^category/(?P&lt;category_slug&gt;[-\w]+)/$','show_category',{'template_name':'catalog/category.html'},'catalog_category'),
              (r'^product/(?P&lt;product_slug&gt;[-\w]+)/$','show_product',{'template_name':'catalog/product.html'},'catalog_product'),
              )
  </code></pre>
  
  <p>The above html list all the categories without any problem and its called when I enter the following in the browser..[http:127.0.0.1:8000]</p>
  
  <p>When I hover over - a href="{{p.get_absolute_url}} - I get the url resolved to--[http://127.0.0.1:8000/category/electronics/]</p>
  
  <p>The p.get_absolute_url is resolved only to electronics but Im wondering how "category" is resolved in the url..</p>
  
  <p>models.py</p>
  
  <pre><code>class Category(models.Model):
      name = models.CharField(max_length=50)
      slug = models.SlugField(max_length=50,unique=True,help_text='Unique value for product page URL created from name')
      description = models.TextField()
      is_active = models.BooleanField(default=True)
      meta_keywords = models.CharField("Meta Keywords",max_length=255,help_text="comma-delimited set of SEO Keywords for meta tag")
      meta_description = models.CharField("Meta description",max_length=255,help_text="Content for description meta tag")
      created_at = models.DateTimeField(auto_now_add=True)
      updated_at = models.DateTimeField(auto_now_add=True)
  
      class Meta:
          db_table = 'categories'
          ordering = ['-created_at']
          verbose_name_plural = 'Categories'
  
      def __unicode__(self):
          return self.name
  
      @models.permalink
      def get_absolute_url(self):
          return ('catalog_category',(),{'category_slug':self.slug})
  </code></pre>
  
  <p>Hope my question is clear...</p>