Questions about Django's authentication system

2010-10-12 Thread Andy
A few questions about Django's authentication system:

- Once a user is logged in, how long does he remain logged in? Is
there any way to configure this - e.g. "users will remain logged in
for 24 hours"?

- Once a user provided a matching username & password and is
authenticated, then what? In subsequent page views how does Django
know that this user is logged in? I'm guessing Django creates a cookie
and stores the cookie in SESSION_ENGINE, every time a user request a
page, Django gets that user's cookie from browser and uses it to query
SESSION_ENGINE. Is that correct?

- Does it mean that Django must hit SESSION_ENGINE for every single
page view?

Thanks.

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-us...@googlegroups.com.
To unsubscribe from this group, send email to 
django-users+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en.



Database Setup

2010-10-12 Thread Everett
I'm running Django on Windows. When I edited the settings.py file for
the MySql database I'm running in an XAMPP package, the Django
development server throws a bunch of unhandled exceptions. It starts
out like this:

Unhandled exception in thread started by 
Traceback (most recent call last):
File "D:\Python27\lib\site-packages\django\core\managment\base.py",
line 249 in validate

Is this because of how I'm running the MySQL database? Or the
information in the settings.py file is off? Cause when I take all the
database settings out of the settings.py file the development server
runs fine.

Database settings:

'ENGINE': 'django.db.backends.mysql',
'NAME': 'djangodb',
'USER': 'admin',
'PASSWORD': ' ',
'HOST': 'localhost',
'PORT': ' ',

Any ideas?

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-us...@googlegroups.com.
To unsubscribe from this group, send email to 
django-users+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en.



Re: distinct doesn't work on admin actions¿?

2010-10-12 Thread Karen Tracey
On Tue, Oct 12, 2010 at 6:31 AM, Marc Aymerich  wrote:

