Re: @login_required problem

2007-01-10 Thread Collin Grady

I don't know about your issue, but I wanted to offer you a little nifty
thing about dicts that might shrink your view a bit :)

Instead of an if/else to have a default value, use .get() on the dict,
like so:

screen = request.GET.get('screen', 'main')

If the key "screen" exists, it returns that, otherwise it returns
"main" :)


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



Re: Empty related sets = Page not found?

2007-01-10 Thread John M

Yup, that did it!

Thanks again Brian!


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



Re: Empty related sets = Page not found?

2007-01-10 Thread John M


Brian Beck wrote:
> Hi,
>
> object_list takes an allow_empty argument, try settings it to True.
> >From the docs:
>
> allow_empty: A boolean specifying whether to display the page if no
> objects are available. If this is False and no objects are available,
> the view will raise a 404 instead of displaying an empty page. By
> default, this is False.

WOW, thanks for the answer ... But why did it take you a whole 5min to
answer :-P, I love the Internet, support 24x7.

Thanks again!

John


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



Re: Empty related sets = Page not found?

2007-01-10 Thread Brian Beck

Hi,

object_list takes an allow_empty argument, try settings it to True.
>From the docs:

allow_empty: A boolean specifying whether to display the page if no
objects are available. If this is False and no objects are available,
the view will raise a 404 instead of displaying an empty page. By
default, this is False.


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



Empty related sets = Page not found?

2007-01-10 Thread John M

OK, again I'm stumpped.

I have the following models:

class Portfolio(models.Model):
user= models.ForeignKey(User)
description = models.CharField(maxlength=50)
notes   = models.CharField(maxlength=200)


class Holding(models.Model):
porfolio = models.ForeignKey(Portfolio)
symbol   = models.CharField(maxlength=10)

Heres my view to get a list of holdings for a particular portfolio:

def list_of_holdings(request, portfolio_id):
from django.views.generic.list_detail import object_list

p = Portfolio.objects.get(pk=portfolio_id)
ol = p.holding_set.all()

return object_list(request, ol,
template_name='aim/portfolio_entries.html'

So if the portfolio_id i pass has holdings, the routine works great,
but if the ID i pass in has no holdings, I get a 404 error page not
found.

It must be the empty set being passed to object_list, no?

Help i'm stumpped.

Thanks all


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



Differences between two methods of declaring a decorator

2007-01-10 Thread Collin Grady

While not strictly a django issue, this is relating to a ticket I found
when looking into why login_required won't accept a login_url param.

In http://code.djangoproject.com/ticket/903 Adrian says that changing
the definition would break backwards compatibility, and not knowing
tons about python, I can't see why...

Can anyone explain why doing "login_required =
user_passes_test(whatever)" is different than "def login_required(foo):
return user_passes_test(whatever)" ?


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



<<= END OF THE WORLD =>>

2007-01-10 Thread SHEETAL
   [image: Ending
Began]End of the
World !!! Begins[image:
Ending Began] 

 [image: Cracking
Starts] [image:
Drowning] 
http://megastuff.150m.com/end-of-earth-information/

*Global warming Shadows*
*Disaster beginning*
**
*Unstoppable Ending !!!*

[image: End of Earth] 


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



Re: Django Projects and Subversion

2007-01-10 Thread Cam

To deploy into production you should run all tests, tag a release and
have the webserver check out your tag.

cheers,
Cam.


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



form_for_model and default values

2007-01-10 Thread [EMAIL PROTECTED]

Hi everybody,

I'm newbie at django but I think is awesome. I use newforms and I had
two questions:

1) I have a model with a FileField so everything at the admin
interface works fine, but when I get the form using form_for_model the
widget isn't a FileInput(). Is this the right behaviour? or it's
because the feature isn't really implemented yet.

2) I have a model with a User field so what I do (on the view) is the
following:

Entry.fields['autor'].widget = forms.HiddenInput()

if request.user.is_authenticated():
Entry.fields['autor'].initial = (request.user.id,
request.user.username)

So the field doesn't appears but the user is selected
initialy. When the system process the form I get

(Hidden field autor) Enter a list of values.

I though that using initial and setting it to the current user will do
the trick to *automatically* fill the user field... but I've done some
wrong I guess. Any help?

Best regards

-- 

Rodrigo Lazo (rlazo)


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



Re: Importing models from outside applications

2007-01-10 Thread johnnie pittman
Hey Russ and Waylan,

Thanks for the responses.

Russ, I actually did that:

import sys
sys.path.append("path/to/project")
from project.app import models

complained about environment settings.  But when I dug into fixing that, I
over complicated the matter.  Waylan's response saw through my over
complication and we get to:

import os, sys
sys.path.append("path/to/project")
os.environ['DJANGO_SETTINGS_MODULE'] = "project.settings"

from project.app import models

and that works great.

Again, thank you both for your response.

Johnnie


On 1/10/07, Waylan Limberg <[EMAIL PROTECTED]> wrote:
>
>
> On 1/10/07, Russell Keith-Magee <[EMAIL PROTECTED]> wrote:
> >
> > On 1/10/07, johnnie pittman <[EMAIL PROTECTED]> wrote:
> >
> > > I'm looking to find out if there's a method to access django models in
> other
> > > applications outside of the django project structure.   What I'm
> looking to
> > > do is import a model from one of the apps in my project:
> > >
> > > from project.app import models
> >
> > Have you tried doing exactly that?  A Django app is just a python
> > module, so as long as project.app is on your PYTHONPATH when you run
> > manage.py, a simple import should work.
> >
> Of course, if your not running your app through manage.py, you'll need
> to define the DJANGO_SETTINGS_MODULE environment variable. After all,
> for you model to connect with a db, it'll need the connection
> settings.
>
> A minimal settings file with db connection info should do the trick.
> Depending on how you plan to run your app, you can either permenantly
> set the DJANGO_SETTINGS_MODULE environment variable via the OS or in
> you python code.
>
> In your python code this should do the trick ( where myproject is on
> your pythonpath):
>
> import os
> os.environ['DJANGO_SETTINGS_MODULE'] = "myproject.settings"
>
>
> --
> 
> Waylan Limberg
> [EMAIL PROTECTED]
>
> >
>


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


Re: Django Projects and Subversion

2007-01-10 Thread Kenneth Gonsalves


On 10-Jan-07, at 8:58 PM, Aidas Bendoraitis wrote:

> We are going to set our Django projects under
> version control on a dedicated server. We will also publicly run
> several Django websites on the same server. So what is a better
> practice -- to use the code under source
> control for the public websites directly,

this is simplest - only you need to be sure about who has permission  
to do the svn up and apache restart.

-- 

regards
kg
http://lawgon.livejournal.com
http://nrcfosshelpline.in/web/



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



Re: Hi! Here's a new Django beginner with a few questions.

2007-01-10 Thread Kenneth Gonsalves


On 10-Jan-07, at 6:13 PM, Sebastien Armand [Pink] wrote:

> class Person(models.Model):
> ...
> mother = models.ForeignKey('Person')

yes or use 'self'

-- 

regards
kg
http://lawgon.livejournal.com
http://nrcfosshelpline.in/web/



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



Re: Importing models from outside applications

2007-01-10 Thread Waylan Limberg

On 1/10/07, Russell Keith-Magee <[EMAIL PROTECTED]> wrote:
>
> On 1/10/07, johnnie pittman <[EMAIL PROTECTED]> wrote:
>
> > I'm looking to find out if there's a method to access django models in other
> > applications outside of the django project structure.   What I'm looking to
> > do is import a model from one of the apps in my project:
> >
> > from project.app import models
>
> Have you tried doing exactly that?  A Django app is just a python
> module, so as long as project.app is on your PYTHONPATH when you run
> manage.py, a simple import should work.
>
Of course, if your not running your app through manage.py, you'll need
to define the DJANGO_SETTINGS_MODULE environment variable. After all,
for you model to connect with a db, it'll need the connection
settings.

A minimal settings file with db connection info should do the trick.
Depending on how you plan to run your app, you can either permenantly
set the DJANGO_SETTINGS_MODULE environment variable via the OS or in
you python code.

In your python code this should do the trick ( where myproject is on
your pythonpath):

import os
os.environ['DJANGO_SETTINGS_MODULE'] = "myproject.settings"


-- 

Waylan Limberg
[EMAIL PROTECTED]

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



Re: Creating an empty queryset

2007-01-10 Thread Russell Keith-Magee

On 1/10/07, Michael Radziej <[EMAIL PROTECTED]> wrote:
>
> Adam Seering schrieb:
> > I would strongly second that.  This seems to have fallen somewhat
> > dead, though.  Any thoughts?; anyone in favor of it?; anyone know of
> > any reasons not to do it?
>
> +1 from me. I have already missed it several times. The "where
> 1=0 solution" looks stupid. And the changed implementation of
> QuerySet.in() also needs this (and uses where 1=0).

I'm +1 on adding a function for adding an empty queryset. Now, if only
a patch would materialize out of the ether... :-)

As for the '1=0' being stupid (and in() requiring it); agreed. 'where
in ()' and 'where false' don't work on all DB backends, and it's
non-trivial to optimize the logic chain to remove the need for the
dumb clause.

Any suggestions on better ways to represent this are greatfully
accepted. Patches are even more greatfully accepted.

Yours,
Russ Magee %-)

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



Re: Importing models from outside applications

2007-01-10 Thread Russell Keith-Magee

On 1/10/07, johnnie pittman <[EMAIL PROTECTED]> wrote:

> I'm looking to find out if there's a method to access django models in other
> applications outside of the django project structure.   What I'm looking to
> do is import a model from one of the apps in my project:
>
> from project.app import models

Have you tried doing exactly that?  A Django app is just a python
module, so as long as project.app is on your PYTHONPATH when you run
manage.py, a simple import should work.

Yours,
Russ Magee %-)

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



Re: developing a new ajax website: places2go.org. some comments apreciated.

2007-01-10 Thread [EMAIL PROTECTED]

On Jan 10, 9:22 pm, Vadim Macagon <[EMAIL PROTECTED]> wrote:
> So it's built on Rails and you're spamming the Django group?

It must be to show how slow it is compared to Django! :)

L.


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



Re: Announce: Portable Python v1.0 beta

2007-01-10 Thread Jeremy Dunck

On 1/10/07, Perica Zivkovic <[EMAIL PROTECTED]> wrote:
> I would like to announce the *first* beta release of the Portable
> Python 1.0 beta. From today Portable Python website is also online and
> you can find it on the location www.PortablePython.com.

Very nice, 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-users@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



Re: Design Q: Foreign keys from object.values()

2007-01-10 Thread George Davis

Great -- 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-users@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



Re: Convert From Restructured Text to HTML

2007-01-10 Thread Stephen Mizell
That's exactly what happened, but strange thing was it worked just fine
using the filter.  I even tried making some SQL queries to fix them for me,
but that didn't work.

Oh well, it's over now ;)

On 1/10/07, James Bennett <[EMAIL PROTECTED]> wrote:
>
>
> On 1/9/07, Stephen Mizell <[EMAIL PROTECTED]> wrote:
> > This started throwing all kinds of errors at me about encodings, such
> > as:
> > 'latin-1' codec can't encode characters in position 19-20: ordinal not
> > in range(256)
>
> Almost every time I've seen this (not quite every time, but almost
> every time), it's been because someone copy/pasted from an MS Word
> document which contained "smart quotes".
>
> --
> "May the forces of evil become confused on the way to your house."
>   -- George Carlin
>
> >
>


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


Re: Convert From Restructured Text to HTML

2007-01-10 Thread James Bennett

On 1/9/07, Stephen Mizell <[EMAIL PROTECTED]> wrote:
> This started throwing all kinds of errors at me about encodings, such
> as:
> 'latin-1' codec can't encode characters in position 19-20: ordinal not
> in range(256)

Almost every time I've seen this (not quite every time, but almost
every time), it's been because someone copy/pasted from an MS Word
document which contained "smart quotes".

-- 
"May the forces of evil become confused on the way to your house."
  -- George Carlin

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



Re: Convert From Restructured Text to HTML

2007-01-10 Thread Stephen Mizell

Well, I gave up on the automation.  I couldn't get restructuredtext to
work right in my views, so I swallowed my pride and went into
copy/paste mode.  I simple did this:

{% load markup %}

{% for post in posts %}

{{ post.id }}
{{ post.body|restructuredtext|escape 
}}

{% endfor %}


I edited each and every post and pasted the stuff from that page above.
 This is for anyone comes across the same issue and can't fix it like I
couldn't.  My fingers hurt now.


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



Re: developing a new ajax website: places2go.org. some comments apreciated.

2007-01-10 Thread Vadim Macagon

So it's built on Rails and you're spamming the Django group?


-+ enlight +-


pedro wrote:
> Technically, the site is built on Rails and i try to use AJAX as much
> as
> possible to make it as simple to use as possible.


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



Re: quick admin view question

2007-01-10 Thread Honza Král
have a look at verbose_name:

http://www.djangoproject.com/documentation/model_api/#verbose-name

  class Meta:
verbose_name = 'Some Fancy Title'

