I have a django app, a forum app, that has templates with it. In those templates, there are urls that point to parts of the app. For instance the thread_list template has links to each thread like so:
{% for thread in threads %}
<a href="{% url forum_thread thread %}">{{thread.title}}</a>
{% endfor %}
The thing is, I don't really ...
I am using Django and I have the following URL in my project's urls.py file.
(r'^user/(?P<username>[\w_\-\.]+)/my_app/', include('my_app.urls')),
(r'^user/(?P<username>[\w_\-\.]+)/my_other_app/', include('my_other_app.urls')),
...
The goal is to have an application that uses the username of a user e.g. a profile application where ever...
Hi guys, im want to know if there is any way to make a SlugField unique for Any field different to pub date?
for example i would like a slug unique (city field) for a field called country
any idea?
thanks
...
Hi !
My problem is simple, I have an url, I would like to resolve it, but get the url name instead of the view function associated with it ...
For example... this is urlconf :
urlpatterns = patterns('',
...
url('^/books/$', book_list, name="overview_books"),
...
)
And this is what I would like :
>>> resolve('/books/')
'overview_...
How do you deal with hierarchical URLs in Django? Any best practices for that?
Eg. If I would have an URL like /blog/category1/category2/myblogentry (using eg. django-mptt), would you do some checking before in urls.py or give the whole path to a view, let it check every part if it is a valid category etc?
Doesn't sound so tough, but ju...
Django 1.2 has brought in some changes in the syndication framework. According to this, I should now be able to do something like:
from django.conf.urls.defaults import *
from myproject.feeds import LatestEntries, LatestEntriesByCategory
urlpatterns = patterns('',
# ...
(r'^feeds/latest/$', LatestEntries()),
(r'^feeds/categ...
Hello All,
I am working on integration of django application with facebook and i did almost but I want to give an facility to the user to select his/her username after he/she successfully logged in facebook on my django site here is the code :
form for usename :
class RegisterUsernameForm(forms.Form):
username = forms.RegexField(reg...
I am thinking of a configuration where I have one master website at :
www.masterdomain.com
and N satelite domains where I can access the satelite domains as follows:
www.masterdomain.com/some_url/satetlite1.html
www.masterdomain.com/some_url/satetlite2.html
...
www.masterdomain.com/some_url/satetliteN.html
Is this possible?
...
Is there a way to get the current page URL and all its parameters in a Django template?
For example, a templatetag that would print full URL like /foo/bar?param=1&baz=2
...
I have spend the past 6 hours getting an ubuntu 10.04 server setup with django and mysql. I am using django 1.2.1, and maybe that's my problem. I have everything as I'd think it should be and am receiving this error when I hit http://localhost/admin
Request URL: http://192.168.1.153/mydangoproject/admin
Django Version: 1.2.1
Excep...
Hi,
I keep getting this error on my views. I can't work it out as the code is similar to the djangos tutorial just changing the objects name. Here is the code for my views.py:
from django.http import HttpResponse
from django.template import Context, loader
from django.shortcuts import render_to_response
from astonomyStuff....
I have two models with slug fields:
class Book(models.Model):
name = models.CharField(max_length=200)
slug = models.SlugField()
class Author(models.Model):
name = models.CharField(max_length=200)
slug = models.SlugField()
I would like to map them to the first-level path:
(r'^(?P<slug>[a-zA-Z0-9_-]+)/$', 'book_detail'...
I just moved my site to an actual apache server (was developing locally before) and the site can't seem to find the urls.py file. basically what happens is that the homepage works, which is weird in itself considering that if i go to any url, e.g. website/about/, i will get a 404 error with text {'path': u'about/'}.
I tried ROOT_URLCONF...
Hi,
I'm trying to create a filtered FAQ page in Django. It filters by three categories, and defaults to 'all' for all three when someone hits the root URL. From urls.py:
keywords = ('key1','key2','key3')
searchurl = r'^category1/(?P<%s>\w{1,50})/category2/(?P<%s>\w{1,50})/category3/(?P<%s>\w{1,50})/$' % keywords
searchall = dict(zip(ke...
I have a list of items that looks like this: 'Item 1', 'Item 2', 'Item 3'... with the list being dynamic in length.
My question is how can I pass this variable to my view?
Edit 1
Just thought I'd clarify what I was attempting:
return HttpResponseRedirect(reverse('newFeatures',
kwargs={'stock_number': stock_number, 'new_feature...
I cloned the basic_project in Pinax and created a new app in the apps folder. I then created a urls.py in the app. I changed the main urls.py file to:
(r'^newpage/', include('newapp.urls')),
However, in the newapp urls.py i need to use this url() in my patterns. Why cant I leave it out?
...
I have a web application which will return a user id based on the first segment of the url, much like Twitter:
http://www.myapplication.com/user-name-goes-here/
It can go deeper too, like so:
http://www.myapplication.com/user-name-goes-here/news/article_1/
In order to break the site down, I am using the following URL routing techniqu...
Assume a Django app, shop, whose urls.py is included in the main urls.py:
# main urls.py
urlpatterns = patterns('',
(r'^[^/]+/shop/', include('shop.urls')),
)
Note, that there is an arbitrary prefix before /shop. This is of no interest for the shop app, it's only interesting to some middleware.
The shop.urls could look like this:...
Hello, I want my urls.py to capture a long url setting as such:
/get/<lowercase_string>/<integer>/<date>/<date>/
For instance: www.mysite.com/get/ams/221/12-23-2010/01-10-2011/, as you may see date is in month/day/year format.
As my regex knowledge is near to nothing, I will be grateful for you guidance. I will be capturing <lowercas...
In my django application I have my URLS.PY configured to accept requests to /community/user/id and /community/user/id/ with:
url(r'^(?P<username>[\w-]+)/(?P<cardId>\d+)/$', 'singleCard.views.singleCard', name='singleCardView'),
I did this as some times people will add an ending "/" and I didn't want to raise a 404.
However parts of my...