> I'm writing an action for the django admin site. My model looks like:
>
> class order(models.Model):
> entity = models.ForeignKey(entity)
> [...]
>
>
> I select an arbitrary number of orders and I need to know the different
> entities that they have. It works on shell:
>
> >>> queryset = order.objects.all()
>  >>> queryset.all().values_list('entity', flat=True).distinct()
> [1L]
>
> But on Admin seems the distinct part of the queryset doesn't work
>
> class orderAdmin(admin.ModelAdmin):
>[]
> def invoice(self, request, queryset):
> print str(queryset.all().values_list('entity',
> flat=True).distinct())
> []
>
>
> Here the output of selecting all order elements(4), the output is a little
> different from the same operation in shell :(
>
> [1L, 1L, 1L, 1L]
>
>
> What's happening here?
>

Whenever distinct() doesn't seem to work like it should the first thing to
check is whether an oder_by() specified in the queryset is causing the
duplicates (see
http://docs.djangoproject.com/en/dev/ref/models/querysets/#distinct). Adding
order_by() to the queryset you are using will clear any previously specified
ordering and should eliminate the duplicates (if that is in fact what is
causing the problem).

Karen
-- 
http://tracey.org/kmt/

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-us...@googlegroups.com.
To unsubscribe from this group, send email to 
django-users+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en.



Re: Django setup

2010-10-12 Thread Everett


On Oct 12, 8:44 pm, Kenneth Gonsalves  wrote:
> well, you only need to do this once - after that you can use manage.py
> from within your project. So I would not bother about this.
> --
> regards
> Kenneth Gonsalves

Oh ok, thanks for the prompt reply.

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-us...@googlegroups.com.
To unsubscribe from this group, send email to 
django-users+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en.



Re: Django setup

2010-10-12 Thread Kenneth Gonsalves
On Tue, 2010-10-12 at 17:13 -0700, Everett wrote:
> I recently installed Django on Windows, but I can't get the django-
> admin.py startproject to work unless I type the full path for django-
> admin.py. Do I need to add this to my System Variables? If so what do
> I put in for it? I've already tried the path. 

well, you only need to do this once - after that you can use manage.py
from within your project. So I would not bother about this.
-- 
regards
Kenneth Gonsalves

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-us...@googlegroups.com.
To unsubscribe from this group, send email to 
django-users+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en.



Re: Help with http basic authentication

2010-10-12 Thread Sam Lai
On 12 October 2010 22:29, Morten Pedersen  wrote:
> Hi everyone
> I would be very very gratefull for any help getting access to the basic http 
> user and password through Django.

As far as I know, HTTP Basic Authentication occurs at the HTTP
connection level, i.e. it is between the web server and browser. There
is no way for Django to access that.

What usually happens is people use 'forms authentication' instead.
Django has a built-in authentication app - see
http://docs.djangoproject.com/en/dev/topics/auth/

> A simple app that print out the password an user to the browser would really 
> help me very very much.
>
> Cheers
> Morten Pedersen
> Denmark
>
> --
> You received this message because you are subscribed to the Google Groups 
> "Django users" group.
> To post to this group, send email to django-us...@googlegroups.com.
> To unsubscribe from this group, send email to 
> django-users+unsubscr...@googlegroups.com.
> For more options, visit this group at 
> http://groups.google.com/group/django-users?hl=en.
>
>

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-us...@googlegroups.com.
To unsubscribe from this group, send email to 
django-users+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en.



Django setup

2010-10-12 Thread Everett
I recently installed Django on Windows, but I can't get the django-
admin.py startproject to work unless I type the full path for django-
admin.py. Do I need to add this to my System Variables? If so what do
I put in for it? I've already tried the path.

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-us...@googlegroups.com.
To unsubscribe from this group, send email to 
django-users+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en.



External IPB authentication via Django

2010-10-12 Thread Grigoriy Petukhov
I am trying to implement external authentication in Invision Power
Board Forum. They have converge which as I understand could do such
things but I don't understand it yet. Maybe somebody could share his
experience of using IPB/converge with Django?

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-us...@googlegroups.com.
To unsubscribe from this group, send email to 
django-users+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en.



Re: how to add login info while opening url

2010-10-12 Thread Bill Freeman
IIRC, you will need to use urllib2 and provide a "urlopener" that handles the
403 and responds with the credentials.  The more recent python (e.g.2.6)
documentation is pretty clear about it.  Again, from memory.

Bill

On Tue, Oct 12, 2010 at 1:52 PM, harryos  wrote:
> mm..I tried that..it gives 403 error..
> I don't think putting login info in request will help..that will work
> only for 401 I believe..
> not sure how to handle 403 from server..Any comments guys?
> harry
>
>
> On Oct 12, 6:19 pm, jimgardener  wrote:
>> hi
>> I was trying to get data from different web pages using urlopen and
>> read.
>>
>> from urllib import urlopen
>> def get_page_data(url):
>>     f=urlopen(url)
>>     return f.read()
>>
>> when I gave this url ,it produces a 'forbidden' response
>>
>> print get_page_data('http://groups.google.com/group/django-users/
>> topics')
>>
>> ==>
>> 
>> ...
>> > Forbidden
>> Your client does not have permission to get URL /group/django-
>> users/topics from this server.
>> ...
>>
>> I understand that it needs my login info..In a client program ,how do
>> I add this?My django app maintains a list of urls entered by a user
>> and at a user given  time opens and reads from each of the urls.In the
>> db I am storing the url string ,a user object and a datetime value
>> entered by the user .Suppose one of those urls needs login info as in
>> the above case,how can I store those?The same user may have different
>> login username,passwords for different urls.I don't think storing user
>> password in db is a good idea..
>> Is there a way to deal with this?
>> Any suggestions?
>> regards
>> jim
>
> --
> You received this message because you are subscribed to the Google Groups 
> "Django users" group.
> To post to this group, send email to django-us...@googlegroups.com.
> To unsubscribe from this group, send email to 
> django-users+unsubscr...@googlegroups.com.
> For more options, visit this group at 
> http://groups.google.com/group/django-users?hl=en.
>
>

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-us...@googlegroups.com.
To unsubscribe from this group, send email to 
django-users+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en.



TEMPLATE_CONTEXT_PROCESSORS and testserver

2010-10-12 Thread diogobaeder
Hi there,

I've being noticing something strange: I added a context processor to
my project, but it's not being used when I run the project by
"manage.py testserver". Why that? Did I do something wrong?

When I run it in "runserver", it's working alright.

Thanks!

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-us...@googlegroups.com.
To unsubscribe from this group, send email to 
django-users+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en.



Re: Admin Many-to-Many on a regular Form?

2010-10-12 Thread AK
I have not yet found a solution for this, the closest I've come
requires a bit of work based on James Bennett's response here:
http://markmail.org/message/irsln5d6m6wpxdiu

An alternative that looks slicker than the Django built-in is the
django-ajax-selects project: http://code.google.com/p/django-ajax-selects/

I haven't yet worked on implementing these, so I'm not sure how well
either of these work with the reverse-relation part of my question,
but I suspect there's a way to wrangle them into working.

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-us...@googlegroups.com.
To unsubscribe from this group, send email to 
django-users+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en.



How long is a model validation heavy testsuite supposed to run?

2010-10-12 Thread Jorge Vargas
Hello,

I recently inherited a project that uses a lot of model validations
and is mainly just a model (we have two django apps that use it as
their backend).

The test suite currently returns

Ran 460 tests in 980.347s
That is running on a SQLite db.

Is this normal/expected behavior ? is there a way to speed this up ?

We have some custom code both for the test running and for making the
project works therefore if this not not a normal behavior I suspect
that the problem may lie in there.

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-us...@googlegroups.com.
To unsubscribe from this group, send email to 
django-users+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en.



Re: Escaping text for raw SQL?

2010-10-12 Thread Nick Arnett
On Tue, Oct 12, 2010 at 9:53 AM, Steve Holden  wrote:

> ...
> but I can't off-hand remember which ones. If the back-end doesn't allow
> that then you have little option but to generate your own SQL. The
> required escape function is extremely simple:
>
>  def sqlesc(s):
>  return replace("'", "''")


Am I going brain dead, or isn't there more than just quotation marks that
need to be replaced?

This code is a back-end processing script, so there is no danger of SQL
injection by anybody (except me).

Nick

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-us...@googlegroups.com.
To unsubscribe from this group, send email to 
django-users+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en.



Re: reverse url of admin list

2010-10-12 Thread Marc Aymerich
On Tue, Oct 12, 2010 at 7:46 PM, Sævar Öfjörð  wrote:

> It's called 'changelist'
>
> So you should call reverse('admin:invoice_invoice_changelist')
>

Wow Sævar, thank you very much!

-- 
Marc

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-us...@googlegroups.com.
To unsubscribe from this group, send email to 
django-users+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en.



Re: how to add login info while opening url

2010-10-12 Thread harryos
mm..I tried that..it gives 403 error..
I don't think putting login info in request will help..that will work
only for 401 I believe..
not sure how to handle 403 from server..Any comments guys?
harry


On Oct 12, 6:19 pm, jimgardener  wrote:
> hi
> I was trying to get data from different web pages using urlopen and
> read.
>
> from urllib import urlopen
> def get_page_data(url):
>     f=urlopen(url)
>     return f.read()
>
> when I gave this url ,it produces a 'forbidden' response
>
> print get_page_data('http://groups.google.com/group/django-users/
> topics')
>
> ==>
> 
> ...
>  Forbidden
> Your client does not have permission to get URL /group/django-
> users/topics from this server.
> ...
>
> I understand that it needs my login info..In a client program ,how do
> I add this?My django app maintains a list of urls entered by a user
> and at a user given  time opens and reads from each of the urls.In the
> db I am storing the url string ,a user object and a datetime value
> entered by the user .Suppose one of those urls needs login info as in
> the above case,how can I store those?The same user may have different
> login username,passwords for different urls.I don't think storing user
> password in db is a good idea..
> Is there a way to deal with this?
> Any suggestions?
> regards
> jim

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-us...@googlegroups.com.
To unsubscribe from this group, send email to 
django-users+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en.



Re: Reponse code for a require_XHR decorator?

2010-10-12 Thread Sævar Öfjörð
400 Bad request indicates that the server did not understand the
request and that the client should not repeat it without modification.
I'd say it doesn't really matter what status code you use internally,
but 403 Forbidden is probably more expressive for this situation.
403 indicates that the server understood the request, but is refusing
to fulfill it.

- Sævar

On Oct 12, 7:37 pm, Oliver Andrich  wrote:
> Hi,
>
> I want to add an require_XHR decorator to my project. The implementation is
> pretty straightforward.
>
> def require_XHR(f):
>     @wraps(f)
>     def wrapper(request, *args, **kwargs):
>         if not request.is_ajax():
>             return HttpResponseBadRequest()
>         return f(request, *args, **kwargs)
>     return wrapper
>
> But the question is, is Bad Request (HTTP Status Code 400) the best choice?
> Which response code do you use in such a situation?
>
> Best regards,
> Oliver

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-us...@googlegroups.com.
To unsubscribe from this group, send email to 
django-users+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en.



Re: reverse url of admin list

2010-10-12 Thread Sævar Öfjörð
It's called 'changelist'

So you should call reverse('admin:invoice_invoice_changelist')

-Sævar


On Oct 12, 1:39 pm, Marc Aymerich  wrote:
> I'm trying to find out what is the reverse url sentence for the "admin list"
> of a specific model of an app. Suppose that we have an app called 'invoice'
> and this has a model also called 'invoice'. I want to get this url:
> "/admin/invoice/invoice" via reverse function. Something like :
>
> >>> reverse('admin:invoice_invoice_add')
>
> '/admin/invoice/invoice/add/'
>
> but with expected reverse('admin:invoice_invoice') it doesn't work :(
>
> >>> reverse('admin:invoice_invoice')
>
> Traceback (most recent call last):
>   File "", line 1, in 
>   File "/usr/lib/python2.6/dist-packages/django/core/urlresolvers.py", line
> 390, in reverse
>     *args, **kwargs)))
>   File "/usr/lib/python2.6/dist-packages/django/core/urlresolvers.py", line
> 336, in reverse
>     "arguments '%s' not found." % (lookup_view_s, args, kwargs))
> NoReverseMatch: Reverse for 'invoice_invoice' with arguments '()' and
> keyword arguments '{}' not found.
>
> Any idea?
>
> --
> Marc

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-us...@googlegroups.com.
To unsubscribe from this group, send email to 
django-users+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en.



Reponse code for a require_XHR decorator?

2010-10-12 Thread Oliver Andrich
Hi,

I want to add an require_XHR decorator to my project. The implementation is
pretty straightforward.

def require_XHR(f):
@wraps(f)
def wrapper(request, *args, **kwargs):
if not request.is_ajax():
return HttpResponseBadRequest()
return f(request, *args, **kwargs)
return wrapper