On 1/10/07, Mae <[EMAIL PROTECTED]> wrote:
>
> Hi all,
>
> This might have been answered before, but I can't seem to find the
> answer.  If I'm repeating another topic, I apologize in advance.
>
> Here's what I'd like to do:
> I have a model that goes:
> 
> # represents a reference document in the library
> class Reference(models.Model):
> name = models.CharField(maxlength=100)
> title = models.CharField(maxlength=100)
> [...]
> 
>
> Now, when I view http://my_project_url/admin/ , I see a list of model
> class names, one of which is "References".  I would like to display
> something more custom in that list (s.a. "Library Documents" without
> changing the name "Reference" in the model.
>
> Can I do this?  How?
>
> Thanks,
> Mae
>
>
> >
>


-- 
Honza Král
E-Mail: [EMAIL PROTECTED]
ICQ#:   107471613
Phone:  +420 606 678585

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



Re: quick admin view question

2007-01-10 Thread Mae

Oh, that's exactly what I was looking for!  W!

Thank you,
Mae


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



Announce: Portable Python v1.0 beta

2007-01-10 Thread Perica Zivkovic

Hi there,

I would like to announce the *first* beta release of the Portable
Python 1.0 beta. From today Portable Python website is also online and
you can find it on the location www.PortablePython.com.

About:
Portable Python is a Python programming language preconfigured to run
directly from a portable device (on windows), enabling you to have, at
any time, portable programming environment. Just download and extract
to your portable device and in 10 minutes you are ready to create your
next Python application.

It comes with the pre-installed Django svn snapshot (from 7 january
2007) so it includes all cool-I-must-have-it-right-now Django
features.

Build your Django apps right from your USB device.

Where to find it:
http://www.portablepython.com

regards,

Perica Zivkovic

P.S. did I mentioned that it is free? :-) Yes ! Totally free!

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



quick admin view question

2007-01-10 Thread Mae

Hi all,

This might have been answered before, but I can't seem to find the
answer.  If I'm repeating another topic, I apologize in advance.

Here's what I'd like to do:
I have a model that goes:

# represents a reference document in the library
class Reference(models.Model):
name = models.CharField(maxlength=100)
title = models.CharField(maxlength=100)
[...]


Now, when I view http://my_project_url/admin/ , I see a list of model
class names, one of which is "References".  I would like to display
something more custom in that list (s.a. "Library Documents" without
changing the name "Reference" in the model.

Can I do this?  How?

Thanks,
Mae


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



Re: Django made a mistake by not serving static file ?

2007-01-10 Thread Waylan Limberg

On 1/10/07, pragmaticObjects <[EMAIL PROTECTED]> wrote:
>
> I think it might be a mistake that Django does not want to serve static
> file. Here's what I mean. When I switch to SSL mode (thanks to the
> SSLMiddleware by Anotnio Cavedoni), since not the entire page is served
> by Django (i.e. some images are from the admin media), so Firefox, for
> example does not show a lock at the bottom of the page and the address
> bar is not painted in light yellow. To the casual users who are trained
> to look for those security indicators on the browsers but do not
> understand better, they get paranoid. Because of that, how would anyone
> expect Django to be used outside of the newspaper/blog/etc
> applications. I hope I'm wrong, meaning I hope there's a solution that
> I don't know about. If you know the solution, please share. Thanks
>
>
There are a few thing that come to mind. They all have to do with how
your server is configured and differ based on how your set up.

Say, your site is served via SSL from https://example.com (note the
*s*). Then your media could be served from https://media.example.com
(again note the *s*) where media.example.com is a different server
(whether on a different machine or the same) that served static
content via SSL. This, would probably require multiple certificates
(one for each subdomain) and could get expensive.

