django-urls

Collecting additional information in the Django administration page?

on save if user select certain option i want to take user to a page where he can have one more field to be filled and then redirect to admin default page ...

view on site

I am using def get_absolute_url in my model. It is giving the wrong "View on Site" link. How can it be corrected? ...

django -- application subdirectory site/app1/app2/app3

Hello, If you were to write an app for a site, but wanted to make the app plug&play so you can just drop it in any Django project, set the main URL and there you go, how would you do that if you wanted to keep all the other required utility apps included in your portable app. Example: site/ site/site-app1 site/templates/site-app1 site...

Difference between admin.site.root and admin.site.urls

In the The Django Book in chapter 6 about the Admin Site, they tell me to add the follwing URLpattern to urls.py: urlpatterns = patterns('', # ... (r'^admin/', include(admin.site.urls)), # ... ) But to make it work on my system, I had to uncomment the following line: (r'^admin/(.*)', admin.site.root), Can somebody enlig...

Force query parameters to be matched in urls.py

I want the WHOLE url after the slash to be passed to a script. If I do : url(r'^(?P<id>.*)$', alias.get, name="alias"), Then I only get the path component and not the query parameters passed to my function. I then have to : def urlencode(dict) : if len(dict) == 0 : return "" params = {} for k, v in dict.items() : ...

changing admin site url

Is there a way to change the url to open the admin site in django? I don't want to use the default /admin url. I am new to django so please try giving a bit more detailed information. ...

Restrict page view access to specific users/customers

Certainly not a new question I think, but here it goes: In my Django based Order system each user (who is not staff) is related to a CustomerProfile object which matches that user to the correct Customer object. This customer users can log in and view outstanding Invoices. To view a customer's invoices you navigate to something like t...

Linking to the django admin site

Very basic question, but I'm having trouble tracking down the answer on the web. I have a template, which I want to link to the django admin site (i.e. localhost:8000/admin). What is the code for this? I'm imagining something like <a href="{% url admin.site.root %}">link to admin panel</a> However, when I try the above snippet I get:...

Django: Is there a better way to bold the current page link

I have a base.html template that contains a list of links. Example: <div id="sidebar1"> <ul> <li><a href="/" title="">Index</a></li> <li><a href="/stuff/" title="" class="current">Stuff</a></li> <li><a href="/about/" title="">About Me</a></li> <li><a href="/contact/" title="">Contact Me</a></l...

Django Context Processor Trouble

So I am just starting out on learning Django, and I'm attempting to complete one of the sample applications from the book. I'm getting stuck now on creating DRY URL's. More specifically, I cannot get my context processor to work. I create my context processor as so: from django.conf import settings #from mysite.settings import ROOT_URL ...

Get name for matched URL pattern

I am writing a Django context processor which needs to access the name of the URL pattern that the request got successfully resolved against. Given the pattern, url(r'^home/$', 'app.index', name='website.home') and the request path /home, I want to get the value for name, which in this case is website.home. I got this code from djan...

Django: RSS and ATOM feeds Content-Type header?

I followed along this tutorial for django's RSS and ATOM feeds and I got it to work. However the test development server keeps making the browser download the feeds as a file instead of the browser detecting it as an xml document. My experience with HTTP tells me that there is a missing mime type in the Content-Type header. How do I ...

Recursive URL Patterns CMS Style

Whenever I learn a new language/framework, I always make a content management system... I'm learning Python & Django and I'm stuck with making a URL pattern that will pick the right page. For example, for a single-level URL pattern, I have: url(r'^(?P<segment>[-\w]+)/$', views.page_by_slug, name='pg_slug'), Which works great for url...

Django named urls unrecognized by template url tags

In projects/urls.py I have: urlpatterns = patterns('bizteen.projects.views', url(r'^browse/$', 'browse', name='projects-browse-main'), url(r'^browse/(\d+)/$', 'browse', name='projects-browse'), url(r'^create/$', 'create', name='projects-create'), url(r'^(\d+)/$', 'view_project', name='projects-view'), ) And in a templa...

Django: Dynamic LOGIN_URL variable

Hi Currently, in my settings module I have this: LOGIN_URL = '/login' If I ever decide to change the login URL in urls.py, I'll have to change it here as well. Is there any more dynamic way of doing this? ...

redirecting to a page

I am facing a problem .I want to give a link in my change form that will redirect to a page which may be simple php page also or any page ,in that page i want to perform some db queries and display them.I also wan to pass id on click.Is it posssible. in my view.py i wrote: from django.shortcuts import render_to_response from django....

How Do I Use A Decimal Number In A Django URL Pattern?

I'd like to use a number with a decimal point in a Django URL pattern but I'm not sure whether it's actually possible (I'm not a regex expert). Here's what I want to use for URLs: /item/value/0.01 /item/value/0.05 Those URLs would show items valued at $0.01 or $0.05. Sure, I could take the easy way out and pass the value in cents so...

Django: include other urlpatterns in a single urls.py

I am doing something like this in myproject.myapp.urls: from django.conf.urls.defaults import * urlpatterns = patterns('myproject.myapp.views', (ur'^$', 'index'), (ur'^browse/$', 'browse'), (ur'^request/new/$', 'new_request'), (ur'^(?P<url_key>[-a-zA-Z0-9]+)/$', 'view1'), (ur'^(?P<url_key>[-a-zA-Z0-9]+)/asdf$', 'vie...

admin/appname/modelname urls does not work with mod_wsgi in Django 1.1rc1

I'm using Django 1.1 rc1 and Apache 2.2.8 on Ubuntu with mod_wsgi 1.3.1 + Python 2.5.2. Everything worked fine with Django's internal testing web server, but after migrating to Apache mod_wsgi, all urls like /admin/appname/modelname/ began not to work. They shows 404 not found errors with the following log: ... ^admin/ ^$ ^admin/ ^logo...

Using a static Index page with Django and Nginx

I'm building a website using Django + Apache and Nginx to serve my static content. My site's index does not require any backend Django coding, so what would I need to change in nginx.conf to send requests for location / { } to some index.html in my static-content, while still allowing my urls.py to handle patterns appropriately? upstrea...