But the question is, is Bad Request (HTTP Status Code 400) the best choice?
Which response code do you use in such a situation?

Best regards,
Oliver

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-us...@googlegroups.com.
To unsubscribe from this group, send email to 
django-users+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en.



Re: Language problem with date based generic views

2010-10-12 Thread mf
Thanks Tom!, it worked perfectly fine.

On 12 oct, 12:00, Tom Evans  wrote:
> On Tue, Oct 12, 2010 at 3:32 PM, smallfish  wrote:
> > \w not include *, try use (.*)
> > --
> > blog:http://chenxiaoyu.org twitter: @nnfish
>
> I'm pretty sure he was just highlighting the differences between the
> two URLs; I don't think either actually have '*' in them.
>
> To the OP:
>
> Patient: 'It hurts when I do this'
> Doctor: 'Dont do that then!'
>
> Your issue is that your month names are generated in your URL using
> one localization, activated by the Request-Language sent by the user's
> browser, and another in your urlspec using your default localization.
>
> The blindingly obvious solution is to not use month names as part of
> the URL. The docs[1] say that you can configure
> django.views.generic.date_based.archive_month to use numeric indices
> by passing a month_format parameter.
>
> Cheers
>
> Tom
>
> [1]http://docs.djangoproject.com/en/1.2/ref/generic-views/#django-views-...

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-us...@googlegroups.com.
To unsubscribe from this group, send email to 
django-users+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en.



Re: trouble creating first project

2010-10-12 Thread Robbington
Ok Steve,

No need to get huffy. We are trying to help out Phil and if you had
read some of the previous posts you might notice I wasnt taking about
you.

Not that I wanted to name names
Shawn Milochik
"It seems that the command you're running is not on your PYTHONPATH.
You may have to enter the full path to django-admin."

You are absolutley right about ls not existing in /urs/local/bin but
for the scope of the post it seems to be an adequate example as he was
using it to create a symbolic link. I meant no disrepect your Linux
sensabilitys but as the guy sounds like he obvioulsy new to this I
thought I would keep it simple

Unlike..

"It's to do with the shell search path (under most shells, the $PATH
environment variable) which is a colon-separated list (Windows: a
semicolon-separated) list of directories which the shell searches for
programs to execute. "

Very helpful Steve, pat yourself on the back.

Kindest regards

Rob

ps, if you are planning to reply send me a direct email to continue
this discussion as its better than filling this guys post with
rubbish.


On Oct 12, 5:43 pm, Steve Holden  wrote:
> On 10/12/2010 4:02 PM, Robbington wrote:
>
> > I mention this because some one has said that it is to do with your
> > Python path, and this isnt true, its to do with the way you installed
> > django in the first place.
>
> It's nothing to do with the Python path (which is held in sys.path, and
> is essentially the list of directories that the interpreter searches for
> importable modules).
>
> It's to do with the shell search path (under most shells, the $PATH
> environment variable) which is a colon-separated list (Windows: a
> semicolon-separated) list of directories which the shell searches for
> programs to execute.
>
> I'd be very surprised, by the way, to find the ls program in
> /usr/local/bin. It normally lives (as do most other system binaries) in
> /bin.
>
> regards
>  Steve
> --
> DjangoCon US 2010 September 7-9http://djangocon.us/

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-us...@googlegroups.com.
To unsubscribe from this group, send email to 
django-users+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en.



Re: trouble creating first project

2010-10-12 Thread kashi
Hi Phil,

I too had similar trouble, as others have replied the problem will be
solved by creating a link.
I hope you'll find these 2 blog posts handy -
http://www.saltycrane.com/blog/2007/11/django-project-1-install/
http://jeffbaier.com/articles/installing-django-on-an-ubuntu-linux-server/

regards,

kashi

On Oct 12, 6:02 pm, Robbington  wrote:
> Phil,
>
> If it helps, /usr/local/bin is where linux looks for command line
> commands. If you have a quick look in there you will see things like
> ls, nano, and other program names that you can type into the command
> prompt. Hense the reason a link to djanog-admin.py has to exist in
> there for Ubuntu to know that it can be executed from the command
> prompt.
>
> I mention this because some one has said that it is to do with your
> Python path, and this isnt true, its to do with the way you installed
> django in the first place.
>
> Personally I dont use svn, as I always had problems with it, you might
> want to look into pythons setup-tools and use easy_install or pip.
> Both I have found to be excellent.
>
> Whilst getting to grips with django on ubuntu myself I encountered
> many python path problems as I am sure you will. You may want to read
> up on virtualenv (http://pypi.python.org/pypi/virtualenv) and creating
> your projects inside a virtual environment as it will help you in the
> long run.
>
> Hope thats helpful in someway :)
>
> Rob

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-us...@googlegroups.com.
To unsubscribe from this group, send email to 
django-users+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en.



Re: Escaping text for raw SQL?

2010-10-12 Thread Steve Holden
On 10/12/2010 4:34 PM, Nick Arnett wrote:
> 
> 
> On Tue, Oct 12, 2010 at 9:00 AM, Javier Guerra Giraldez
> > wrote:
> 
> On Tue, Oct 12, 2010 at 10:46 AM, Nick Arnett  > wrote:
> > Anybody know a good way to do this?
> 
> Words.objects.filter(foo__in=mylist)
> 
> 
> Didn't even occur to me to not use raw SQL for this, but I could...
> trouble is, I wanted this to be reusable in a way that will be clumsy in
> the ORM.  But maybe I'll go that route.  I'm using raw SQL for a lot of
> this because the ORM is way too slow for what I'm doing.
> 
In which case be *extremely* careful not to introduce SQL injection
vulnerabilities into your code. The safest way is to use parameterized
queries. Some back-ends will let you write (untested):

cursor.execute("SELECT foo, bar FROM proj_words WHERE foo IN %s",
  my_list)

but I can't off-hand remember which ones. If the back-end doesn't allow
that then you have little option but to generate your own SQL. The
required escape function is extremely simple:

  def sqlesc(s):
  return replace("'", "''")

and the SQL generation would read something like (again, untested):

  sql = "SELECT foo, bar FROM proj_words WHERE foo IN (%s)" % \
", ".join("'%s'" % sqlesc(s) for s in my_list)

Personally I would do everything I could to avoid this construct, however.

regards
 Steve
-- 
DjangoCon US 2010 September 7-9 http://djangocon.us/

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-us...@googlegroups.com.
To unsubscribe from this group, send email to 
django-users+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en.



Re: trouble creating first project

2010-10-12 Thread Steve Holden
On 10/12/2010 4:02 PM, Robbington wrote:
> I mention this because some one has said that it is to do with your
> Python path, and this isnt true, its to do with the way you installed
> django in the first place.

It's nothing to do with the Python path (which is held in sys.path, and
is essentially the list of directories that the interpreter searches for
importable modules).

It's to do with the shell search path (under most shells, the $PATH
environment variable) which is a colon-separated list (Windows: a
semicolon-separated) list of directories which the shell searches for
programs to execute.

I'd be very surprised, by the way, to find the ls program in
/usr/local/bin. It normally lives (as do most other system binaries) in
/bin.

regards
 Steve
-- 
DjangoCon US 2010 September 7-9 http://djangocon.us/

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-us...@googlegroups.com.
To unsubscribe from this group, send email to 
django-users+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en.



Re: Escaping text for raw SQL?

2010-10-12 Thread Nick Arnett
On Tue, Oct 12, 2010 at 9:00 AM, Javier Guerra Giraldez
wrote:

> On Tue, Oct 12, 2010 at 10:46 AM, Nick Arnett 
> wrote:
> > Anybody know a good way to do this?
>
> Words.objects.filter(foo__in=mylist)


Didn't even occur to me to not use raw SQL for this, but I could... trouble
is, I wanted this to be reusable in a way that will be clumsy in the ORM.
 But maybe I'll go that route.  I'm using raw SQL for a lot of this because
the ORM is way too slow for what I'm doing.

Nick

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-us...@googlegroups.com.
To unsubscribe from this group, send email to 
django-users+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en.



Re: trouble creating first project

2010-10-12 Thread Robbington
Phil,

If it helps, /usr/local/bin is where linux looks for command line
commands. If you have a quick look in there you will see things like
ls, nano, and other program names that you can type into the command
prompt. Hense the reason a link to djanog-admin.py has to exist in
there for Ubuntu to know that it can be executed from the command
prompt.

I mention this because some one has said that it is to do with your
Python path, and this isnt true, its to do with the way you installed
django in the first place.

Personally I dont use svn, as I always had problems with it, you might
want to look into pythons setup-tools and use easy_install or pip.
Both I have found to be excellent.

Whilst getting to grips with django on ubuntu myself I encountered
many python path problems as I am sure you will. You may want to read
up on virtualenv (http://pypi.python.org/pypi/virtualenv) and creating
your projects inside a virtual environment as it will help you in the
long run.

Hope thats helpful in someway :)

Rob

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-us...@googlegroups.com.
To unsubscribe from this group, send email to 
django-users+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en.



Re: Escaping text for raw SQL?

2010-10-12 Thread Javier Guerra Giraldez
On Tue, Oct 12, 2010 at 10:46 AM, Nick Arnett  wrote:
> Anybody know a good way to do this?

Words.objects.filter(foo__in=mylist)

-- 
Javier

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-us...@googlegroups.com.
To unsubscribe from this group, send email to 
django-users+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en.



Escaping text for raw SQL?

2010-10-12 Thread Nick Arnett
I can't figure out if there is a way to escape text for raw SQL queries.  I
can't use substitution (I think) because I'm building a query like this:

SELECT foo, bar FROM proj_words WHERE foo IN ("bat", "bug", "snip", "snap")

The list of terms for the IN operator can be quite long... I suppose I could
dynamically generate this:

SELECT foo, bar FROM proj_words WHERE foo IN (%s, %s, %s, %s)

... but I was hoping for the much simpler list comprehension that MySQLdb
would do:

my_list = [connection.escape(x) for x in my_list]

However, I don't see an escape function exposed in Django.

Anybody know a good way to do this?

TIA,

Nick

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-us...@googlegroups.com.
To unsubscribe from this group, send email to 
django-users+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en.



Delete the FileField record but keep the file?

2010-10-12 Thread Stodge
Short of creating my own custom FileField class, is there anyway to
pass an optional "delete" flag to a custom file system storage? I have
a case where I want to delete the FileField record, but not the file.

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-us...@googlegroups.com.
To unsubscribe from this group, send email to 
django-users+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en.



Re: trouble creating first project

2010-10-12 Thread Jonathan Barratt

On 12 ต.ค. 2010, at 22:20, Phil wrote:

> Thanks for reply Steve.
> 
> Yes I seen the section about symbolic linking on the django website.
> It says on the website to type this command
> 
> "ln -s WORKING-DIR/django-trunk/django/bin/django-admin.py /usr/local/
> bin"
> 
> which I did(replacing WORKING_DIR obviously with the right path), but
> I'm not sure what "/usr/local/bin" is supposed to point to or what
> path should this be exactly?

The ln -s command will create a symbolic link to django-admin.py in the 
directory specified by the path /usr/local/bin

Thus after running the command you should now have a django-admin.py located in 
/usr/local/bin which "points" to the actual django-admin.py, thus making 
django-admin.py available from wherever - assuming /usr/local/bin is in your 
PATH...

Hope that helps explain it,
Jonathan 
> 
> 
> On Oct 11, 6:20 pm, Steve Holden  wrote:
>> On 10/11/2010 1:47 AM, Phil wrote:> Hi,
>> 
>>> I am having trouble creating my first project. I am running the latest
>>> version of Ubuntu and I installed Django from svn, when I run 'import
>>> django' i get no errors back so I assume its installed OK.
>> 
>>> When I run 'django-admin.py startproject myproject' I get back an
>>> error saying 'django-admin.py: command not found'.
>> 
>>> How can I solve/get around this error? Appreciate any help/ advice
>>> offered
>> 
>> When you install Django from svn it doesn't add django-admin to any of
>> the directories that your system looks for programs in (i.e. those
>> directories on your path).
>> 
>> When you install Django with setuptools (i.e. using setup.py) then you
>> should find that django-admin is placed where it can be found.
>> 
>> The simplest way around this is to make a symbolic link from one of the
>> directories on your path to the django-admin.py file.
>> 
>> regards
>>  Steve
>> --
>> DjangoCon US 2010 September 7-9http://djangocon.us/
> 
> -- 
> You received this message because you are subscribed to the Google Groups 
> "Django users" group.
> To post to this group, send email to django-us...@googlegroups.com.
> To unsubscribe from this group, send email to 
> django-users+unsubscr...@googlegroups.com.
> For more options, visit this group at 
> http://groups.google.com/group/django-users?hl=en.
> 

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-us...@googlegroups.com.
To unsubscribe from this group, send email to 
django-users+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en.



Re: POST the form several times

2010-10-12 Thread LA_
ok, there is no need to do it with django - everything can be done
directly in the html with usage of javascript.
just django variables should be passed to the script (in the same way
as they are used in html)
On 11 окт, 19:51, LA_  wrote:
> hi all,
> need your help to understand whether the following can be done with
> django (and if can - then how).
> I have items array, which contains details of files. I need to upload
> them to the server (with POST request), but it supports uploading of 5
> files at once only, filenames to be passed in fields file1, file2 etc.
> My items array can contain much more elements (i.e. files) then 5. Is
> there any way to take 5 first files from the array, send it, wait for
> result, then take next 5 files, send them etc.?

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-us...@googlegroups.com.
To unsubscribe from this group, send email to 
django-users+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en.



Re: trouble creating first project

2010-10-12 Thread Phil
Thanks for reply Steve.

Yes I seen the section about symbolic linking on the django website.
It says on the website to type this command

"ln -s WORKING-DIR/django-trunk/django/bin/django-admin.py /usr/local/
bin"

which I did(replacing WORKING_DIR obviously with the right path), but
I'm not sure what "/usr/local/bin" is supposed to point to or what
path should this be exactly?


On Oct 11, 6:20 pm, Steve Holden  wrote:
> On 10/11/2010 1:47 AM, Phil wrote:> Hi,
>
> > I am having trouble creating my first project. I am running the latest
> > version of Ubuntu and I installed Django from svn, when I run 'import
> > django' i get no errors back so I assume its installed OK.
>
> > When I run 'django-admin.py startproject myproject' I get back an
> > error saying 'django-admin.py: command not found'.
>
> > How can I solve/get around this error? Appreciate any help/ advice
> > offered
>
> When you install Django from svn it doesn't add django-admin to any of
> the directories that your system looks for programs in (i.e. those
> directories on your path).
>
> When you install Django with setuptools (i.e. using setup.py) then you
> should find that django-admin is placed where it can be found.
>
> The simplest way around this is to make a symbolic link from one of the
> directories on your path to the django-admin.py file.
>
> regards
>  Steve
> --
> DjangoCon US 2010 September 7-9http://djangocon.us/

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-us...@googlegroups.com.
To unsubscribe from this group, send email to 
django-users+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en.



