title: Uploaded images not showing, wrong path
body: <p>I've got a problem with displaying images that were uploaded from admin panel. Django renders wrong path, probably due to my configuration mistake somewhere...</p>
  
  <p>This is my model definition:</p>
  
  <pre><code>class Article(models.Model):
      """News article, displayed on homepage to attract users"""
      class Meta:
          db_table = 'article'
      title = models.CharField(max_length=64)
      headline = models.CharField(max_length=255)
      content = HTMLField()
      image = models.ImageField(upload_to = 'articles/', null=True, blank=True)
      active = models.BooleanField()
      created_at = models.DateTimeField()
      def __unicode__(self):
          return self.title
  </code></pre>
  
  <p>This is url configuration:</p>
  
  <pre><code>from django.conf.urls import patterns, include, url
  from django.conf import settings
  from django.conf.urls.static import static
  
  urlpatterns = patterns('',
  # some stuff
  ) + static(settings.MEDIA_URL, document_root=settings.MEDIA_ROOT)
  </code></pre>
  
  <p>settings.py:</p>
  
  <pre><code>PROJECT_DIR = os.path.dirname(__file__)
  MEDIA_ROOT = os.path.join(PROJECT_DIR, "media")
  MEDIA_URL = '/media/'
  </code></pre>
  
  <p>the view:</p>
  
  <pre><code>def slider(request):
      context = Context ({ 'articles': Article.objects.order_by('-created_at')[:5] })
      return render(request, 'articles/slider.html', context)
  </code></pre>
  
  <p>and the template:</p>
  
  <pre><code>{% for article in articles %}
    &lt;img src="{{ article.image.url }}" alt="" /&gt;
  </code></pre>
  
  <p>I would expect django to render <code>http://127.0.0.1:8000/media/articles/slide-02.jpg</code> but now it renders <code>http://127.0.0.1:8000/media/slide-02.jpg</code>. I've defined the <code>upload_to=articles/</code> in the model class. So why does the <code>article.image.url</code> attribute return a path without this significant directory?</p>
  
  <hr>
  
  <p>edit: I've got something wrong with my model. It doesn't recognize the <strong>upload_to</strong> directory:</p>
  
  <pre><code>$ ./manage.py shell
  Python 2.7.3 (default, Aug  1 2012, 05:14:39) 
  [GCC 4.6.3] on linux2
  Type "help", "copyright", "credits" or "license" for more information.
  (InteractiveConsole)
  &gt;&gt;&gt; from articles.models import Article
  &gt;&gt;&gt; Article.objects.all()
  [&lt;Article: Blackened Recordings Launches&gt;, &lt;Article: The Rockin' Return of Deep Purple&gt;, &lt;Article: See Emily Day 20th April&gt;, &lt;Article: Celebration Day Premieres In Four Countries Announced&gt;, &lt;Article: Waging heavy innovation&gt;, &lt;Article: Rush to play festival D'Ete, Quebec City&gt;]
  &gt;&gt;&gt; Article.objects.all().get(pk=1)
  &lt;Article: Blackened Recordings Launches&gt;
  &gt;&gt;&gt; Article.objects.all().get(pk=1).image
  &lt;ImageFieldFile: slide-03.jpg&gt;
  &gt;&gt;&gt; Article.objects.all().get(pk=1).image.path
  u'/var/www/django/djninja/djninja/media/slide-03.jpg'
  &gt;&gt;&gt; Article.objects.all().get(pk=1).image.url
  '/media/slide-03.jpg'
  </code></pre>
  
  <p>Again, it should be <code>media/articles/slide-03.jpg</code> instead of <code>media/slide-03.jpg</code>. So I guess all routing/template is ok, something's wrong with the model.</p>