Hello,
Is there a way to filter all requests before URLS.py dispatches the
request?
I am developing a Pinax application. I have some custom menu tabs
across the top, and I limit the visibility of those tabs depending on
flags present in the user's account. I do this by enabling custom
f
Looks like I had a sip directory under my templates so was confusing
Apache I guess. Anyway, fixed now so thanks. Renamed it as noted
above.
On Mar 4, 9:10 am, Rajesh Dhawan wrote:
> Rajesh D wrote:
> > On Mar 4, 9:58 am, Dan wrote:
> > > Url pattern below r^sip/conf and sip/createfile work for
Rajesh D wrote:
> On Mar 4, 9:58 am, Dan wrote:
> > Url pattern below r^sip/conf and sip/createfile work for development
> > server but Apache comes up with a 404 error. Note that the error is
> > shown as Apache error not Django parsing error. So, is it Apache not
> > using the Python interpre
On Mar 4, 9:58 am, Dan wrote:
> Url pattern below r^sip/conf and sip/createfile work for development
> server but Apache comes up with a 404 error. Note that the error is
> shown as Apache error not Django parsing error. So, is it Apache not
> using the Python interpreter or something with Djan
Url pattern below r^sip/conf and sip/createfile work for development
server but Apache comes up with a 404 error. Note that the error is
shown as Apache error not Django parsing error. So, is it Apache not
using the Python interpreter or something with Django? Note that
changing the name to statio
Thanks!
Ana
On Jan 27, 9:51 am, Adam Stein wrote:
> Eggs seems to be something related to python packages, not sure exactly
> what they are used for. I needed the PYTHON_EGG_CACHE because my web
> server could not write to the default egg cache directory and so I had
> it use a temp place.
>
>
Eggs seems to be something related to python packages, not sure exactly
what they are used for. I needed the PYTHON_EGG_CACHE because my web
server could not write to the default egg cache directory and so I had
it use a temp place.
Perhaps somebody else can better explain eggs.
On Tue, 2009-01
Hello Adam,
Thanks! I have already set up several sections for the
django site, so I must not have the syntax quite right for apache to
ignore the static links. I will work on it. One last question? What
are eggs?
SetEnv PYTHON_EGG_CACHE /tmp/.python-eggs
Thanks,
Ana
On Ja
On Jan 27, 11:06 am, May wrote:
> Hello,
>
> The tutorial suggests not serving the static pages with this method on
> a permanent basis. Are you using this method for your production
> server? I'm using windows/apache/modpython and I've tried using the
> IP address and still run into django url
On Tue, 2009-01-27 at 08:42 -0800, May wrote:
> I'm converting PHP pages to Django. I'm using base.html for my
> formatting. I've included the left-side bar in the base.html, which
> includes links that do not require using a database, such as the
> "contact us" page. Since I'm using localhos
I ONLY use it for development with the Django server. I only set up to
serve static pages when DEBUG = True (as they show toward the bottom of
the page).
No need to change links on the production server (apache + mod_python)
because the URLs are a different location than what I have set up for
m
Hello,
The tutorial suggests not serving the static pages with this method on
a permanent basis. Are you using this method for your production
server? I'm using windows/apache/modpython and I've tried using the
IP address and still run into django url requests. Do you know of a
way to get apac
Check out:
http://docs.djangoproject.com/en/dev/howto/static-files/?from=olddocs
I have Django serve static files during development so that all my links
that don't need to go thru Django work.
On Tue, 2009-01-27 at 08:42 -0800, May wrote:
> Hello,
>
> I'm converting PHP pages to Django. I'm
Hello,
I'm converting PHP pages to Django. I'm using base.html for my
formatting. I've included the left-side bar in the base.html, which
includes links that do not require using a database, such as the
"contact us" page. Since I'm using localhost for testing my link
looks something like this
quot; is different, and this obviously causes the
> > pattern matching in urls.py to fail
>
> That's not correct. See below.
>
>
>
>
>
> > Here is the html + template script that causes the problem
>
> > {% if error_message %}{{ error_message
is different, and this obviously causes the
> pattern matching in urls.py to fail
That's not correct. See below.
>
> Here is the html + template script that causes the problem
>
> {% if error_message %}{{ error_message }}{%
> endif %}
>
>
t" is different, and this obviously causes the
pattern matching in urls.py to fail
Here is the html + template script that causes the problem
{% if error_message %}{{ error_message }}{%
endif %}
{% for entry in entry_list %}
{{
ent
hi guys...me again...but now I've done a little step forward, when I
load urls file through request.urlconf it does not append end slash to
any url..:( and urls without trailing slash try map through base
urls.py file (ROOT_URLCONF).
in new url.py file I specify urlpatterns = pattern() not +
it's rather handy:
>
> http://www.rkblog.rk.edu.pl/w/p/password-reset-django-10/
>
> -Jeff
>
> On Dec 20, 12:01 pm, kev wrote:
>
> > Hello,
> > I have the following entry in urls.py file:
>
> > (r'^forgotpassword/$', passwor
ff
On Dec 20, 12:01 pm, kev wrote:
> Hello,
> I have the following entry in urls.py file:
>
> (r'^forgotpassword/$', password_reset, {
> 'template_name': 'users/forgotpassword.html',
>
Hello,
I have the following entry in urls.py file:
(r'^forgotpassword/$', password_reset, {
'template_name': 'users/forgotpassword.html',
'email_template_name': 'users/forgotpassword_template.html'
>>http://docs.python.org/lib/re-syntax.html
>>
>> There are several good books and websites that will teach you the
>> basics of regexps, and a quick search will bring back a number of
>> results.
>
> Thank alot thats the best response I have had.
Glad to help...though in a way, it's as much
On 13 oct, 23:14, KillaBee <[EMAIL PROTECTED]>
wrote:
(snip)
>
> I creted the url strucure like I want it ,and the user was add to the
> url.
Nope. The user *id*.
> How can I just display it on a page. I was thinking that I was
> not login in cerrectlly, but only on the login can I use the aut
On Oct 13, 2:39 pm, bruno desthuilliers
<[EMAIL PROTECTED]> wrote:
> On 13 oct, 20:13, KillaBee <[EMAIL PROTECTED]>
> wrote:
>
>
>
> > I am want in to pass the user and a date, using the url. Like the
> > polls urls
> > (r'^(?P\d+)/$', 'intranet.timesheets.views.detail'),
>
> > I tried these, b
On 13 oct, 20:13, KillaBee <[EMAIL PROTECTED]>
wrote:
> I am want in to pass the user and a date, using the url. Like the
> polls urls
> (r'^(?P\d+)/$', 'intranet.timesheets.views.detail'),
>
> I tried these, but I am missing a piece:
> urlpatterns = patterns('',
> (r'^timesheet/(?P)/$',
> 'i
On Oct 13, 1:53 pm, Tim Chase <[EMAIL PROTECTED]> wrote:
> > I tried these, but I am missing a piece:
> > urlpatterns = patterns('',
> > (r'^timesheet/(?P)/$',
> > 'intranet.timesheets.views.times'),
> > (r'^timesheet/(?P\d{20})/$',
> > 'intranet.timesheets.views.times'),
> > (r'^tim
> I tried these, but I am missing a piece:
> urlpatterns = patterns('',
> (r'^timesheet/(?P)/$',
> 'intranet.timesheets.views.times'),
> (r'^timesheet/(?P\d{20})/$',
> 'intranet.timesheets.views.times'),
> (r'^timesheet/(?P\d{20})/(?P\d{10})/$',
> 'intranet.timesheets.views.times'),
>
I am want in to pass the user and a date, using the url. Like the
polls urls
(r'^(?P\d+)/$', 'intranet.timesheets.views.detail'),
I tried these, but I am missing a piece:
urlpatterns = patterns('',
(r'^timesheet/(?P)/$',
'intranet.timesheets.views.times'),
(r'^timesheet/(?P\d{20})/$',
'i
I'm using 1.0 alpha, and had the same problem. Adding
'mimetype':'text/xml' as noted worked perfectly.
thanks for the post!!
On Aug 9, 8:25 pm, Valery <[EMAIL PROTECTED]> wrote:
> Hi Julien,
>
> thank you for the answer.
>
> I've just tested your code, the effect is the same. Namely,
> opensear
; > I don't see anything like
> > from pinax import *
>
> > But it is doing:
> > (r'^about/', include('about.urls')),
> > instead of :
> > (r'^about/', include('pinax.about.urls')),
>
> > Best,
> >
e/trunk/pinax/url...
>
> I don't see anything like
> from pinax import *
>
> But it is doing:
> (r'^about/', include('about.urls')),
> instead of :
> (r'^about/', include('pinax.about.urls')),
>
> Best,
> V
>
> On Aug
That seems not the case, eg.
http://code.google.com/p/django-hotclub/source/browse/trunk/pinax/urls.py
I don't see anything like
from pinax import *
But it is doing:
(r'^about/', include('about.urls')),
instead of :
(r'^about/', include('pinax.abo
Look at the import statements on the different urls.py files.
This:
from myproject.myapp import myview
urlpatterns = patterns('',
(r'^somepattern/', myview))
Does the same thing as this:
urlpatterns = patterns('',
(r'^somepattern/', myproje
I saw some django projects have the site urls.py
urlpatterns = patterns('',
(r'^app/', include('apps.urls')),
)
instead of the regular one:
urlpatterns = patterns('',
(r'^app/', include('mysite.apps.urls')),
)
What ne
latest version from the SVN.
I searched the site-packages/django/contrib/admin, and there's no
urls.py file.
I downloaded the latest stable version (.96), and there is an urls.py
file on the same directory, but when I tried to place it on the
directory of the current Django version, other except
lhost:8000/admin, I get this
> exception:
> ImproperlyConfigured: Error while importing URLconf
> 'django.contrib.admin.urls': No module named urls
>
> I'm using the latest version from the SVN.
> I searched the site-packages/django/contrib/admin, and there's
On Sat, 2008-07-05 at 04:35 -0700, zobbo wrote:
[...]
> Comments welcomed. I'm not likely to make the same mistake again but
> interested to know if there's a solution for this. Besides the obvious
> "Don't ignore error messages" :)
If there's not already a ticket open for this in Trac (do a bit
I've been working through "Practical Django Projects" by James Bennet.
I came across some unexpected behaviour which I wanted to share
regarding handling errors on startup within the urls configuration.
In the weblog application he talks you through, he discusses splitting
Your last example is near the typical solution. You could pass as
second element of the "url-tuples" a callable object e.g. a view.
from django.conf.urls.defaults import *
import views
urlpatterns = patterns('',
(r'^(?P[a-z0-9_-]+)/$', views.view_city),
(r'^(?P[a-z0-9_-]+)/category/(?P[a
I've come across the need lately, for my applications to be completely
standalone, and this has presented itself a few problems:
- I need urls.py to be dynamically editable (at least at runtime). I
think I can deal with this one, just haven't gotten to it.
- More importantly, I need
On May 28, 2:06 pm, [EMAIL PROTECTED] wrote:
> Couldn't you also use something along the lines of
> ^price[s]/
>
> Though I may have the syntax wrong.
Just to correct your syntax the regular expression for making the last
letter in that example optional would be:
^prices?/
Matt
--~--~
ing. Taking the simpliest, I
> > > > would like to implement this regexp:
> > > > ^pric(e|es)/
> > > > into urls.py, but the () are overlapping with the text capture, as it
> > > > seems.
> >
> > > If you want to use parenthese
t; It's simply an OR done into the matching. Taking the simpliest, I
> > > would like to implement this regexp:
> > > ^pric(e|es)/
> > > into urls.py, but the () are overlapping with the text capture, as it
> > > seems.
>
> > If you want to use parent
> > It's simply an OR done into the matching. Taking the simpliest, I
> > would like to implement this regexp:
> > ^pric(e|es)/
> > into urls.py, but the () are overlapping with the text capture, as it
> > seems.
>
> If you want to use parentheses that d
ould like to implement this regexp:
> ^pric(e|es)/
> into urls.py, but the () are overlapping with the text capture, as it
> seems.
If you want to use parentheses that don't capture use "?:" to flag it
as non-grouping. So instead try:
^pric(?:e|es)/
Matt
--~--~-~--~--
Hello django users,
I'm new to django, and I was looking to implement a very simple url
scheme that I used for a PHP site.
It's simply an OR done into the matching. Taking the simpliest, I
would like to implement this regexp:
^pric(e|es)/
into urls.py, but the () are overlapping wit
On Apr 22, 2008, at 16:34 , jmDesktop wrote:
> But what I don't understand is the comment on GET. I thought that was
> what I was doing. Or am I doing the same thing only wrong? Are you
> saying that I should use a querystring in the url like myurl/?
> email=theemail&anothervar=something... i
I ended up with this (from both of you, thanks):
urls.py:
(r'^contact/thanks/(?P.*)/$','mysite.books.views.thanks'),
and in my views.py:
def thanks(request, sender):
return render_to_response('books/thanks.html',{'user': sender})
thanks.ht
On 22-Apr-08, at 4:00 AM, jmDesktop wrote:
> (r'^contact/thanks/(.)/$','mysite.books.views.thanks'
(r'^contact/thanks/(?P.)/$','mysite.books.views.thanks'),
will direct to the thanks function which you call as:
def thanks(request,sender)
and this thanks function loads the thanks template with
On Apr 22, 2008, at 01:30 , jmDesktop wrote:
>
> What I have in my urls.py file is:
>
> (r'^contact/thanks/(.)/$','mysite.books.views.thanks'),
try this:
(r'^contact/thanks/(?P.*)/$','mysite.books.views.thanks'),
The idea is to captur
Hi, I am trying to understand how URLconf works and why I am failing
at a simple task. I have this in one my .py files (larger snippet is
an email responder from djangobook chap7):
return HttpResponseRedirect('/contact/thanks/%s' % sender )
What I have in my urls.py file is:
(
probably not render very well. All the
> same, any content that's hard-coded directly in the template, rather
> than being pulled from the context, is fair game for an attacker to
> access.
>
> Consider something like this instead:
>
> #in urls.py
> def easy_
an attacker to
access.
Consider something like this instead:
#in urls.py
def easy_template(name):
return (r'^%s/$' % name, direct_to_template, {'template': '%s.html' % name})
urlpatterns = patterns('',
(r'^$', direct_to_temp
Gotcha. Very, very cool. Here's what I did. Please tell me if there's
a better way:
#in views.py
def return_template(request, template):
return direct_to_template(request, (template + '.html'))
#in urls.py
from django.conf.urls.defaults import *
from rdk.pages.views im
to say that I have imported the view into urls.py
>
> from rdk.pages.views import return_template
>
> On Apr 18, 2:39 pm, Brandon Taylor <[EMAIL PROTECTED]> wrote:
>
> > I understand the concept of that, but I'm having an issue with
> > importing the vie
Sorry, forgot to say that I have imported the view into urls.py
from rdk.pages.views import return_template
On Apr 18, 2:39 pm, Brandon Taylor <[EMAIL PROTECTED]> wrote:
> I understand the concept of that, but I'm having an issue with
> importing the view function into my urls.
I understand the concept of that, but I'm having an issue with
importing the view function into my urls.py. Here's what I have so
far:
#in views.py
from django.views.generic.simple import direct_to_template
def return_template(template):
return direct_to_template(template %
Yes, instead of having it use a generic directly in the urlconf, you
would have it go to the view, the view would do what you
need(specifically doing that simple substitution), and then have it
return django.views.generic.simple.direct_to_template, remember views
are just functions, if you need an
Hi Alex,
Thanks for the advice. Still being new to Django, where would such a
wrapper function need to exist? In the views.py? models.py?
I'm guessing it would need to be something along the lines of:
def replace_template_var(template):
return template % '.html'
? Please advise,
Brandon
O
Direct_to_template does not substitute the template var in to the
template param, you will need to write a simple wrapper to do
something like this.
On Apr 18, 12:35 pm, Brandon Taylor <[EMAIL PROTECTED]> wrote:
> Ah. I see now. It's matching the first part of the URL, but it doesn't
> seem to wa
Ah. I see now. It's matching the first part of the URL, but it doesn't
seem to want to substitute the named parameter as
(template) as such:
(r'(?P[-\w]+)/$', direct_to_template, {'template' : '%
(template)s.html'}),
Thanks,
Brandon
On Apr 18, 11:25 am, "Marty Alchin" <[EMAIL PROTECTED]> wrote
On Fri, Apr 18, 2008 at 12:17 PM, Brandon Taylor
<[EMAIL PROTECTED]> wrote:
> (r'?P[-\w]+/$', direct_to_template, {'template' : '%
> (template)s.html'}),
>
> ...and received an error saying:
> Error while importing URLconf 'rdk.pages.urls': nothing to repeat
You're missing parentheses around
Hi everyone,
Coming from Rails, I've been naming my templates according to their
corresponding URLs. But, since Django's routing is RegEx based, I'm
sure there's a better way to do this:
urlpatterns = patterns('',
(r'^$', direct_to_template, {'template':'home.html'}),
(r'^contact/$', dir
n. That is, I want to change the url->view mapping based on
> the session variables. Problem is, I can't seem to figure out how to
> access the session from urls.py. I understand that outside views I
> can load up a session object by importing
> django.contrib.sessions.models.Sessi
Hey folks -
I'm looking to make url "routing" choices based on some values from
the session. That is, I want to change the url->view mapping based on
the session variables. Problem is, I can't seem to figure out how to
access the session from urls.py. I understand t
;
>
> almostvindiesel wrote:
> > Hi all,
>
> > I'm new to regex/django/python, and I'm having trouble getting urls.py
> > to pass a request to a view. Specifically, when I hit:
>
> >http://django.mysite.com/chef/home/param1/param2/
>
> > I
gex/django/python, and I'm having trouble getting urls.py
> to pass a request to a view. Specifically, when I hit:
>
> http://django.mysite.com/chef/home/param1/param2/
>
> I'd expect the 3rd from the last pattern to match:
>
> ## my urls.py f
Hi all,
I'm new to regex/django/python, and I'm having trouble getting urls.py
to pass a request to a view. Specifically, when I hit:
http://django.mysite.com/chef/home/param1/param2/
I'd expect the 3rd from the last pattern to match:
######
On Dec 18, 9:10 am, shabda <[EMAIL PROTECTED]> wrote:
> I have my urls.py defined as
> urlpatterns = patterns('app.views',
> (r'^foo/$', 'foo'),
> (r'^bar/$', 'bar'),)
>
> Now from a template i need to ac
On Dec 18, 2007 8:10 AM, shabda <[EMAIL PROTECTED]> wrote:
> Now from a template i need to access these urls. So inside the
> template we can refer them as /foo/, /bar/. However later when I
> change the urls.py, these urls defined in urls.py would break. What
> would be a go
I have my urls.py defined as
urlpatterns = patterns('app.views',
(r'^foo/$', 'foo'),
(r'^bar/$', 'bar'),)
Now from a template i need to access these urls. So inside the
template we can refer them as /foo/, /bar/. However later when I
o the consumers of your web-service API.
It seems like scanning urls.py and tracking down the chain of
'include' settings is what would be needed. I'm guessing there isn't
anything out there, but I figured I'd ask first in case someone had
alread
On Oct 13, 4:09 pm, Jason <[EMAIL PROTECTED]> wrote:
> Hey everyone--
>
> I've got a predominantly static site that I need to serve through
> Django, at least until I can convert more of it over properly. Yes, I
> know this is discouraged, but it's the only way I'm going to be able
> to move fo
index.html" % (path,))),
* (r'^(?P.*)$', direct_to_template),
...but I've had no luck w/either of those.
Anyone had any experience w/this? I'd really like to establish a
catch-all-- very specific Django-pages defined first in my urls.py,
then everything else passes
Whoops, mind the typo. Should be::
urlpatterns = patterns("xgm.AbbrDB.views",
(r"^$", "search"),
)
urlpatterns += patterns("django.views.generic.list_detail",
(r'^list/$', 'object_list', info_dict),
)
--~--~-~--~~~---~--~~
You rece
If you're only doing one or two, use callables [1]_ which will ignore
your view prefix::
from django.conf.urls.defaults import *
from models import Abbreviation
import django.views.generic.list_detail.object_list as object_list
info_dict = { "queryset": Abbreviation.objects.all()
Hello,
part 3 of the tutorial introduced how to decouple URL configuration into the
app dir.
At part 4 [1] generic views are introduced and the decoupled URL
configuration:
from django.conf.urls.defaults import *
urlpatterns = patterns('mysite.polls.views',
(r'^$', 'index'),
(r'^(?P\d+
is there any performance bottleneck when the size of urls.py goes
large.
if yes how to overcome that.
also if we use same url for a particular group, based on some hidden
action variable in htmls, would it improve performance. like i am
using
if request.method == 'POST':
I think do like below maybe more simple
from django.shortcuts import render_to_response
from django.template.context import RequestContext
def template_name(func):
def _template_name(request,template_name,*args,**keys):
result=func(request,*args,**keys)
if type(result)!=dict
On Mon, 2007-06-25 at 21:43 +1000, Malcolm Tredinnick wrote:
> On Mon, 2007-06-25 at 10:06 +, Ryan Kanno wrote:
> > I know this isn't big (and maybe it's by design), but this didn't
> > happen prior to I believe -r 5516. If you have a empty urls.py
> >
On Mon, 2007-06-25 at 10:06 +, Ryan Kanno wrote:
> I know this isn't big (and maybe it's by design), but this didn't
> happen prior to I believe -r 5516. If you have a empty urls.py
> include file in any app within the project, it causes the {% url %}
> tag to no
I know this isn't big (and maybe it's by design), but this didn't
happen prior to I believe -r 5516. If you have a empty urls.py
include file in any app within the project, it causes the {% url %}
tag to not resolve for any app, even an unrelated app view. The
exception return
On Sat, 2007-03-31 at 01:44 +, benrawk wrote:
> Hello,
>
> When I am running the simple current_datetime example from the django
> book, and then edit my urls.py to look like the one in the book, the
> page doesn't server.
>
> Book urls.py:
> from dja
Hello,
When I am running the simple current_datetime example from the django
book, and then edit my urls.py to look like the one in the book, the
page doesn't server.
Book urls.py:
from django.conf.urls.defaults import *
f from mysite.views import current_datetime
urlpat
Thanks Malcolm, sounds like `getattr` might be a good solution. I'll
take a look into that and post back. -- Alex
On Mar 26, 9:58 am, Malcolm Tredinnick <[EMAIL PROTECTED]>
wrote:
> On Sun, 2007-03-25 at 18:22 -0700, Alex Dong wrote:
> > Hi Malcolm,
>
> > Thanks for the quick reply.
>
> > What I'
On Sun, 2007-03-25 at 18:22 -0700, Alex Dong wrote:
> Hi Malcolm,
>
> Thanks for the quick reply.
>
> What I'm wondering about is that I've seen the pattern repeat itself
> quite a few times where I have to write a little wrapper doing nothing
> more than retrieving something from the `request`
5 at 17:55 -0700, Alex Dong wrote:
> > Hi folks,
> > I'd like to refactor the following code into one line in urls.py:
>
> > Now:
> > in `urls.py`:
> > +(r'^watchlist/$',
> > 'package.watchlist.views.rredirect_to_personalized_watc
Hi Alex,
On Sun, 2007-03-25 at 17:55 -0700, Alex Dong wrote:
> Hi folks,
> I'd like to refactor the following code into one line in urls.py:
>
> Now:
> in `urls.py`:
> +(r'^watchlist/$',
> 'package.watchlist.views.rredirect_to_personalized_watch_
Hi folks,
I'd like to refactor the following code into one line in urls.py:
Now:
in `urls.py`:
+(r'^watchlist/$',
'package.watchlist.views.rredirect_to_personalized_watch_list'),
+(r'^users/(?P.*)/watchlist/$',
'package.watchlist.views.watchlist
On 2/8/07, Tim Chase <[EMAIL PROTECTED]> wrote:
>
> Any hints? Thanks,
>
> -tkc
No, but I need something like that and just broke it down in to vars,
concatenating them later:
cat_re = r"(in/(?P([^/]+/)*))?"
...
(r'^(?P\d{4})/(?P\w{3})/%s$' % cat_re, ...),
--~--~-~--~~
This may have a simple answer that I've overlooked. Is there a
way to specify that the regexps used for mapping URLs in urls.py
are in re.VERBOSE format rather than all in one line?
I have several pieces that are easily recognizable when specified
as VERBOSE, but when given in one lin
On 1/11/07, Waylan Limberg <[EMAIL PROTECTED]> wrote:
>
> If my understanding is correct, when you use this method:
>
> > choices = {
> > 'queryset': Poll.objects.filter(opening_date__lte=datetime.now(),
> > closing_date__gte=datetime.now())
> > }
>
> The value of datetime.now() is evaluated a
If my understanding is correct, when you use this method:
> choices = {
> 'queryset': Poll.objects.filter(opening_date__lte=datetime.now(),
> closing_date__gte=datetime.now())
> }
The value of datetime.now() is evaluated at compilation time when
apache/mod_python is started (or at least when
Hi,
after running in some rather strange problems I got curious about the
way Django and/or mod_python evaluates urls.py.
Is there a difference if I use following code:
now = datetime.now()
choices = {
'queryset': Poll.objects.filter(opening_date__lte=now,
closing_date__gte=now
'',
(r'^$', func),
)
->8--
So this a great thing!
We can make many tricks on it. And I want to introduce how to use
decorator on it.
Very simple!
Say you put check_userid in a module n
-8<--
@template('template.html')
def list(request):
if success:
#return HttpResponseRedirect('url')
raise HttpRedirectException
else:
return errorinfo
-
Thanks Shaun Li. I just figured that out, but thank you because I very
well could have still been stumped until you posted.
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups
"Django users" group.
To post to this group
Opps. I posted before I treid all that I could try. I found my error
thanks to you help Don Arbow and everybody's help on my last post.
Thanks you all.
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups
"Django users"
Just add ',' after ')' when only one note that tuple needed:(r'^select/$', 'mysite.polls.views.select'),-- Shaun Li
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send ema
from django.conf.urls.defaults import *
urlpatterns = patterns('',
# Example:
# (r'^mysite/', include('mysite.apps.foo.urls.foo')),
(r'^polls/$', 'mysite.polls.views.select'),
(r'^polls/(?P\d+)/$', 'mysite.polls.views.detail'),
(r'^polls/(?P\d+)/results/$',
'mysite.polls.views
301 - 400 of 462 matches
Mail list logo