Or, perhaps your serving everything from one server. Say,
Apache/mod_python. Then in your config you `SetHandler` to
Python/Django (https://example.com/), but for the Location
`site_media` (https://example.com/site_media/) you `SetHandler None`
and static media is served directly by Apache so Django never sees the
request. Assuming Apache is configured correctly and as your still
behind https (again, note the *s*) you're good and only need one
certificate as everything is behind one domain.

If your using Fcgi a few extra tricks with mod_rewrite (or your
server's equivalent) should get you the same effect as the mod_python
trick.


-- 

Waylan Limberg
[EMAIL PROTECTED]

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



Re: Design Q: Foreign keys from object.values()

2007-01-10 Thread Ivan Sagalaev

[EMAIL PROTECTED] wrote:
> Thanks; this works for me -- though I have to do
> 
>  Author.objects.filter(story__id__isnull=False).distinct()
> 
> Or it repeats each author for each of his stories.
> 
> This still confuses me, because there is no "story" field in the Author
> model to specify how to do the join (Author:Story is One:Many, so I
> just put a foreign key in the Story model).  I guess it is inferring
> the Join conditions by looking at the Story model.  But what if I had
> two Story-Author relations, say:
> 
> class Story (models.Model) :
>   author = ForeignKey(Author)
>   editing_author = ForeginKey(Author)
> 
> How could it possibly know which one I wanted to join on?

When specifying more than one ForeignKeys to a model Django requires you 
to explicitly specify related names for master-to-child relations:

 class Story(models.Model):
   author = models.ForeignKey(Author, related_name='stories')
   editor = models.ForeignKey(Author, related_name='edited_stories')

Then you do:

 Author.objects.filter(edited_stories__id__isnull=False).distinct()

This related_name is also used for related managers:

 author.edited_stories.all()


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



Re: Django made a mistake by not serving static file ?

2007-01-10 Thread Jeremy Dunck

On 1/10/07, pragmaticObjects <[EMAIL PROTECTED]> wrote:
> To the casual users who are trained
> to look for those security indicators on the browsers but do not
> understand better, they get paranoid.

It's not just casual users.  Serving any part of a page out of SSL is
insecure.
Media not served with SSL could be subject to man-in-the-middle,
meaning arbitrary content ends up on your (intended to be) secure.
Such a page is no longer secure.

> Because of that, how would anyone
> expect Django to be used outside of the newspaper/blog/etc
> applications. I hope I'm wrong, meaning I hope there's a solution that
> I don't know about. If you know the solution, please share. Thanks

When you're under SSL, serve your media with SSL as well.
How are you currently serving media?  /media?  media.foo.com?

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



Django made a mistake by not serving static file ?

2007-01-10 Thread pragmaticObjects

I think it might be a mistake that Django does not want to serve static
file. Here's what I mean. When I switch to SSL mode (thanks to the
SSLMiddleware by Anotnio Cavedoni), since not the entire page is served
by Django (i.e. some images are from the admin media), so Firefox, for
example does not show a lock at the bottom of the page and the address
bar is not painted in light yellow. To the casual users who are trained
to look for those security indicators on the browsers but do not
understand better, they get paranoid. Because of that, how would anyone
expect Django to be used outside of the newspaper/blog/etc
applications. I hope I'm wrong, meaning I hope there's a solution that
I don't know about. If you know the solution, please share. 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-users@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



Re: edit_inline disables slug prepopulation?

2007-01-10 Thread ringemup

Hmmm...  I suppose this could also be done by overriding the save()
method to generate a slug if there isn't one already?


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



Re: In Model or Manager? (Sorting, calculations, and non-savable fields)

2007-01-10 Thread ringemup

Thanks, that helps.  I like that there are multiple ways to do things.
Hopefully with a little more experience I'll have a better idea of
where to put things for best re-usability.


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



Re: dividing up views.py into multiple files

2007-01-10 Thread Stefan Foulis

thanks for the reply... adding the empty __init__.py file worked. I  
like Rubics idea aswell. Importing extra utilities could prove very  
flexible.

thanks again :)
-- stefan

On Jan 10, 2007, at 15:54, Nathan R. Yergler wrote:

>
> Did you add a file named __init__.py to the views directory you  
> created?
>  This file tells Python to treat the directory as a package and allow
> traversal into the view file.
>
> NRY
>
> Stefan Foulis wrote:
>> I searched around the django documentation and didn't find anything
>> about this...
>>
>> what I'm trying to do is divide up the views.py file into multiple
>> files because the single views.py file in some of my apps is getting
>> very cluttered.
>>
>> I tried just making a views subdirectory and then placing multiple
>> files with groups of views inside, referencing to them in urls.py
>> with an extra dot with the name...
>>
>> classic reference:
>> ProjectName.AppName.views.functionName  (using a single views.py)
>>
>> then I tried this:
>> ProjectName.AppName.views.viewGroupFileName.functionName
>> (with a directory called "views" in the Application Directory and a
>> python File "viewGroupFileName.py" in there that has a function
>> called "functionName" inside)
>>
>> With this I get a ViewDoesNotExitst: No module named
>> viewGroupFileName.functionName.
>>
>> Is it possible to divide up the view into multiple files? Is this
>> also possible with models?
>>
>> thanks for any hints
>>
>> - stefan
>>
>>
>
> >


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



Re: Design Q: binding of model attributes to admin application

2007-01-10 Thread [EMAIL PROTECTED]

Beautiful; thanks!  But this tool never asks questions about a field
other than what its type is.  Does anyone have an app that makes use of
additional information in the model, such as additional keyword
arguments to the field class or attributes added after field definition?


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



Re: Convert From Restructured Text to HTML

2007-01-10 Thread Stephen Mizell

So it seems the issue is with the restructured text.  When using the
restructured text filter on a template, it works just fine.  When using
restructured text in a view, it gives me tons of errors.

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-users@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



Re: sql debug

2007-01-10 Thread James Bennett

On 1/9/07, sandro.dentella <[EMAIL PROTECTED]> wrote:
> I'd like to know if it is possible to print the sql statement *before*
> issuing it, just to play with queryset and filtering.

If you don't mind delving a bit into the code, you'll find that the
QuerySet class has a '_get_sql_clause' method which is what Django
itself uses to get the SQL to execute. The return format of that
method is a tuple containing the elements of the query.

-- 
"May the forces of evil become confused on the way to your house."
  -- George Carlin

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



Re: solidDB and Django

2007-01-10 Thread David Cramer

I've actually run out of ways I can optimize the database and I'm
looking in the future. Most pages, after they've been cached, are cut
down to 1-3 queries, the problem is we're a very dynamic content site
so the cache has to be refreshed quite often.

On Jan 10, 4:27 pm, Michael Radziej <[EMAIL PROTECTED]> wrote:
> David Cramer schrieb:
>
> > As we were having issues lately with handling database load, I'm
> > looking at alternatives for MySQL/Innodb in the future. One thing that
> > came up was solidDB. I'm curious as to if this would be possible to use
> > with Django, or if anyone has used this in the past and has experiences
> > they could tell about.
>
> >http://www.solidtech.com/en/products/relationaldatabasemanagementsoft...I 
> >don't know about solidDB, but I doubt that you have a problem
> with the database engine. From what I read in your posts, you had
> a lot (hundreds) of database connections during template
> rendering. Cut this down. Profile your queries, find out what
> takes too long. Create the right indexes. Etc, etc.
>
> Since solidDB seems to be using the mysql drivers, there's a good
> chance it can work out of the box, but why not contact their
> sales people?
>
> Michael
>
> --
> noris network AG - Deutschherrnstraße 15-19 - D-90429 Nürnberg -
> Tel +49-911-9352-0 - Fax +49-911-9352-100
> 
> http://www.noris.de- The IT-Outsourcing Company


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



Re: Removing SQL From Templates

2007-01-10 Thread David Cramer

> Why don't you just generate lists and dictionaries in the view and send
> those to your templates instead of data objects?
I like having access to the models attributes, such as
get_absolute_url, we use things like this quite a bit in our templates

> 1. It'd be pretty easy to write a template tag -- say, {% cache %}{%
endcache %} -- which caches all the nodes within itself; this way you
can isolate parts of the template which hit the DB, and cache those
results without having to cache the entire rendered template.
I may look into this, but I'd still prefer something as to where I
could block it in the template. It'd just be easier to find the loose
queries/etc if I could do that.


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



Re: Removing SQL From Templates

2007-01-10 Thread Gustavo Picon

Why don't you just generate lists and dictionaries in the view and send
those to your templates instead of data objects?

--
Gustavo Picon


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



Re: Design Q: Foreign keys from object.values()

2007-01-10 Thread Kai Kuehne

Hi George,

On 1/10/07, [EMAIL PROTECTED] <[EMAIL PROTECTED]> wrote:
> class Author (models.Model) :
>   name = CharField(maxlength=100)
> class Story (models.Model) :
>   author = ForeignKey(Author)

What about a relation, hm? :)

Kai

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



Re: Django i18n How

2007-01-10 Thread Adrian Holovaty

On 1/10/07, johnny <[EMAIL PROTECTED]> wrote:
> I have read the django book at djangobook.com.  What I wanted to know
> now is, how the database content related to the i18n handled.  Do I
> have to create a separate tables for each language.  I have looked at
> symfony-project.com i18n
> http://www.symfony-project.com/book/trunk/i18n, a php framework, it
> manages that part nicely. "For each table that contains some i18n data,
> it is recommended to split the table in two parts: one table with no
> i18n column, and the other one with only the i18n columns."

I'll be adding a section to that chapter about how strategies for
internationalizing data.

Adrian

-- 
Adrian Holovaty
holovaty.com | djangoproject.com

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



Re: Django Projects and Subversion

2007-01-10 Thread Julio Nobrega

  What if someone commits something that brakes the live website?

  My recommendation is to checkout into the live folders the
version/tag/branch you want. Or checkout somewhere, test the app, and
then copy the files. Just don't run the website from a codebase where
developers are commiting.

On 1/10/07, Aidas Bendoraitis <[EMAIL PROTECTED]> wrote:
>
> I have an SVN-specific question which doesn't really fit into Django
> groups. Anyway, maybe somebody of you will have enough experience and
> competence to answer it.
>
> We are going to set our Django projects under
> version control on a dedicated server. We will also publicly run
> several Django websites on the same server. So what is a better
> practice -- to use the code under source
> control for the public websites directly, or to have copies (tags) of
> the subversioned code for the public websites?
>
> How is this managed with djangoproject.com and djangobook.com?
>
> Regards,
> Aidas Bendoraitis aka Archatas
>
> >
>


-- 
Julio Nobrega - http://www.inerciasensorial.com.br

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



Re: dividing up views.py into multiple files

2007-01-10 Thread Rubic

Stefan Foulis wrote:
> what I'm trying to do is divide up the views.py file into multiple
> files because the single views.py file in some of my apps is getting
> very cluttered.
>
> I tried just making a views subdirectory and then placing multiple
> files with groups of views inside

Ditto to what Nathan suggested about putting an
empty __init__.py into your new views directory,
but even if you want to break up your views file
it's not necessary to create a seperate directory.
You could organize it something along the lines of:

  mysite/
  myapp/
  views_eggs.py
  views_ham.py

An alternative would be to keep everything that's
exposed to your templates in views.py, and the
secondary stuff in other file(s):

  mysite/
  myapp/
  views.py
  utils.py

Then in views.py, import the stuff from utils.py:

  # views.py
  from mysite.myapp.utils import supervalidator, xfabulator

No changes are necessary to urls.py, and you keep all
the 'public' functions in a single file.

P.S.  Cum grano salis: My Django experience is less than
a week old.

--
Jeff Bauer
Rubicon, Inc.


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



Re: Design Q: binding of model attributes to admin application

2007-01-10 Thread Michael Radziej

Hi George,

are you aware about the graphviz thing that does just what you 
are writing?

http://code.djangoproject.com/wiki/DjangoGraphviz


So long,

Michael

-- 
noris network AG - Deutschherrnstraße 15-19 - D-90429 Nürnberg -
Tel +49-911-9352-0 - Fax +49-911-9352-100

http://www.noris.de - The IT-Outsourcing Company

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



Django Projects and Subversion

2007-01-10 Thread Aidas Bendoraitis

I have an SVN-specific question which doesn't really fit into Django
groups. Anyway, maybe somebody of you will have enough experience and
competence to answer it.

We are going to set our Django projects under
version control on a dedicated server. We will also publicly run
several Django websites on the same server. So what is a better
practice -- to use the code under source
control for the public websites directly, or to have copies (tags) of
the subversioned code for the public websites?

How is this managed with djangoproject.com and djangobook.com?

Regards,
Aidas Bendoraitis aka Archatas

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



Re: solidDB and Django

2007-01-10 Thread Michael Radziej

David Cramer schrieb:
> As we were having issues lately with handling database load, I'm
> looking at alternatives for MySQL/Innodb in the future. One thing that
> came up was solidDB. I'm curious as to if this would be possible to use
> with Django, or if anyone has used this in the past and has experiences
> they could tell about.
> 
> http://www.solidtech.com/en/products/relationaldatabasemanagementsoftware/enterprise/overview.asp

I don't know about solidDB, but I doubt that you have a problem 
with the database engine. From what I read in your posts, you had 
a lot (hundreds) of database connections during template 
rendering. Cut this down. Profile your queries, find out what 
takes too long. Create the right indexes. Etc, etc.

Since solidDB seems to be using the mysql drivers, there's a good 
chance it can work out of the box, but why not contact their 
sales people?

Michael


-- 
noris network AG - Deutschherrnstraße 15-19 - D-90429 Nürnberg -
Tel +49-911-9352-0 - Fax +49-911-9352-100

http://www.noris.de - The IT-Outsourcing Company

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



Re: media files during developments

2007-01-10 Thread Jeremy Dunck

On 1/9/07, archie <[EMAIL PROTECTED]> wrote:
> In the settings.py file I set the MEDIA_ROOT to be the one
> where the css is and I added to urls the command
> (r'^site_media/(.*)$', Where django.views.static, {'document_root':
> settings.MEDIA_ROOT, 'show_indexes': True}).
> However no sign of django picking up the css file. Any idea?!

I think you meant django.views.static.serve, not django.views.static.

FYI, static.serve is OK for dev, but you should really run another
media server for production.

A common setup is lighttpd listening on some other port w/ apache's
mod_proxy mapping /media to that other server:
http://httpd.apache.org/docs/2.0/mod/mod_proxy.html#proxypass
Another approach is to make a media subdomain (i.e. media.yoursite.com
) but then you need to make media references in your pages absolute
(e.g. http://media.yoursite.com/img/foo.jpg rather than
/media/img/foo.jpg).

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



Re: Design Q: Foreign keys from object.values()

2007-01-10 Thread Ivan Sagalaev

[EMAIL PROTECTED] wrote:
> Hi guys,
> 
> I'm trying to get a better grip on Django design philosophy, and I'm a
> little confused as to why calls to a manager's " values() " function
> returns foreign keys as the value of their primary key rather than as
> django objects.  For example:
> 
> class Author (models.Model) :
>   name = CharField(maxlength=100)
> class Story (models.Model) :
>   author = ForeignKey(Author)
> 
> "Story.objects.values('author').distinct()" returns a set of
> dictionaries whose values are Author.id 's instead of the actual Author
> objects.  I then have to Author.objects.get(id) for each id, which
> seems like the sort of boilerplate code Django usually avoids.
> 
> Am I missing a better way of doing this, or a reason it *should* work
> this way?

Yes, values() is intended to work this way. But this is not a common 
thing to do. You want to use values() in some special cases where you 
really need a list of dicts. If what you need is set of Author objects 
that have Stories this is it:

 Author.objects.filter(story__id__isnull=False)

What happens here is that 'story__id' joins Authors with Stories 
effectively filtering Authors that have this relation. And isnull=False 
is just a meaningless part that is always true needed to satisfy the 
query syntax.

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



Re: Python 2.5

2007-01-10 Thread Jeremy Dunck

On 1/10/07, Carl Holm <[EMAIL PROTECTED]> wrote:
> After attempting to run  Django with Python 2.5, I get the following
> after trying to connect: to dev server:
>
> 'Error loading MySQLdb module: No module named _mysql'
>
> Any further info would be appreciated.

