Archive

Archive for February, 2007

django tricks part 2

February 2nd, 2007 No comments

Or how to serve your media folder within the development web server?

pretty easy, if you know how :-)

add this to your main url.py:

from django.conf import settings
if settings.DEBUG:
  urlpatterns += patterns('',
    (r'^media/(?P.*)$', 'django.views.static.serve',
      {'document_root' : settings.MEDIA_ROOT,
      'show_indexes'  : True}),
  )

be sure to specify MEDIA_ROOT in your settings.py.
also, be sure to set ADMIN_MEDIA_PREFIX = '/media/admin/'

Categories: coding, django Tags:

django newforms tricks

February 2nd, 2007 7 comments

Image you have some sort of user-profile, and you want to automatically render it using newforms. But leave certain fields out.
(i.e. the user may not be able to change the associated user)

Read more...

Categories: coding, django Tags: