urlpatterns

URL Patterns in Django - Different Combinations

I'm finding it hard to understand what exactly is passed to the patterns method in Django. You see, I usually have my urls.py as: urlspatterns = patterns('example.views', (r'/$','func_to_call'), ) Then in func_to_call I would get everything I want from the request object by using request.path. However on a second take, it's re...

Django template not loading javascript and css properly due to urlpatterns

Hey, When this one runs everything goes fine: (r"^newobject$", "views.myobjects.newobject"), All the CSS + JS files are properly fetched from: static/css/... static/js/... When this one runs: (r"^mybjects/(([a-z]|[A-Z]|[0-9])+)$","views.myobjects.loadobject"), All the css and JS files that are being fetched, are run trough the ...

Django url.py without method names

In my Django project, my url.py module looks something like this: urlpatterns = patterns('', (r'^$', 'web.views.home.index'), (r'^home/index', 'web.views.home.index'), (r'^home/login', 'web.views.home.login'), (r'^home/logout', 'web.views.home.logout'), (r'^home/register', 'web.views.home.register'), ) Is there a w...

How to make a Django urlpattern accept only slugs from a model

I'm making a weblog site in Django. I have a Blog model like this: class Blog(models.Model): name = models.CharField(max_length=255) slug = models.SlugField(max_length=255) ... And I want the front pages of each blog to be at URLs like this: www.example.com/blog-slug/ However, I'm also using Flatpages and will want that t...