OS?

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



Re: dividing up views.py into multiple files

2007-01-10 Thread Nathan R. Yergler

Did you add a file named __init__.py to the views directory you created?
 This file tells Python to treat the directory as a package and allow
traversal into the view file.

NRY

Stefan Foulis wrote:
> I searched around the django documentation and didn't find anything  
> about this...
> 
> what I'm trying to do is divide up the views.py file into multiple  
> files because the single views.py file in some of my apps is getting  
> very cluttered.
> 
> I tried just making a views subdirectory and then placing multiple  
> files with groups of views inside, referencing to them in urls.py  
> with an extra dot with the name...
> 
> classic reference:
> ProjectName.AppName.views.functionName  (using a single views.py)
> 
> then I tried this:
> ProjectName.AppName.views.viewGroupFileName.functionName
> (with a directory called "views" in the Application Directory and a  
> python File "viewGroupFileName.py" in there that has a function  
> called "functionName" inside)
> 
> With this I get a ViewDoesNotExitst: No module named  
> viewGroupFileName.functionName.
> 
> Is it possible to divide up the view into multiple files? Is this  
> also possible with models?
> 
> thanks for any hints
> 
> - stefan
> 
> 

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



dividing up views.py into multiple files

2007-01-10 Thread Stefan Foulis

I searched around the django documentation and didn't find anything  
about this...

what I'm trying to do is divide up the views.py file into multiple  
files because the single views.py file in some of my apps is getting  
very cluttered.

I tried just making a views subdirectory and then placing multiple  
files with groups of views inside, referencing to them in urls.py  
with an extra dot with the name...

classic reference:
ProjectName.AppName.views.functionName  (using a single views.py)

then I tried this:
ProjectName.AppName.views.viewGroupFileName.functionName
(with a directory called "views" in the Application Directory and a  
python File "viewGroupFileName.py" in there that has a function  
called "functionName" inside)

With this I get a ViewDoesNotExitst: No module named  
viewGroupFileName.functionName.

Is it possible to divide up the view into multiple files? Is this  
also possible with models?

thanks for any hints

- stefan

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



Design Q: Foreign keys from object.values()

2007-01-10 Thread [EMAIL PROTECTED]

Hi guys,

I'm trying to get a better grip on Django design philosophy, and I'm a
little confused as to why calls to a manager's " values() " function
returns foreign keys as the value of their primary key rather than as
django objects.  For example:

class Author (models.Model) :
  name = CharField(maxlength=100)
class Story (models.Model) :
  author = ForeignKey(Author)

"Story.objects.values('author').distinct()" returns a set of
dictionaries whose values are Author.id 's instead of the actual Author
objects.  I then have to Author.objects.get(id) for each id, which
seems like the sort of boilerplate code Django usually avoids.

Am I missing a better way of doing this, or a reason it *should* work
this way?

Thanks,
G


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



Design Q: binding of model attributes to admin application

2007-01-10 Thread [EMAIL PROTECTED]

Hi guys,

I'm writing a Django application that will introspect the available
model in order to generate a graphical representation.  The admin
application also has to introspect, but it has the advantage that you
can pass it directives for each field via keyword arguments when you
declare them in the model.  I was wondering,

1) Is there a standard way of providing similar functionality to new
apps that introspect without manually extending all the field classes?

2) Is there a good (other than historical) reason for the binding
between model declaration and the admin app?  Or would a generic
keyword argument ("app_parameters = {'admin_choices' : [1,2,3], ...}")
do just as well.

3) I gather that some of the keyword arguments, like 'choices', are
also being used in the new-style forms in the development branch; can
anyone explain to me what the long-term vision for what the "Model"
does is?

Thanks!
G


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



developing a new ajax website: places2go.org. some comments apreciated.

2007-01-10 Thread pedro

Hello guys,

http://www.places2go.org: is a new site i'm developing, already
available in a beta version.

It allows you to store your favorite places in your home town
or anywhere in the world. The initial idea was to do something like
delicious but for physical places.

You add places you like and want to eventually go back some day. Also
as locations, can be defined as private or public (being public the
default), other people can search them and store them in their own
list of favorite places.

To add a new place you start by clicking in a spot in a google map. A
find bar on top of the map allows you to go to a specific city easily.

To each place you can: categorize with tags, add an address, add
photos and add comments.

When searching you can filter by: country, city and tags.

Technically, the site is built on Rails and i try to use AJAX as much
as
possible to make it as simple to use as possible.

I'm not a designer, so that was probably the most difficult part to me
when building this site (i tried to keep it simple) but its still the
part a like less. I'm more happy with the functional part i got done.

As i said at the beginning, the site is still on beta, so please take
a look at it and i would very much appreciate any comments you may
have, including if you find it could be useful or not.

I'm attaching a few screenshots.

http://farm1.static.flickr.com/144/351638046_5e592a87d2_o.jpg
http://farm1.static.flickr.com/163/351638048_501596c416_o.jpg
http://farm1.static.flickr.com/140/351638051_78b319fe10_o.jpg

thank you for listening,

Pedro Costa.


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



watched items and content type

2007-01-10 Thread [EMAIL PROTECTED]

I'm trying to allow users to watch items, and have that working.
Problem is, on the template I want to sort by content type and have a
header for each one, something like:

Foo:
  item 1
  item 2

Bar:
  item 1
  item 2

In the model, I've established a generic relation:

class Watch(models.Model):
subscriber = models.ForeignKey(User, verbose_name="Subscriber")
content_type = models.ForeignKey(ContentType)
content_object = models.GenericForeignKey()
object_id = models.IntegerField(_('object ID'))


Then in the view I'm building a list of the objects the user is
watching (slug is their username):

def watchlist(request, slug):
user = User.objects.get(username=slug)
watch_list = []
watch_items = Watch.objects.filter(subscriber=user)
for i in watch_items:
thismodel = get_model(i.content_type.app_label,
i.content_type.model)
objects = thismodel.objects.filter(id=i.object_id)
watch_list += objects
return render_to_response('watchlist/watch_list_user.html',
{'watch_list': watch_list}, context_instance=RequestContext(request))

The problem is that my watch_list has no idea what content type the
objects are. I've tried a lot of things, and can get the content type,
but then can't seem to get the objects. Any suggestions?


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



Starting with Django

2007-01-10 Thread [EMAIL PROTECTED]

Hi,
I'm a C++, Delphi programmer. I've some quite large applications win32.
I want to move on to web development.
I already have some good experience in Python , and I just love this
language really simple, elegant and powerful.

For example a school management software, that is quite extensive.
It covers the Student, classes, grades,... invoicing system.
Each person has a given role in the system, student, professor,
administrative services, etc...
and has functionality according to  role.