Re: Language problem with date based generic views

2010-10-12 Thread Tom Evans
On Tue, Oct 12, 2010 at 3:32 PM, smallfish  wrote:
> \w not include *, try use (.*)
> --
> blog: http://chenxiaoyu.org  twitter: @nnfish
>
>

I'm pretty sure he was just highlighting the differences between the
two URLs; I don't think either actually have '*' in them.

To the OP:

Patient: 'It hurts when I do this'
Doctor: 'Dont do that then!'


Your issue is that your month names are generated in your URL using
one localization, activated by the Request-Language sent by the user's
browser, and another in your urlspec using your default localization.

The blindingly obvious solution is to not use month names as part of
the URL. The docs[1] say that you can configure
django.views.generic.date_based.archive_month to use numeric indices
by passing a month_format parameter.


Cheers

Tom

[1] 
http://docs.djangoproject.com/en/1.2/ref/generic-views/#django-views-generic-date-based-archive-month

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-us...@googlegroups.com.
To unsubscribe from this group, send email to 
django-users+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en.



Re: Language problem with date based generic views

2010-10-12 Thread smallfish
\w not include *, try use (.*)
--
blog: http://chenxiaoyu.org  twitter: @nnfish 



On Tue, Oct 12, 2010 at 10:29 PM, mf  wrote:

> I've changed the language-code from en-us to es-ar and the url's began
> to fail.
> Example: When I click in "Agosto 2010" the URL is "http://mysite.com/
> weblog/2010/**ago**/ " and the
> server couldn't finde the page. But if I
> browse "http://mysite.com/weblog/2010/**aug**/ the server finds and
> shows the page.
>
> urls.py:
>
>urlpatterns = patterns('django.views.generic.date_based',
> (r'^$', 'archive_index', entry_info_dict,
> 'coltrane_entry_archive_index'),
> (r'^(?P\d{4})/$', 'archive_year', entry_info_dict,
>  'coltrane_entry_archive_year'),
> (r'^(?P\d{4})/(?P\w{3})/$', 'archive_month',
> entry_info_dict,
>  'coltrane_entry_archive_month'),
>)
>
> templatetags.py:
>
>@register.inclusion_tag('coltrane/month_links_snippet.html')
>def render_month_links():
>return {
>'dates': Entry.objects.dates('pub_date', 'month'),
>}
>
> month_links_snippet.html:
>
>
>  {% for d in dates reversed %}
>{{ d|date:"F Y" }} a>
>  {% endfor %}
>
>
> --
> You received this message because you are subscribed to the Google Groups
> "Django users" group.
> To post to this group, send email to django-us...@googlegroups.com.
> To unsubscribe from this group, send email to
> django-users+unsubscr...@googlegroups.com
> .
> For more options, visit this group at
> http://groups.google.com/group/django-users?hl=en.
>
>

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-us...@googlegroups.com.
To unsubscribe from this group, send email to 
django-users+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en.



Language problem with date based generic views

2010-10-12 Thread mf
I've changed the language-code from en-us to es-ar and the url's began
to fail.
Example: When I click in "Agosto 2010" the URL is "http://mysite.com/
weblog/2010/**ago**/" and the server couldn't finde the page. But if I
browse "http://mysite.com/weblog/2010/**aug**/ the server finds and
shows the page.

urls.py:

urlpatterns = patterns('django.views.generic.date_based',
 (r'^$', 'archive_index', entry_info_dict,
'coltrane_entry_archive_index'),
 (r'^(?P\d{4})/$', 'archive_year', entry_info_dict,
  'coltrane_entry_archive_year'),
 (r'^(?P\d{4})/(?P\w{3})/$', 'archive_month',
entry_info_dict,
  'coltrane_entry_archive_month'),
)

templatetags.py:

@register.inclusion_tag('coltrane/month_links_snippet.html')
def render_month_links():
return {
'dates': Entry.objects.dates('pub_date', 'month'),
}

month_links_snippet.html:


  {% for d in dates reversed %}
{{ d|date:"F Y" }}
  {% endfor %}


-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-us...@googlegroups.com.
To unsubscribe from this group, send email to 
django-users+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en.



Re: output shapefiles

2010-10-12 Thread Paul Winkler
If you're using PostGIS, one option might be to call its dumper as a
separate process.
http://postgis.refractions.net/docs/ch04.html#id2638528

Don't know what tools exist for other spatial databases...


On Oct 12, 1:50 am, Evan Bowling  wrote:
> Hello all!
>
>     I was wondering if anyone knew if there was a way to output a
> shapefile from a django database. I didn't find anything in previous
> posts, and couldn't figure anything out just yet looking at django/
> contrib/gis/gdal/datasource.py
>
> I was hoping I could do something like the following:
>
> >>> import os
> >>> from geodjango import world
> >>> world_shp = os.path.abspath(os.path.join(os.path.dirname(world.__file__),
>
> ...                             'data/TM_WORLD_BORDERS-0.3.shp'))
>
> >>> from django.contrib.gis.gdal import *
> >>> ds = DataSource(world_shp)
> >>> ds.save('data/TM_WORLD_BORDERS-0.3_new.shp')
>
> I'm working on creating an application where users can create their
> own dataset using OpenLayers or Google Maps, and I would like to
> create an option to export the data in a shapefile format.
>
> Thanks,
> Evan
>
> I am Django (and so can you!)

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-us...@googlegroups.com.
To unsubscribe from this group, send email to 
django-users+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en.



How to avoid update "COMPUTED BY" field ?

2010-10-12 Thread maxi
Hi,

I'm working with a legacy database. It has a calculate field (COMPUTED
BY)  which is the result of concatenation of two varchars fields.

In my model I created a common CharField() field object with editable
= False
Now, the problem is what I do an update from this model, django
include the calculate (read only) field to update statement.

How can I avoid this?


Thanks in advance.
---
Maxi.

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-us...@googlegroups.com.
To unsubscribe from this group, send email to 
django-users+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en.



Re: Django Weaknesses

2010-10-12 Thread Masklinn
On 2010-10-12, at 15:33 , tee wrote:
> Hello users,
> 
> What would you say are the weaknesses of django framework??

I would suggest that you check out the videos from the latest DjangoCon, there 
were a number of presentations on issues with Django.

As good a starting point as any is probably Eric Florenzano's Why Django Sucks, 
and How We Can Fix It[0] and his followup post "An Object Lesson in How to 
Respond to Criticism"[1] on the initial reaction to his talk.

[0] http://djangocon.blip.tv/file/4112452/
[1] http://www.eflorenzano.com/blog/post/object-lesson-how-respond-criticism/

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-us...@googlegroups.com.
To unsubscribe from this group, send email to 
django-users+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en.



Re: Django Weaknesses

2010-10-12 Thread Alessandro Pasotti
2010/10/12 tee 

> Hello users,
>
> What would you say are the weaknesses of django framework??
>


Recently, we have seen a very interesting discussion on this list:

search on Google for "Why Django Apps Suck"

very interesting is also: http://blip.tv/file/4112452/