Is that possible to do this kind of project with django, is it
appropriate?

>From the tutorial I read, some questions already arise.

In a one to many relation like an invoice, is possible to chose from
another table in a popup window, regarding this new table can have
1000's of records, so a multipage with filter?

Are there any examples with these kind of development.

Every help would be appreciate.
Some clues and further reading are welcome as well.

Alexandre Rua


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



@login_required problem

2007-01-10 Thread [EMAIL PROTECTED]

HI,

I am getting the old 'current transaction is aborted' when trying to
process @login_required.

basically I have a view method:

@login_required
def index(request):
if request.GET.has_key('screen'):
screen = request.GET['screen'].lower()
else:
screen = 'main'
if screens.has_key( screen ):
( template , fn ) = screens[ screen ]
return fn( request , template )
else:
raise Http404

When I go to this and I am not logged in it gives me a screen full of a
python error messages (NOT I might add django errors) culminating in
the 'transaction aborted' message.

IF I log in via admin it all works perfectly. Basically it is having
problems before it gets to any of my code

any ideas ?

cheers 

mark


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



media files during developments

2007-01-10 Thread archie

Hi guys, I'm new to python & django but fascinated by the framework.
I'm coming from C++ background so I know very little about web
programming and it looks like python and django are quite smart tools
for it. Few days into django and everything looks fine. However I have
a little problem I don't seem to resolve. I'm trying to use css
files for my web application in development version but I'm failing
miserably. In the settings.py file I set the MEDIA_ROOT to be the one
where the css is and I added to urls the command
(r'^site_media/(.*)$', Where django.views.static, {'document_root':
settings.MEDIA_ROOT, 'show_indexes': True}).
However no sign of django picking up the css file. Any idea?!


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



solidDB and Django

2007-01-10 Thread David Cramer

As we were having issues lately with handling database load, I'm
looking at alternatives for MySQL/Innodb in the future. One thing that
came up was solidDB. I'm curious as to if this would be possible to use
with Django, or if anyone has used this in the past and has experiences
they could tell about.

http://www.solidtech.com/en/products/relationaldatabasemanagementsoftware/enterprise/overview.asp


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



sql debug

2007-01-10 Thread sandro.dentella

I'd like to know if it is possible to print the sql statement *before*
issuing it, just to play with queryset and filtering.

By the way I'm sure I read about the possibility to use cursor.queries,
if DEBUG == True but I cant' find where I read it. Anyhow I'd prefer
the first solution.

TIA
sandro
*:-)


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



Query: Follow foreignkeys?

2007-01-10 Thread Adam Seering

Hi,
I have two models, A and B.  A.anchor is a foreignkey to B.  I  
currently have the following code:

B.objects.filter(id__in=[ x.anchor for x in  
A.function_that_applies_filter_to_A(data) ])

function_that_applies_filter_to_A is defined elsewhere, and I'm  
really not eager to change it (it's generated by about a page of  
rather-hairy code; it checks against several other related tables,  
including some minor tree-traversal in one table).  It returns a  
QuerySet.  'data' is some processed form data from a Web POST.

Is there a way to do this entirely in a single query, instead of  
hitting the database once, applying a filter in Python, and then  
hitting it again?

Thanks,
Adam

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



Re: Hi! Here's a new Django beginner with a few questions.

2007-01-10 Thread Sebastien Armand [Pink]
"Did you know about mutation? :-)" I was expecting this one!

Well thanks a lot!!

2007/1/10, Ivan Sagalaev <[EMAIL PROTECTED]>:
>
>
> Sebastien Armand [Pink] wrote:
> > class Person(models.Model):
> > ...
> > mother = models.ForeignKey('Person')
> > ...
> >
> > Will this work?
>
> Use models.ForeignKey('self')
>
> > For example if I've got a Body class and a Legs class, I know that I'll
> > never have a body with more than 2 legs
>
> Did you know about mutation? :-)
>
> > and it would be easier to have a
> > leftLeg = ForeignKey(Leg) field
> > and a
> > rightLeg = ForeignKey(Leg) field
> >
> > but this causes many errors when I try to validate my model.
>
> Upon seeing a ForeignKey Django tries to create backward accessors from
> the parent model to children. In your case it should be "Leg.body_set"
> that will fetch all Legs with a ForeignKey to a particular Body.
>
> However since you have two ForeignKeys to the same model Django needs to
> have two such relations: all bodies for a LeftLeg and all bodies for a
> RightLeg. The only problem that it doesn't know how to _name_ these
> relations. It certainly can't have two different "body_set"s on a Leg.
> So the only thing that it asks you is to choose two names for the
> relations:
>
>  leftLeg = models.ForeignKey(Leg, related_name='bodies_if_left')
>  rightLeg = models.ForeignKey(Leg, related_name='bodies_if_right')
>
> My naming skills are known to be lousy so choose your own according to
> what these things really mean.
>
> >
>


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


Re: Django i18n How

2007-01-10 Thread johnny

I have read the django book at djangobook.com.  What I wanted to know
now is, how the database content related to the i18n handled.  Do I
have to create a separate tables for each language.  I have looked at
symfony-project.com i18n
http://www.symfony-project.com/book/trunk/i18n, a php framework, it
manages that part nicely. "For each table that contains some i18n data,
it is recommended to split the table in two parts: one table with no
i18n column, and the other one with only the i18n columns."


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



Re: Hi! Here's a new Django beginner with a few questions.

2007-01-10 Thread Ivan Sagalaev

Sebastien Armand [Pink] wrote:
> class Person(models.Model):
> ...
> mother = models.ForeignKey('Person')
> ...
> 
> Will this work?

Use models.ForeignKey('self')

> For example if I've got a Body class and a Legs class, I know that I'll 
> never have a body with more than 2 legs

Did you know about mutation? :-)

> and it would be easier to have a
> leftLeg = ForeignKey(Leg) field
> and a
> rightLeg = ForeignKey(Leg) field
> 
> but this causes many errors when I try to validate my model.

Upon seeing a ForeignKey Django tries to create backward accessors from 
the parent model to children. In your case it should be "Leg.body_set" 
that will fetch all Legs with a ForeignKey to a particular Body.

However since you have two ForeignKeys to the same model Django needs to 
have two such relations: all bodies for a LeftLeg and all bodies for a 
RightLeg. The only problem that it doesn't know how to _name_ these 
relations. It certainly can't have two different "body_set"s on a Leg. 
So the only thing that it asks you is to choose two names for the relations:

 leftLeg = models.ForeignKey(Leg, related_name='bodies_if_left')
 rightLeg = models.ForeignKey(Leg, related_name='bodies_if_right')

My naming skills are known to be lousy so choose your own according to 
what these things really mean.

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