-- 
Alessandro Pasotti
w3:   www.itopen.it

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-us...@googlegroups.com.
To unsubscribe from this group, send email to 
django-users+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en.



Django Weaknesses

2010-10-12 Thread tee
Hello users,

What would you say are the weaknesses of django framework??

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-us...@googlegroups.com.
To unsubscribe from this group, send email to 
django-users+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en.



how to add login info while opening url

2010-10-12 Thread jimgardener
hi
I was trying to get data from different web pages using urlopen and
read.

from urllib import urlopen
def get_page_data(url):
f=urlopen(url)
return f.read()

when I gave this url ,it produces a 'forbidden' response

print get_page_data('http://groups.google.com/group/django-users/
topics')

==>

...
Forbidden
Your client does not have permission to get URL /group/django-
users/topics from this server.
...



I understand that it needs my login info..In a client program ,how do
I add this?My django app maintains a list of urls entered by a user
and at a user given  time opens and reads from each of the urls.In the
db I am storing the url string ,a user object and a datetime value
entered by the user .Suppose one of those urls needs login info as in
the above case,how can I store those?The same user may have different
login username,passwords for different urls.I don't think storing user
password in db is a good idea..
Is there a way to deal with this?
Any suggestions?
regards
jim

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-us...@googlegroups.com.
To unsubscribe from this group, send email to 
django-users+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en.



Re: WANT TO SEND REQ TO URL GET RESPONSE FROM THE SAME URL

2010-10-12 Thread Sam Lai
On 12 October 2010 22:56, sami nathan  wrote:
> Hello sir,
> I need to display the reult of
>           "http://m.broov.com/wap/di/sub?word=dog=00=Submit;
> in my url which is
> http://localhost/flip/wap/di/sub?word=dog=00=Submit
> My view looks like this
> from django.http import *
> from django.template import loader, Context
> from django.shortcuts import render_to_response
>
> def current_datetime(request):
>   word = request.GET['word']
>
> url=HttpResponse('http://m.broov.com/wap/di/sub?word='+word+"type=00submit=Submit')
>   return (url)
>
>
>    i want response from this site to be displayed not url of the site
> i want to only return the response from this site but i am getting oly
> url of this site displayed

Use a HttpResponseRedirect instead to redirect the user to that URL, e.g.

from django.http import HttpResponseRedirect
url=HttpResponseRedirect("blah")
return url

That will redirect the user, i.e. the user's URL will change.

If you don't want that to happen, you'll need to use python's urllib
to make a request to that URL, get the response, and pass that
response forward using HttpResponse.

> --
> You received this message because you are subscribed to the Google Groups 
> "Django users" group.
> To post to this group, send email to django-us...@googlegroups.com.
> To unsubscribe from this group, send email to 
> django-users+unsubscr...@googlegroups.com.
> For more options, visit this group at 
> http://groups.google.com/group/django-users?hl=en.
>
>

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-us...@googlegroups.com.
To unsubscribe from this group, send email to 
django-users+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en.



Re: WANT TO SEND REQ TO URL GET RESPONSE FROM THE SAME URL

2010-10-12 Thread sami nathan
Hello sir,
I need to display the reult of
  "http://m.broov.com/wap/di/sub?word=dog=00=Submit;
in my url which is
http://localhost/flip/wap/di/sub?word=dog=00=Submit
My view looks like this
from django.http import *
from django.template import loader, Context
from django.shortcuts import render_to_response

def current_datetime(request):
  word = request.GET['word']

url=HttpResponse('http://m.broov.com/wap/di/sub?word='+word+"type=00submit=Submit')
  return (url)


   i want response from this site to be displayed not url of the site
i want to only return the response from this site but i am getting oly
url of this site displayed

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-us...@googlegroups.com.
To unsubscribe from this group, send email to 
django-users+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en.



Re: WANT TO SEND REQ TO URL GET RESPONSE FROM THE SAME URL

2010-10-12 Thread sami nathan
Hello sir,
I need to display the reult of
   "http://m.broov.com/wap/di/sub?word=dog=00=Submit;
in my url which is
http://localhost/flip/wap/di/sub?word=dog=00=Submit
My view looks like this
from django.http import *
from django.template import loader, Context
from django.shortcuts import render_to_response

def current_datetime(request):
   word = request.GET['word']

url=HttpResponse('http://m.broov.com/wap/di/sub?word='+word+"type=00submit=Submit')
   return (url)


i want response from this site to be displayed not url of the site
i want to only return the response from this site but i am getting oly
url of this site displayed

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-us...@googlegroups.com.
To unsubscribe from this group, send email to 
django-users+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en.



reverse url of admin list

2010-10-12 Thread Marc Aymerich
I'm trying to find out what is the reverse url sentence for the "admin list"
of a specific model of an app. Suppose that we have an app called 'invoice'
and this has a model also called 'invoice'. I want to get this url:
"/admin/invoice/invoice" via reverse function. Something like :

>>> reverse('admin:invoice_invoice_add')
'/admin/invoice/invoice/add/'

but with expected reverse('admin:invoice_invoice') it doesn't work :(

>>> reverse('admin:invoice_invoice')
Traceback (most recent call last):
  File "", line 1, in 
  File "/usr/lib/python2.6/dist-packages/django/core/urlresolvers.py", line
390, in reverse
*args, **kwargs)))
  File "/usr/lib/python2.6/dist-packages/django/core/urlresolvers.py", line
336, in reverse
"arguments '%s' not found." % (lookup_view_s, args, kwargs))
NoReverseMatch: Reverse for 'invoice_invoice' with arguments '()' and
keyword arguments '{}' not found.

Any idea?


-- 
Marc

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-us...@googlegroups.com.
To unsubscribe from this group, send email to 
django-users+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en.



Help with http basic authentication

2010-10-12 Thread Morten Pedersen
Hi everyone
I would be very very gratefull for any help getting access to the basic http 
user and password through Django.

A simple app that print out the password an user to the browser would really 
help me very very much.

Cheers
Morten Pedersen
Denmark

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-us...@googlegroups.com.
To unsubscribe from this group, send email to 
django-users+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en.



Re: MySQLdb on Ubuntu 10.10

2010-10-12 Thread Jonathan Barratt
Hi Will,

On 12 ?.?. 2010, at 16:52, Will McGugan wrote:

> Hi,
> 
> I've just upgraded my development machine from Ubuntu 10.04 to 10.10.
> Unfortunately, now my Django apps wont start, I get the following
> traceback on runserver:



>  File "/usr/local/lib/python2.6/dist-packages/django/db/backends/
> mysql/base.py", line 14, in 
>raise ImproperlyConfigured("Error loading MySQLdb module: %s" % e)
> django.core.exceptions.ImproperlyConfigured: Error loading MySQLdb
> module: libmysqlclient_r.so.15: cannot open shared object file: No
> such file or directory

Looks to me like the upgrade has done something to your mysql-client libraries. 
I'd check their installation status via aptitude, perhaps do a reinstall of the 
mysql client package. Can you connect to your DB from the command line?

Good luck!
Jonthan

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-us...@googlegroups.com.
To unsubscribe from this group, send email to 
django-users+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en.



Re: MySQLdb on Ubuntu 10.10

2010-10-12 Thread smallfish
perhaps missing mysql-client libary.
try use aptitude to install it, don't use easy_install
good luck
--
blog: http://chenxiaoyu.org  twitter: @nnfish 