Hi! Here's a new Django beginner with a few questions.

2007-01-10 Thread Sebastien Armand [Pink]
Hello everyone,

I'm new to Django and trying to set up a small website with it. I've only
started creating the model and already got a few troubles!

1. I need to relate an object to itself! For example if my object is a
Person, I want to have a field mother which will be the key of an other
Person record. But since the model Person is not defined it doesn't work so
I tried:

class Person(models.Model):
...
mother = models.ForeignKey('Person')
...

Will this work?

2. I need to have many fields that are ForeignKeys of the same kind of
objects but don't want a many to many relation as I know that there will
always be the same small number of references.
For example if I've got a Body class and a Legs class, I know that I'll
never have a body with more than 2 legs and it would be easier to have a
leftLeg = ForeignKey(Leg) field
and a
rightLeg = ForeignKey(Leg) field

but this causes many errors when I try to validate my model.

Error:
Accessor for field leftLeg clashes with related field Leg.__set. Add a related name argument to the definition for leftLeg

which really doesn't mean anything to me.

Is it possible to do those kind of things? How?

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-users@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---


Re: sorting the results of a queryset

2007-01-10 Thread Rob Slotboom

Sorted works great but I have problems using it im my custom manager.
I'm trying and trying but I can't figure out how to handle the
following situation.

class SortedTestcatManager(models.Manager):
   def get_query_set(self):
  QS = super(SortedTestcatManager, self).get_query_set()
  SQS = sorted(QS, key=self.model.get_absolute_url)
  return SQS

>> sorted = Testcat.sorted_objects.all()
>> sorted
[]
>> sorted.filte(title="nope")
AttrbuteError: 'list' object has no attribute 'filter'

Because I cant handle my prefered sorting in a query, I need to sort
the result afterward.
I could define some other functions in the custom manager to handle all
and filter
But this isn't a solution:

allcats = Cat.sorted_objects.all()
allcats.filter(var='val') <<

Isn't there a way to grap the result from the QS, sort it and place it
back?


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



Re: Python 2.5

2007-01-10 Thread Brett Parker

On Wed, Jan 10, 2007 at 02:21:38AM -0800, Carl Holm wrote:
> 
> Hello,
> 
> After attempting to run  Django with Python 2.5, I get the following 
> after trying to connect: to dev server:
> 
> 'Error loading MySQLdb module: No module named _mysql'
> 
> Any further info would be appreciated.

Looks like you're missing the C library behind MySQLdb, check that you
have python2.5-mysqldb installed.

Cheers,
-- 
Brett Parker

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



Re: Django and the magic reappearing debug flag

2007-01-10 Thread [EMAIL PROTECTED]

*bump*

Any ideas? this is driving me nuts..

--Simon


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



Python 2.5

2007-01-10 Thread Carl Holm

Hello,

After attempting to run  Django with Python 2.5, I get the following 
after trying to connect: to dev server:

'Error loading MySQLdb module: No module named _mysql'

Any further info would be appreciated.

- CL









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



Re: Proposed Changes

2007-01-10 Thread David Cramer

select_related() info moved:
http://groups-beta.google.com/group/django-developers/browse_thread/thread/400bcdee7fedbb15?hl=en

On Jan 10, 8:37 am, "David Cramer" <[EMAIL PROTECTED]> wrote:
> http://dpaste.com/hold/4539/
>
> I think I still have an issue with related fields that werent included
> in the query
>
> On Jan 10, 8:15 am, "David Cramer" <[EMAIL PROTECTED]> wrote:
>
> > Use this paste instead, I found an issue :)
>
> >http://dpaste.com/hold/4537/
>
> > On Jan 10, 6:41 am, "David Cramer" <[EMAIL PROTECTED]> wrote:
>
> > > Alright, anyways, if someone wants to test this, it worked 100% for me,
> > > the updated select_related(). I'm not sure if we're updated with the
> > > latest nightly but ill try to get that done today.
>
> > >http://dpaste.com/4536/
>
> > > This replaces django/db/query.py and adds two arguments for
> > > select_related():
>
> > > depth=N, the recursion depth, by default, infinite, follows any key
> > > where blank isn't True
> > > fields=[], a list of fields, right now only supports fields from the
> > > base table. I'd like to extend this to be able to do
> > > relatedfield__fieldname, as well. if fields is not empty it will change
> > > depth to 1
>
> > > On Jan 10, 5:27 am, Cliff Wells <[EMAIL PROTECTED]> wrote:
>
> > > > David Cramer wrote:
> > > > > While working on my select_related changes, I noticed that the db
> > > > > backend was doing COUNT(*) for .count().. why?
>
> > > > > I've changed it on my local copy to count the id column, but unless
> > > > > anyone can give me a specific reason, as far as I recall, it's faster
> > > > > to just count on the id column.I would expect any non-broken database 
> > > > > server to optimize this to count
> > > > using the primary key, so I doubt that change will make any difference.
> 
> > > > Regards,
> > > > Cliff


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



Re: Creating an empty queryset

2007-01-10 Thread Michael Radziej

Adam Seering schrieb:
> I would strongly second that.  This seems to have fallen somewhat  
> dead, though.  Any thoughts?; anyone in favor of it?; anyone know of  
> any reasons not to do it?

+1 from me. I have already missed it several times. The "where 
1=0 solution" looks stupid. And the changed implementation of 
QuerySet.in() also needs this (and uses where 1=0).


Michael

-- 
noris network AG - Deutschherrnstraße 15-19 - D-90429 Nürnberg -
Tel +49-911-9352-0 - Fax +49-911-9352-100

http://www.noris.de - The IT-Outsourcing Company

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



Re: Creating an empty queryset

2007-01-10 Thread Adam Seering

I would strongly second that.  This seems to have fallen somewhat  
dead, though.  Any thoughts?; anyone in favor of it?; anyone know of  
any reasons not to do it?

Adam


On Dec 27, 2006, at 1:42 PM, Adrian Holovaty wrote:

>
> On 12/27/06, medhat <[EMAIL PROTECTED]> wrote:
>> Is there a way to create an empty queryset?! Let's say I have a  
>> manager
>> to return all the items with the given tags, and I want to return "no
>> items" if one of the given tags does not exist. Right now I return an
>> empty list, but this causes an error in generic views. Is there a way
>> to create an empty QuerySet object without hitting the database?
>
> I just had to do this the other day, and I ended up doing a hack  
> like this:
>
>MyModel.objects.extra(where=['1=0'])
>
> That still hits the database, though. I'm not aware of a way to get an
> empty QuerySet without hitting the database. Maybe we should add one?
>
> Adrian
>
> -- 
> Adrian Holovaty
> holovaty.com | djangoproject.com
>
> >


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