On Tue, Oct 12, 2010 at 5:52 PM, Will McGugan  wrote:

> Hi,
>
> I've just upgraded my development machine from Ubuntu 10.04 to 10.10.
> Unfortunately, now my Django apps wont start, I get the following
> traceback on runserver:
>
>
> File "/usr/local/lib/python2.6/dist-packages/django/core/management/
> commands/runserver.py", line 48, in inner_run
>self.validate(display_num_errors=True)
>  File "/usr/local/lib/python2.6/dist-packages/django/core/management/
> base.py", line 245, in validate
>num_errors = get_validation_errors(s, app)
>  File "/usr/local/lib/python2.6/dist-packages/django/core/management/
> validation.py", line 22, in get_validation_errors
>from django.db import models, connection
>  File "/usr/local/lib/python2.6/dist-packages/django/db/__init__.py",
> line 75, in 
>connection = connections[DEFAULT_DB_ALIAS]
>  File "/usr/local/lib/python2.6/dist-packages/django/db/utils.py",
> line 91, in __getitem__
>backend = load_backend(db['ENGINE'])
>  File "/usr/local/lib/python2.6/dist-packages/django/db/utils.py",
> line 32, in load_backend
>return import_module('.base', backend_name)
>  File "/usr/local/lib/python2.6/dist-packages/django/utils/
> importlib.py", line 35, in import_module
>__import__(name)
>  File "/usr/local/lib/python2.6/dist-packages/django/db/backends/
> mysql/base.py", line 14, in 
>raise ImproperlyConfigured("Error loading MySQLdb module: %s" % e)
> django.core.exceptions.ImproperlyConfigured: Error loading MySQLdb
> module: libmysqlclient_r.so.15: cannot open shared object file: No
> such file or directory
>
> I realise this probably isn't specifically a Django issue, but it
> sounds like an issue that other Django devs would have experienced.
>
> Any help would be appreciated...
>
> Will
>
> --
> You received this message because you are subscribed to the Google Groups
> "Django users" group.
> To post to this group, send email to django-us...@googlegroups.com.
> To unsubscribe from this group, send email to
> django-users+unsubscr...@googlegroups.com
> .
> For more options, visit this group at
> http://groups.google.com/group/django-users?hl=en.
>
>

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-us...@googlegroups.com.
To unsubscribe from this group, send email to 
django-users+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en.



MySQLdb on Ubuntu 10.10

2010-10-12 Thread Will McGugan
Hi,

I've just upgraded my development machine from Ubuntu 10.04 to 10.10.
Unfortunately, now my Django apps wont start, I get the following
traceback on runserver:


File "/usr/local/lib/python2.6/dist-packages/django/core/management/
commands/runserver.py", line 48, in inner_run
self.validate(display_num_errors=True)
  File "/usr/local/lib/python2.6/dist-packages/django/core/management/
base.py", line 245, in validate
num_errors = get_validation_errors(s, app)
  File "/usr/local/lib/python2.6/dist-packages/django/core/management/
validation.py", line 22, in get_validation_errors
from django.db import models, connection
  File "/usr/local/lib/python2.6/dist-packages/django/db/__init__.py",
line 75, in 
connection = connections[DEFAULT_DB_ALIAS]
  File "/usr/local/lib/python2.6/dist-packages/django/db/utils.py",
line 91, in __getitem__
backend = load_backend(db['ENGINE'])
  File "/usr/local/lib/python2.6/dist-packages/django/db/utils.py",
line 32, in load_backend
return import_module('.base', backend_name)
  File "/usr/local/lib/python2.6/dist-packages/django/utils/
importlib.py", line 35, in import_module
__import__(name)
  File "/usr/local/lib/python2.6/dist-packages/django/db/backends/
mysql/base.py", line 14, in 
raise ImproperlyConfigured("Error loading MySQLdb module: %s" % e)
django.core.exceptions.ImproperlyConfigured: Error loading MySQLdb
module: libmysqlclient_r.so.15: cannot open shared object file: No
such file or directory

I realise this probably isn't specifically a Django issue, but it
sounds like an issue that other Django devs would have experienced.

Any help would be appreciated...

Will

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-us...@googlegroups.com.
To unsubscribe from this group, send email to 
django-users+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en.



output shapefiles

2010-10-12 Thread Evan Bowling
Hello all!

I was wondering if anyone knew if there was a way to output a
shapefile from a django database. I didn't find anything in previous
posts, and couldn't figure anything out just yet looking at django/
contrib/gis/gdal/datasource.py

I was hoping I could do something like the following:

>>> import os
>>> from geodjango import world
>>> world_shp = os.path.abspath(os.path.join(os.path.dirname(world.__file__),
... 'data/TM_WORLD_BORDERS-0.3.shp'))
>>> from django.contrib.gis.gdal import *
>>> ds = DataSource(world_shp)
>>> ds.save('data/TM_WORLD_BORDERS-0.3_new.shp')


I'm working on creating an application where users can create their
own dataset using OpenLayers or Google Maps, and I would like to
create an option to export the data in a shapefile format.


Thanks,
Evan

I am Django (and so can you!)

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-us...@googlegroups.com.
To unsubscribe from this group, send email to 
django-users+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en.



Fwd: WANT TO SEND REQ TO URL GET RESPONSE FROM THE SAME URL

2010-10-12 Thread sami nathan
-- Forwarded message --
From: sami nathan 
Date: Tue, Oct 12, 2010 at 3:37 PM
Subject: WANT TO SEND REQ TO URL GET RESPONSE FROM THE SAME URL
To: django-users@googlegroups.com


 i want to send my req from my url that
is"http://localhost/flip/wap/di/sub?word=formula=00=Submit;
that i want to send only the word "formula" to the url
"http://m.broov.com/wap/di/sub?word=fomula=00=Submit"and i
want to get response from the same url and display in my page
my view looks like this

from django.http import *
from django.template import loader, Context

def current_datetime(request):
  word = request.GET['word']
  
message=HttpResponse('http://m.broov.com/wap/di/sub?word='+word+'=Submit')
  return HttpResponse(message)

MY url looks like this

from django.conf.urls.defaults import *
from flip.view import current_datetime




urlpatterns = patterns('',
   :
      (r"^wap/di/sub",current_datetime)

I AM GETTING RESPONSE HAS THE  URL  IN MY DISPLAY PAGE

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-us...@googlegroups.com.
To unsubscribe from this group, send email to 
django-users+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en.



Re: WANT TO SEND REQ TO URL GET RESPONSE FROM THE SAME URL

2010-10-12 Thread bruno desthuilliers
Please DONT SHOUT. Thanks.

On 12 oct, 12:07, sami nathan  wrote:
>  i want to send my req from my url that
> is"http://localhost/flip/wap/di/sub?word=formula=00=Submit;

Your proper url is "http://localhost/flip/wap/di/sub;. The remaining
part ("?word=formula=00=Submit") is a querystring.

> that i want to send only the word "formula" to the url
> "http://m.broov.com/wap/di/sub?word=fomula=00=Submit"and i
> want to get response from the same url and display in my page
> my view looks like this
> 
> from django.http import *
> from django.template import loader, Context
>
> def current_datetime(request):
>    word = request.GET['word']

You'll have an error if "word=" is not in the querystring.

>    
> message=HttpResponse('http://m.broov.com/wap/di/sub?word='+word+'=Submit')

You build an HttpResponse...

>    return HttpResponse(message)

and then another HttpResponse from the first one. While it
(tehcnically) works, it's really a WTF.


> MY url looks like this
> 
> from django.conf.urls.defaults import *
> from flip.view import current_datetime
>
> urlpatterns = patterns('',
>     :
>        (r"^wap/di/sub",current_datetime)
>
> I AM GETTING RESPONSE HAS THE SAME URL  IN MY DISPLAY PAGE

I don't understand this last sentence, sorry.

May I suggest you read this:
www.catb.org/esr/faqs/smart-questions.html

then come back with something we can make sense of ?

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-us...@googlegroups.com.
To unsubscribe from this group, send email to 
django-users+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en.



distinct doesn't work on admin actions¿?

2010-10-12 Thread Marc Aymerich
Hi!
I'm writing an action for the django admin site. My model looks like:

class order(models.Model):
entity = models.ForeignKey(entity)
[...]


I select an arbitrary number of orders and I need to know the different
entities that they have. It works on shell:

>>> queryset = order.objects.all()
>>> queryset.all().values_list('entity', flat=True).distinct()
[1L]

But on Admin seems the distinct part of the queryset doesn't work

class orderAdmin(admin.ModelAdmin):
   []
def invoice(self, request, queryset):
print str(queryset.all().values_list('entity',
flat=True).distinct())
[]


Here the output of selecting all order elements(4), the output is a little
different from the same operation in shell :(

[1L, 1L, 1L, 1L]


What's happening here?
Thanks!
-- 
Marc

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-us...@googlegroups.com.
To unsubscribe from this group, send email to 
django-users+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en.



Re: Django admin with IE8

2010-10-12 Thread Tsolmon Narantsogt
Good


I'm using Django 1.2.1 MySql 5.1  python2.6

and works beautifully on Firefox, but using IE8 I intermittently get a
puzzling 'Internet Explorer cannot display this webpage' when I save a
record.

help me .

Thanks
Tsolmon




On Tue, Oct 12, 2010 at 6:08 PM, Xavier Ordoquy wrote:

> Hello,
>
> If you need help, please provide accurate information on your issue.
> Starting with "I get a page not found" will most probably get your mail
> immediately discarded.
> What page is not found ? what is your setting (dev server, apache, nginx,
> proxy+webserver) ? and so on.
>
> Regards,
> Xavier.
>
> Le 12 oct. 2010 à 11:57, Tsolmon Narantsogt a écrit :
>
> > Hello List
> >
> > I get a page not found error. But if I hit refresh I get the admin home
> page while the title of the Internet Explorer window remains "HTTP 404...".
> The admin seems to work. It just would be nice to not have to hit refresh
> every time.
> >
> > Thanks
> > Tsolmon
> >
> > --
> > You received this message because you are subscribed to the Google Groups
> "Django users" group.
> > To post to this group, send email to django-us...@googlegroups.com.
> > To unsubscribe from this group, send email to
> django-users+unsubscr...@googlegroups.com
> .
> > For more options, visit this group at
> http://groups.google.com/group/django-users?hl=en.
>
> --
> You received this message because you are subscribed to the Google Groups
> "Django users" group.
> To post to this group, send email to django-us...@googlegroups.com.
> To unsubscribe from this group, send email to
> django-users+unsubscr...@googlegroups.com
> .
> For more options, visit this group at
> http://groups.google.com/group/django-users?hl=en.
>
>

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-us...@googlegroups.com.
To unsubscribe from this group, send email to 
django-users+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en.



Re: Django admin with IE8

2010-10-12 Thread Xavier Ordoquy
Hello,

If you need help, please provide accurate information on your issue.
Starting with "I get a page not found" will most probably get your mail 
immediately discarded.
What page is not found ? what is your setting (dev server, apache, nginx, 
proxy+webserver) ? and so on.

Regards,
Xavier.

Le 12 oct. 2010 à 11:57, Tsolmon Narantsogt a écrit :

> Hello List
> 
> I get a page not found error. But if I hit refresh I get the admin home page 
> while the title of the Internet Explorer window remains "HTTP 404...". The 
> admin seems to work. It just would be nice to not have to hit refresh every 
> time.
> 
> Thanks 
> Tsolmon
> 
> -- 
> You received this message because you are subscribed to the Google Groups 
> "Django users" group.
> To post to this group, send email to django-us...@googlegroups.com.
> To unsubscribe from this group, send email to 
> django-users+unsubscr...@googlegroups.com.
> For more options, visit this group at 
> http://groups.google.com/group/django-users?hl=en.

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-us...@googlegroups.com.
To unsubscribe from this group, send email to 
django-users+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en.



WANT TO SEND REQ TO URL GET RESPONSE FROM THE SAME URL

2010-10-12 Thread sami nathan
 i want to send my req from my url that
is"http://localhost/flip/wap/di/sub?word=formula=00=Submit;
that i want to send only the word "formula" to the url
"http://m.broov.com/wap/di/sub?word=fomula=00=Submit"and i
want to get response from the same url and display in my page
my view looks like this

from django.http import *
from django.template import loader, Context

def current_datetime(request):
   word = request.GET['word']
   
message=HttpResponse('http://m.broov.com/wap/di/sub?word='+word+'=Submit')
   return HttpResponse(message)

MY url looks like this

from django.conf.urls.defaults import *
from flip.view import current_datetime




urlpatterns = patterns('',
:
   (r"^wap/di/sub",current_datetime)

I AM GETTING RESPONSE HAS THE SAME URL  IN MY DISPLAY PAGE

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-us...@googlegroups.com.
To unsubscribe from this group, send email to 
django-users+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en.



Django admin with IE8

2010-10-12 Thread Tsolmon Narantsogt
Hello List

I get a page not found error. But if I hit refresh I get the admin home page
while the title of the Internet Explorer window remains "HTTP 404...". The
admin seems to work. It just would be nice to not have to hit refresh every
time.

Thanks
Tsolmon

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-us...@googlegroups.com.
To unsubscribe from this group, send email to 
django-users+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en.



ANN: PyLucid CMS v0.9

2010-10-12 Thread jens
After a long time, we released PyLucid CMS in Version v0.9!

The main goals are:
* internationalization and localization support (Multilingual content)
* Multi site support (Allows a single installation to serve multiple
websites.)
* Revision controlled content

Please follow the install instruction on our Homepage: http://www.pylucid.org/

A DEMO page is also available here: http://demo.pylucid.net/

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-us...@googlegroups.com.
To unsubscribe from this group, send email to 
django-users+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en.



Re: design problem..how to store web page's data for later comparison

2010-10-12 Thread Jirka Vejrazka
> Yes, it's definitely possible. DBs support very large text fields nowadays, I 
> wouldn't worry about it. Postgres's text field type is only limited by the 
> 1GB value-size limit general to all Postgres DB fields.

  Plus, you can easily compresss web pages very effectively using
built-in Python funcitons. I assume you won't be storing images, only
HTML content (and maybe some JavaScript or CSS). You can expect some
80% reduction in size just by implementing some 4-6 lines of code...

  Cheers

Jirka

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-us...@googlegroups.com.
To unsubscribe from this group, send email to 
django-users+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en.



Re: design problem..how to store web page's data for later comparison

2010-10-12 Thread jimgardener
thank Jonathan..it was very helpful..
jim

> Good luck,
> Jonathan
>

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-us...@googlegroups.com.
To unsubscribe from this group, send email to 
django-users+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en.