Re: Generating Javascript w Django

2007-01-11 Thread John Morton

On Friday 12 January 2007 16:04, cwurld wrote:
>  Hi,
>
>  Does this make sense? I wanted some code to cycle thru some banner ads.
>  I could have done it with dojo doing a callback to my view, have my
>  view send the image path and the corresponding url, but that seemed
>  like a lot of activity for such a simple process.
>
>  Instead, I generated the javascript as a string, including the list of
>  images and urls as variables in the script, then I passed the string
>  containing the javascript code as a variable that got inserted in the
>  template. It works. But it seems like a strange way to solve this
>  problem.

You could use the JSON support in a view which just returns a chuck of JSON, 
which is just a javascript data structure, containing all your images and 
urls, then include that as an external script loaded by the page. 

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: What svn (subversion) client do you use for OS X?

2007-01-11 Thread 张成


在 2007-1-11,下午12:36,Noah 写道:

>
> I'm a switcher... but I'm also an svn user, and I got svn installed ok
> using the darwin ports but I need a decent GUI for svn. I was using
> TortoiseSVN on Windows and it was great.
>
> This is something of an issue for me as I have over 15,000 project
> files under version control and as it stands now they're not much use
> to me on my new Mac... uh oh.
>
> What subversion GUI do you recommend for OS X?

I am using svnX on Mac (primarily) and TortoiseSVN on Windows (from  
time to time).

>
> I've tried svnx and rapidsvn and neither was really very good.

You shouldn't expect svnX to provide you with same UI experience as  
TortoiseSVN. Their work-flows are quite different. TortoiseSVN is  
quite intuitive for Windows UI, but if you take some time to learn  
svnX's way of thinking, you might find it's better to use.


-Cheng Zhang
Gentoo/PostgreSQL/Lighttpd/Python/Django/jQuery Powered
(Web) http://www.aragonconsultinggroup.com
http://www.ifaxian.com
1st Django powered site in Chinese ;-)
http://www.aiyo.cn
Our 2nd Django powered site in Chinese


--~--~-~--~~~---~--~~
 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: What svn (subversion) client do you use for OS X?

2007-01-11 Thread Noah

I could hope there is a rewrite... after all there hasn't been a news
update since 2004...


--~--~-~--~~~---~--~~
 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: What svn (subversion) client do you use for OS X?

2007-01-11 Thread Noah

Sorry, I hit post twice.


--~--~-~--~~~---~--~~
 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: What svn (subversion) client do you use for OS X?

2007-01-11 Thread Noah

Not all of my files are Python, in fact probably only 500 or so of the
15,000 files I'm versioning are actually py files. The rest are
graphics, data and resources of other kinds.


--~--~-~--~~~---~--~~
 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: What svn (subversion) client do you use for OS X?

2007-01-11 Thread Noah

Not all of my files are Python, in fact probably only 500 or so of the
15,000 files I'm versioning are actually py files. The rest are
graphics, data and resources of other kinds.


--~--~-~--~~~---~--~~
 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
-~--~~~~--~~--~--~---



(<= EASY APPLE PIE RECIPES =>)

2007-01-11 Thread Tina Bajaj
 [image: Apple Pie Recipes] 

*Apple Pie Recipes
*http://taniarajpo.mb.com/recipe/apple_pie/
*Best Apple pie
Cooking recipes
easy to make
For best recipes please visit:
http://taniarajpo.mb.com/recipe/apple_pie/

Sonia


*


--~--~-~--~~~---~--~~
 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
-~--~~~~--~~--~--~---


jpgz5zPFCp02k.jpg
Description: JPEG image


<<< NEW 2007 CARS >>>

2007-01-11 Thread Tina Bajaj
 NEW 2007 Cars
All new models
[image: NEW 2007 Cars] 
Please visit: http://allnewcars.mb.com/
Lexus
Mercedes
BMW
Honda
Ford
http://allnewcars.mb.com/

Thanks
Sonia


--~--~-~--~~~---~--~~
 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
-~--~~~~--~~--~--~---


jpghFVw4nmWuT.jpg
Description: JPEG image


Re: dynamically refresh the urlconf?

2007-01-11 Thread James Bennett

On 1/11/07, Justin <[EMAIL PROTECTED]> wrote:
> I'm digging through Django trying to figure out how I can manually tell
> it to run through the settings.ROOT_URLCONF again, or how I can load a
> fresh list into memory for resolving.

Generally when you need to reload a Python module, the standard
'reload' function handles it for you. However, in the case of updating
a web app's code, it's generally better to restart  -- if nothing
else, it guarantees that all your server processes pick up the new
code simultaneously.

-- 
"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: a candidate for a custom decorator?

2007-01-11 Thread Kenneth Gonsalves


On 12-Jan-07, at 8:42 AM, Patrick J. Anderson wrote:

> @redirect_staff
> @redirect_anonymous
> def my_view(request):
>   #view logic and HttpResponse

make only one decorator for both options - i think the problem is in  
chaining the decorators - dont they get nested or something?

-- 

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: a candidate for a custom decorator?

2007-01-11 Thread Patrick J. Anderson

Brian Beck wrote:
> I think your problem is the return values. args is a tuple and request
> should be there instead. In both of your decorators, return fn(request,
> *args, **kwargs) instead of fn(args, kwargs).
> 
> 
> > 
> 

Yes, Brian, that was the problem. Thanks for your help.


--~--~-~--~~~---~--~~
 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: What svn (subversion) client do you use for OS X?

2007-01-11 Thread Rob Hudson

There's also SCPlugin which is going through a re-write at the moment.
You might have some success with their old version, however.

http://scplugin.tigris.org/


--~--~-~--~~~---~--~~
 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: a candidate for a custom decorator?

2007-01-11 Thread limodou

On 1/12/07, Brian Beck <[EMAIL PROTECTED]> wrote:
>
> I think your problem is the return values. args is a tuple and request
> should be there instead. In both of your decorators, return fn(request,
> *args, **kwargs) instead of fn(args, kwargs).
>

I think you are right.

-- 
I like python!
UliPad <>: http://wiki.woodpecker.org.cn/moin/UliPad
My Blog: http://www.donews.net/limodou

--~--~-~--~~~---~--~~
 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: a candidate for a custom decorator?

2007-01-11 Thread Brian Beck

I think your problem is the return values. args is a tuple and request
should be there instead. In both of your decorators, return fn(request,
*args, **kwargs) instead of fn(args, kwargs).


--~--~-~--~~~---~--~~
 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: a candidate for a custom decorator?

2007-01-11 Thread limodou

I suggest that you print the request, args, and kwargs to see the real
arguments.


-- 
I like python!
UliPad <>: http://wiki.woodpecker.org.cn/moin/UliPad
My Blog: http://www.donews.net/limodou

--~--~-~--~~~---~--~~
 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
-~--~~~~--~~--~--~---



ValuesQuerySet table join problem

2007-01-11 Thread [EMAIL PROTECTED]

I have been having trouble extracting data from a related data entry
field when it comes to trying to get the values from related (joined)
field. Perhaps the best way to explain what I need to do can be seen in
the code snippet attached below.


reservations=Reservation.objects.filter(pub_date__gt=some_start_date).filter(pub_date__lt=some_end_date).values('id',
'amount', 'pub_date', 'position')
positions = Position.objects.values('id', 'max_amount', 'name')
for reservation in reservations:
pos_name =  positions.get(id=reservation['position'])['name'] #
<---this is where I have my problem
print pos_name #<- this is printing an empty string

Any help would be greatly appreciated :)


--~--~-~--~~~---~--~~
 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
-~--~~~~--~~--~--~---



dynamically refresh the urlconf?

2007-01-11 Thread Justin

I'm digging through Django trying to figure out how I can manually tell
it to run through the settings.ROOT_URLCONF again, or how I can load a
fresh list into memory for resolving.

I'd like to reload the list w/out having to restart my instance of
Django.

Apologies if this has been asked before, couldn't seem to find a
discussion about it.

thanks,
Justin


--~--~-~--~~~---~--~~
 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
-~--~~~~--~~--~--~---



a candidate for a custom decorator?

2007-01-11 Thread Patrick J. Anderson

Hello,

I wanted to ask for some advice on a little issue I have with 
implementing decorators in my views.

I have this piece of code, which I include in each view, to redirect 
anonymous and staff users to a notice page (I don't want them to access 
site members stuff):


def my_view(request):
if not request.user.is_authenticated():
return HttpResponseRedirect(MYSTUFF_FORBIDDEN_URL)
if request.user.is_staff:
return HttpResponseRedirect(MYSTUFF_STAFF_URL)

# view logic and HttpResponse


I wanted how to implement a custom site decorator, based on this blog post:
http://siddhi.blogspot.com/2006/12/using-python-decorators-to-implement.html


Here's what I wrote:


from django.http import HttpResponseRedirect

def redirect_anonymous(fn):
 def _check(request, *args, **kwargs):
 try:
 user = request.user.is_authenticated()
 except KeyError:
 return HttpResponseRedirect('/my-stuff/forbidden/')
 return fn(args, kwargs)
 return _check


def redirect_staff(fn):
 def _check(request, *args, **kwargs):
 if request.user.is_staff:
 return HttpResponseRedirect('/my-stuff/staff/')
 return fn(args, kwargs) # here's where I receive error
 return _check



However when I modify my view function to add these checks as decorators:

@redirect_staff
@redirect_anonymous
def my_view(request):
#view logic and HttpResponse


and I log in to my site as a normal user, I receive an AttributeError 
stating that:

'tuple' object has no attribute 'user'


How should I go about creating my decorators? Is there something I'm 
doing wrong?

Patrick


--~--~-~--~~~---~--~~
 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: Hello all. Tutorials for PHP refugee moving to Django...?

2007-01-11 Thread Mark Rodriguez
Thanks all. I've just jumped into the Django Book!

On 1/11/07, Joseph Heck <[EMAIL PROTECTED]> wrote:
>
> Head to the tutorials at http://www.djangoproject.com/documentation/ and
> work through them. Once you're done with that, take a look at
> http://www.djangobook.com/
>
> -joe
>
> On 1/11/07, [EMAIL PROTECTED] < [EMAIL PROTECTED]> wrote:
> >
> >
> > I'm relatively new to hardcore web programming etc. Most of the stuff
> > I've done is OGF (one giant function) per Cal Henderson's terminology
> > in PHP. I'm looking to dive into Python, Django etc...and not sure
> > where to begin?
> >
> > Any links would be helpful...no need to search for me...just if you
> > know anything off the top of your head...my search continues...
> >
> > thanks
> >
> > dg
> >
> >
> >
> >
> >
>
> >
>


--~--~-~--~~~---~--~~
 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
-~--~~~~--~~--~--~---


Generating Javascript w Django

2007-01-11 Thread cwurld

Hi,

Does this make sense? I wanted some code to cycle thru some banner ads.
I could have done it with dojo doing a callback to my view, have my
view send the image path and the corresponding url, but that seemed
like a lot of activity for such a simple process.

Instead, I generated the javascript as a string, including the list of
images and urls as variables in the script, then I passed the string
containing the javascript code as a variable that got inserted in the
template. It works. But it seems like a strange way to solve this
problem.

Any comments or suggestions?

Thanks,
Chuck


--~--~-~--~~~---~--~~
 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: What svn (subversion) client do you use for OS X?

2007-01-11 Thread James Bennett

On 1/11/07, Noah <[EMAIL PROTECTED]> wrote:
> Anyone? Maybe we could make a list and I'll try them all out...

I use a combination of the command-line client and Emacs' built-in
version-control support (which lets me check in directly from Emacs
once I'm done with a file).

-- 
"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: Can a view open a page in a new browser window?

2007-01-11 Thread Jeremy Dunck

On 1/11/07, Julio Nobrega <[EMAIL PROTECTED]> wrote:
>
>   No. What you can do is open a "normal" webpage and use window.open()
> at body tag onLoad().

...which will almost certainly be blocked by any popup blocker.

In any case, you'll want to make the finished report accessible by URL
and then you can just let people do what they want with the URL to the
finished report.   No?

--~--~-~--~~~---~--~~
 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: Can a view open a page in a new browser window?

2007-01-11 Thread Julio Nobrega

  No. What you can do is open a "normal" webpage and use window.open()
at body tag onLoad().

On 1/11/07, Bob T. <[EMAIL PROTECTED]> wrote:
>
> Hi All,
>
> I have a situation on the Django site where a view needs to either
> return a normal page, or it might need to open a new browser window to
> display the response (a report). I know for the normal case I can just
> return an HttpResponse, but is there anything that can cause the
> response to be displayed in a new browser window? I'd like to get the
> same affect that using "target=" would have with a link.
>
> Thanks much,
> Bob
>
>
> >
>


-- 
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: Internationalization problem in template system

2007-01-11 Thread Nuno Mariz

Jacob Kaplan-Moss wrote:
> On 1/11/07 2:35 PM, Nuno Mariz wrote:
>> Any idea to resolve this , this don't scale. If I what to add another 
>> language, I have to patch all of my templates.
> 
> If I were you, I'd write a simple accessor on your model to get the current 
> translation.  Off the top of my head, you could do something like::
> 
>   from django.utils import translation
> 
>   class MyModel(Model):
>   text_pt = TextField()
>   text_en = TextField()
> 
>   def get_text(self):
>   text_field = "text_%s" % translation.get_language()
>   return getattr(self, text_field)
> 
> Then in a template you can just do::
> 
>   {{ myobject.get_text }}
> 
> Jacob

Nice and simple, thanks Jacob

Nuno

--~--~-~--~~~---~--~~
 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: What svn (subversion) client do you use for OS X?

2007-01-11 Thread Stefan Foulis

I use eclipse with subclipse for svn and pydev for python support...  
everything nicely integrated and in one place.

On Jan 11, 2007, at 06:57, Noah wrote:

>
> I recently switched to a mac and I've been keeping all of my projects
> in subversion and I don't have a good GUI client. What do you
> recommend? I tried svnX but it did not work properly and RapidSVN
> wasn't very usable and ZigVersion didn't like how large my repository
> was (15,000+ files)
>
>
> >


--~--~-~--~~~---~--~~
 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: What svn (subversion) client do you use for OS X?

2007-01-11 Thread Joseph Heck
the command line one?
(svn)

On 1/11/07, Noah <[EMAIL PROTECTED]> wrote:
>
>
> Anyone? Maybe we could make a list and I'll try them all out...
>
> RapidSVN
> SvnX
> ZigVersion
>
> what else?
>
>
> >
>


--~--~-~--~~~---~--~~
 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: What svn (subversion) client do you use for OS X?

2007-01-11 Thread bedros

try esvn; they claim Mac OSX compatibility (as well as Linux and
windows) using QT lib.

http://esvn.umputun.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: Hello all. Tutorials for PHP refugee moving to Django...?

2007-01-11 Thread Joseph Heck
Head to the tutorials at http://www.djangoproject.com/documentation/ and
work through them. Once you're done with that, take a look at
http://www.djangobook.com/

-joe

On 1/11/07, [EMAIL PROTECTED] <[EMAIL PROTECTED]> wrote:
>
>
> I'm relatively new to hardcore web programming etc. Most of the stuff
> I've done is OGF (one giant function) per Cal Henderson's terminology
> in PHP. I'm looking to dive into Python, Django etc...and not sure
> where to begin?
>
> Any links would be helpful...no need to search for me...just if you
> know anything off the top of your head...my search continues...
>
> thanks
>
> dg
>
>
> >
>


--~--~-~--~~~---~--~~
 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: Hello all. Tutorials for PHP refugee moving to Django...?

2007-01-11 Thread Jeremy Dunck

On 1/11/07, [EMAIL PROTECTED] <[EMAIL PROTECTED]> wrote:
>
> Any links would be helpful...no need to search for me...just if you
> know anything off the top of your head...my search continues...
>

You're (part of) the intended audience for the Django book.
http://www.djangobook.com/en/beta/

It's a work in progress, but it's already pretty good.

The MTV overview might be good, in particular.
http://www.djangobook.com/en/beta/chapter05/#cn16

Since you're just learning Python, you'll want to read the Python Tutorial:
http://docs.python.org/tut/

Then you might want to move on to Dive into Python:
http://diveintopython.org/toc/index.html

And you'll want to keep the standard lib docs as well as the book handy:
http://docs.python.org/lib/
http://www.effbot.org/zone/librarybook-index.htm

On the right side of this page, you see more ways to get help:
http://www.djangoproject.com/documentation/

IRC is recommended; there are generally newbie-friendly people on
there to give prompt advice.

Welcome.  :)

--~--~-~--~~~---~--~~
 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: What svn (subversion) client do you use for OS X?

2007-01-11 Thread Noah

Anyone? Maybe we could make a list and I'll try them all out...

RapidSVN
SvnX
ZigVersion

what else?


--~--~-~--~~~---~--~~
 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
-~--~~~~--~~--~--~---



Can a view open a page in a new browser window?

2007-01-11 Thread Bob T.

Hi All,

I have a situation on the Django site where a view needs to either
return a normal page, or it might need to open a new browser window to
display the response (a report). I know for the normal case I can just
return an HttpResponse, but is there anything that can cause the
response to be displayed in a new browser window? I'd like to get the
same affect that using "target=" would have with a link.

Thanks much,
Bob


--~--~-~--~~~---~--~~
 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
-~--~~~~--~~--~--~---



Hello all. Tutorials for PHP refugee moving to Django...?

2007-01-11 Thread [EMAIL PROTECTED]

I'm relatively new to hardcore web programming etc. Most of the stuff
I've done is OGF (one giant function) per Cal Henderson's terminology
in PHP. I'm looking to dive into Python, Django etc...and not sure
where to begin?

Any links would be helpful...no need to search for me...just if you
know anything off the top of your head...my search continues...

thanks

dg


--~--~-~--~~~---~--~~
 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: Internationalization problem in template system

2007-01-11 Thread Jacob Kaplan-Moss

On 1/11/07 2:35 PM, Nuno Mariz wrote:
> Any idea to resolve this , this don't scale. If I what to add another 
> language, I have to patch all of my templates.

If I were you, I'd write a simple accessor on your model to get the current 
translation.  Off the top of my head, you could do something like::

from django.utils import translation

class MyModel(Model):
text_pt = TextField()
text_en = TextField()

def get_text(self):
text_field = "text_%s" % translation.get_language()
return getattr(self, text_field)

Then in a template you can just do::

{{ myobject.get_text }}

Jacob

--~--~-~--~~~---~--~~
 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: Running Django on OpenBSD...best practices?

2007-01-11 Thread Tim Chase

>> Any suggestions for which direction I should pursue?  (Building
>> Apache2 + building mod_python)  Options I haven't uncovered?
> 
> 
> I went this route under OpenBSD 3.9 and have had very few issues.  The most
> trouble I had was with getting mod_python to compile correctly, mostly
> related to path issues of where I had installed python.
> 
> If you need any help, go ahead and email me directly.

Thanks for the suggestions.  I finally managed to get:

- Apache upgraded to 2.0 (as 2.2 barfed on compile) moved to /var 
rather than the default deployment directory in /usr (which will 
be locked down, mounted readonly)
- mod_python installed
- freetds (for talking to SQLServer)
- pymssql (for interfacing python and freetds)
- postgresql (the eventually planned target for deployment)
- django (both the trunk and row-level-permissions branch, with 
soft-links to make it easy to switch between them)

all on the system.  It wasn't a facile process, especially after 
chasing down a dark path of trying to get iODBC+freetds+mxODBC 
working to talk to SQLServer.  A nightmare, that. 
FreeTDS+pymssql is much kinder for such purposes.

Apache is now configured to serve two django folders via 
django+mod_python, and serve general media (and the admin media) 
from a non-django'd directory.  I should image the bloody drive 
now before I break it again :)

It also took a few tries to get the syntax of the section in 
httpd.conf file right, so that files were in the right place, 
with and without various levels of path/ext (and using dots vs. 
slashes in various places).  Perhaps a little expansion in the 
online-help could help slower folks like myself. :)

All the config files have been snapshotted at least, using the 
venerable RCS.

I'd still be interested in getting lighttpd+fastcgi/WSGI working 
just to prove it's possible (and perhaps to compare speed).

Thanks for your various suggestions.

-tkc






--~--~-~--~~~---~--~~
 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
-~--~~~~--~~--~--~---



Internationalization problem in template system

2007-01-11 Thread Nuno Mariz

I have a internationalization problem to solve in the template system.
In my model:
[...]
text_pt = TextField()
text_en = TextField()
[...]

In my template:
{% load i18n %}
{% get_current_language as LANGUAGE_CODE %}

{% ifequal LANGUAGE_CODE 'en' %}
{{ object.text_en }}
{% else %}
{{ object.text_pt }}
{% endifequal %}

Any idea to resolve this , this don't scale. If I what to add another 
language, I have to patch all of my templates.

Thanks in advance,
Nuno

--~--~-~--~~~---~--~~
 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-11 Thread Brian Beck

John Matthew wrote:
> Thank you for the reply.

No problem. :)


--~--~-~--~~~---~--~~
 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: Signed Cookies

2007-01-11 Thread Gulopine

> Better would be to open a ticket at code.djangoproject.com and then take this
> up on django-developers.

Done (ticket #3285), and done. Is that the normal procedure, then, for
contrib apps? The note on the bottom of the contrib add-on page says to
take it up here, which is what I did. However, the "Contributing to
Django" page seems to recommend the same course you did. A little more
consistency there might help people contribute.

Mainly though, I just want to make sure I have the procedure right,
because I have a few other things going for a site I'm working on that
will probably end up as contrib proposals. Considerably larger than a
basic middleware like this. I just want to get it right.

>
> [But this looks pretty damn good, I've got to say...]
>
> Jacob

Hey, thanks! I have to say, I've taken to Python/Django extremely well
for somebody who worked solely in PHP (and had never seen a line of
Python code!) less than a year ago. :)

-Gulopine


--~--~-~--~~~---~--~~
 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-11 Thread Joseph Heck
That's exactly what we're doing. Our "update production" script reads:

svn update /u/django/project
sudo /etc/init.d/apache2 restart

The only time this doesn't work is if someone has tweaked a model and
there's schema changes to be made in conjunction.

-joe

On 1/10/07, Cam <[EMAIL PROTECTED]> wrote:
>
>
> 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
-~--~~~~--~~--~--~---


Re: Empty related sets = Page not found?

2007-01-11 Thread John Matthew
Thank you for the reply.

On 1/10/07, Brian Beck <[EMAIL PROTECTED]> 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.
>
>
> >
>


--~--~-~--~~~---~--~~
 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
-~--~~~~--~~--~--~---


fw chapter 18 - custom view in admin

2007-01-11 Thread Picio

Hello,
I need to filter the results of my admin change_list page.
Following the djangobook chap. 18 , I managed to build
my Custom View for a change_list page. Unfortunately I lost all the
pretty things like, the search field, date hierarchy, filter per day
month, etc. These are my steps:

1) added a "shadow" url for the object I want the change_list results
filtered
2) built a Custom View with the right query (filtered)
3) built a template in /myapp/templates/admin that extend the
change_list.html from contrib.admin

I got the results but without all the cool stuff.
Can someone help to find where I'm wrong? (If needed I can put my code
on pastebin)
Thanks in advance.
Picio


--~--~-~--~~~---~--~~
 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-11 Thread medhat

Well, the patch now has documentation and tests.

-- 
Thanks,
Medhat


--~--~-~--~~~---~--~~
 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 joining multiple tables together

2007-01-11 Thread Michael Radziej

David Cramer schrieb:

> Why does Django join "files_file" twice? I do a
> .filter(file__game=blah).select_related(fields=['file', 'type']) so it
> joins the files table twice? This would happen the same with a normal
> .select_related() as well. Maybe the SQL engine optimizes this but I'm
> not sure.

Can you please post your model, too?

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: The order of ""Add-on applications (contrib)" section

2007-01-11 Thread Adrian Holovaty

On 1/11/07, dutche <[EMAIL PROTECTED]> wrote:
> I was reading the Django doc and I started to read the Flatpage doc,
> but while I was reading it I realize that I must understand at least a
> bit about Sites framework, just to know that my site has an ID and how
> to use it even if I have one site.
>
> So I thought that should be better if "Sites" comes first than
> "Flatpages" in the docs.
>
> What do you think?

Hey there,

The "contrib" documentation is intended to be a reference, so things
are in alphabetical order for easy navigation. The Django Book, on the
other hand, is meant to be a more linear way of learning the whole
framework, so its "contrib" chapter
(http://www.djangobook.com/en/beta/chapter15/) does indeed mention
Sites before Flatpages.

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: Signed Cookies

2007-01-11 Thread Jacob Kaplan-Moss

On 1/11/07 8:58 AM, Jeremy Dunck wrote:
> On 1/10/07, Gulopine <[EMAIL PROTECTED]> wrote:
> ...
>> The code for middleware.py follows (I've placed it in
>> django.contrib.signed_cookies, but any other name would suffice):
>>
> 
> This looks useful, but please re-send the code as an attachment to
> avoid email line wrap munging.  :)

Better would be to open a ticket at code.djangoproject.com and then take this 
up on django-developers.

[But this looks pretty damn good, I've got to say...]

Jacob

--~--~-~--~~~---~--~~
 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: Evaluation of urls.py in mod_python

2007-01-11 Thread Waylan Limberg

If my understanding is correct, when you use this method:

> choices = {
> 'queryset': Poll.objects.filter(opening_date__lte=datetime.now(),
> closing_date__gte=datetime.now())
> }

The value of datetime.now() is evaluated at compilation time when
apache/mod_python is started (or at least when the .pyc file is
created) and the date and time of compilation will be used as long as
apache keeps running. However, by doing:

> now = datetime.now()
>
> choices = {
> 'queryset': Poll.objects.filter(opening_date__lte=now,
> closing_date__gte=now)
> }
>

This will force the value of datetime.now to be evaluated only at run
time. In other words, the value will actually represent the current
time when the request is made.


-- 

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: Signed Cookies

2007-01-11 Thread Jeremy Dunck

On 1/10/07, Gulopine <[EMAIL PROTECTED]> wrote:
...
> The code for middleware.py follows (I've placed it in
> django.contrib.signed_cookies, but any other name would suffice):
>

This looks useful, but please re-send the code as an attachment to
avoid email line wrap munging.  :)

--~--~-~--~~~---~--~~
 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
-~--~~~~--~~--~--~---



Signed Cookies

2007-01-11 Thread Gulopine

In response to some discussion on Chapter 20 of the Django book, I'd
like to submit my first contrib package for consideration, a middleware
package that transparently implements signed cookies. It uses the
SECRET_KEY setting already included in Django, and could easily be
modified to allow different encryption algorithms (currently it simply
uses md5). The only configuration is the addition of the package to
MIDDLEWARE_CLASSES, everything else is handled automatically.

A note on using this with other middlewares. Its position in the
middleware class list defines which other middlewares receive the
security of signed cookies, but there's slightly more to it than that.
In order to ensure that the values passed for further processing are in
fact valid, any cookies not containing a valid signature will be
removed from the HttpRequest instance. For the most part, this is fine,
as long as this middleware is placed before any other middlewares that
use cookies. The only potential advantage to placing a cookie-using
middleware after this one is a savings of 33 characters per cookie,
which can sometimes help, given the length restriction on cookie
values.

However, in the case of SessionMiddleware (and perhaps others), the
value stored is known to just be an ID, and not any actual usable
values. For this case, it's safe to place SessionMiddleware before this
one, and it will work as usual, with the advantage that the 'sessionid'
cookie will not incur the additional 33 characters taken up by the
signing process. However, this also also means that the 'sessionid'
cookie will not be available to any middlewares listed after this one,
nor will it be available in the view. SessionMiddleware stores the
session_key it its own internal structure, so this shouldn't actually
pose any real-world problems. It's just a caveat that should be known
in case it's used with other middlewares where it might cause problems.

The code for middleware.py follows (I've placed it in
django.contrib.signed_cookies, but any other name would suffice):

import re
try:
from hashlib import md5 as hash
except ImportError:
from md5 import new as hash

from django.conf import settings

regex = re.compile(r'([0-9a-f]+):(.*)$')

class SignedCookiesMiddleware(object):

def process_request(self, request):
for (key, signed_value) in request.COOKIES.items():
try:
(signature, value) = regex.match(signed_value).groups()
assert signature == self.get_digest(key, value)
request.COOKIES[key] = value
except:
del request.COOKIES[key]

def process_response(self, request, response):
for (key, morsel) in response.cookies.items():
if morsel['expires'] == 0 and morsel['max-age'] == 0:
continue
digest = self.get_digest(key, morsel.value)
response.set_cookie(key, '%s:%s' % (digest, morsel.value),
max_age=morsel['max-age'],
expires=morsel['expires'],
path=morsel['path'],
domain=morsel['domain'],
secure=morsel['secure']
)
return response

def get_digest(self, key, value):
string = ':'.join([settings.SECRET_KEY, key, value])
return hash(string).hexdigest()


--~--~-~--~~~---~--~~
 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
-~--~~~~--~~--~--~---



Model with 4 ForeignKeys, display 50 recoreds (MySQL vs. PostgreSQL)

2007-01-11 Thread Robert

Hello,

I have a model containing 7 fields, wich of 4 are ForeignKeys to some
other models.

When displaying a table with 50 records from this model (which means it
makes  > 200 db queries) it takes ~10s to load. My hardware is not that
bad, but it's not the point.

I've tried with cache_page() on memcached decorator, which worked fine.
The problem is that when someone
adds a new records he needs to see it asap, not after cache expires.
I'm not as good to play with low-level cache.

I'm getting similar results on both PostgreSQL 8.1.4 and MySQL 4.1.22
(on FreeBSD box).

The great thing here is a 'query cache' in MySQL which saves the
queries for all my ForeignKeys
(as they do not change often..). My boss would rather have PostgreSQL
installed than MySQL.

I know some of you are using PostgreSQL. Is there any way to speed up
these things?
Maybe in Django itself ?
Any example of low-level api cache usage ?

I've searched google for 'query cache' PostgreSQL and it seems there is
no such thing.

I don't want to start a war - both DBs are great IMHO.

Thanks,
Robert


--~--~-~--~~~---~--~~
 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 joining multiple tables together

2007-01-11 Thread David Cramer

What it should be (I believe):

SELECT `files_version`.`id` , `files_version`.`file_id` ,
`files_version`.`md5` , `files_version`.`name` ,
`files_version`.`post_date` , `files_version`.`archive` ,
`files_version`.`change_log` , `files_version`.`author_id` ,
`files_version`.`downloads` , `files_version`.`type_id` ,
`files_file`.`id` , `files_file`.`category_id` , `files_file`.`name` ,
`files_file`.`author_id` , `files_file`.`website` ,
`files_file`.`visible` , `files_file`.`post_date` ,
`files_file`.`last_post_date` , `files_file`.`parent_id` ,
`files_file`.`parent_type_id` , `files_file`.`parent_visible` ,
`files_file`.`downloads_total` , `files_file`.`downloads_today` ,
`files_file`.`downloads_month` , `files_file`.`default_image` ,
`files_file`.`default_file` , `files_file`.`game_id` ,
`files_file`.`images` , `files_file`.`ratings_score` ,
`files_file`.`ratings_votes` , `files_file`.`labels` ,
`files_file`.`comments_total` , `files_file`.`allow_patches` ,
`files_file`.`allow_plugins` , `files_file`.`favorites` ,
`files_file`.`last_update` , `files_type`.`id` , `files_type`.`name` ,
`files_type`.`description` , `files_type`.`order`
FROM `files_version`
INNER JOIN `files_file` ON `files_version`.`file_id` =
`files_file`.`id` , `files_type`
WHERE (
(
`files_file`.`game_id` =1
OR `files_file`.`game_id` =40
)
)
AND `files_version`.`file_id` = `files_file`.`id`
AND `files_version`.`type_id` = `files_type`.`id`
ORDER BY `files_version`.`post_date` DESC
LIMIT 100

What Django did:

SELECT `files_version`.`id` , `files_version`.`file_id` ,
`files_version`.`md5` , `files_version`.`name` ,
`files_version`.`post_date` , `files_version`.`archive` ,
`files_version`.`change_log` , `files_version`.`author_id` ,
`files_version`.`downloads` , `files_version`.`type_id` ,
`files_file`.`id` , `files_file`.`category_id` , `files_file`.`name` ,
`files_file`.`author_id` , `files_file`.`website` ,
`files_file`.`visible` , `files_file`.`post_date` ,
`files_file`.`last_post_date` , `files_file`.`parent_id` ,
`files_file`.`parent_type_id` , `files_file`.`parent_visible` ,
`files_file`.`downloads_total` , `files_file`.`downloads_today` ,
`files_file`.`downloads_month` , `files_file`.`default_image` ,
`files_file`.`default_file` , `files_file`.`game_id` ,
`files_file`.`images` , `files_file`.`ratings_score` ,
`files_file`.`ratings_votes` , `files_file`.`labels` ,
`files_file`.`comments_total` , `files_file`.`allow_patches` ,
`files_file`.`allow_plugins` , `files_file`.`favorites` ,
`files_file`.`last_update` , `files_type`.`id` , `files_type`.`name` ,
`files_type`.`description` , `files_type`.`order`
FROM `files_version`
INNER JOIN `files_file` AS `files_version__file` ON
`files_version`.`file_id` = `files_version__file`.`id` , `files_file` ,
`files_type`
WHERE (
(
`files_version__file`.`game_id` =1
OR `files_version__file`.`game_id` =40
)
)
AND `files_version`.`file_id` = `files_file`.`id`
AND `files_version`.`type_id` = `files_type`.`id`
ORDER BY `files_version`.`post_date` DESC
LIMIT 100

Why does Django join "files_file" twice? I do a
.filter(file__game=blah).select_related(fields=['file', 'type']) so it
joins the files table twice? This would happen the same with a normal
.select_related() as well. Maybe the SQL engine optimizes this but I'm
not sure.


--~--~-~--~~~---~--~~
 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
-~--~~~~--~~--~--~---



order_by with Foreign Keys

2007-01-11 Thread [EMAIL PROTECTED]

I've seen a few posts that this was a bug where you cannot specify
order_by with a column from a foreign key ...
order_by(foreignkeytable__foreignkeycolumn) because it says table not
found.

Does anyone know if there are plans to fix this...or if there is a work
around?  I have several resultsets where I have columns from several
different tables (related by foreignkeys) and I would like to be able
sort on those columns.  I had originally just had a javascript function
to do it on my table...but now I've added a paginator into the
mix...and need to actual order the result set.


--~--~-~--~~~---~--~~
 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
-~--~~~~--~~--~--~---



What svn (subversion) client do you use for OS X?

2007-01-11 Thread Noah

I recently switched to a mac and I've been keeping all of my projects
in subversion and I don't have a good GUI client. What do you
recommend? I tried svnX but it did not work properly and RapidSVN
wasn't very usable and ZigVersion didn't like how large my repository
was (15,000+ files)


--~--~-~--~~~---~--~~
 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
-~--~~~~--~~--~--~---



What svn (subversion) client do you use for OS X?

2007-01-11 Thread Noah

I'm a switcher... but I'm also an svn user, and I got svn installed ok
using the darwin ports but I need a decent GUI for svn. I was using
TortoiseSVN on Windows and it was great.

This is something of an issue for me as I have over 15,000 project
files under version control and as it stands now they're not much use
to me on my new Mac... uh oh.

What subversion GUI do you recommend for OS X?

I've tried svnx and rapidsvn and neither was really very good.


--~--~-~--~~~---~--~~
 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
-~--~~~~--~~--~--~---



The order of ""Add-on applications (contrib)" section

2007-01-11 Thread dutche

Sup folks!!

I was reading the Django doc and I started to read the Flatpage doc,
but while I was reading it I realize that I must understand at least a
bit about Sites framework, just to know that my site has an ID and how
to use it even if I have one site.

So I thought that should be better if "Sites" comes first than
"Flatpages" in the docs.

What do you think?


--~--~-~--~~~---~--~~
 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: watched items and content type

2007-01-11 Thread [EMAIL PROTECTED]

anyone?


--~--~-~--~~~---~--~~
 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
-~--~~~~--~~--~--~---



Evaluation of urls.py in mod_python

2007-01-11 Thread Jyrki Pulliainen

Hi,

after running in some rather strange problems I got curious about the
way Django and/or mod_python evaluates urls.py.

Is there a difference if I use following code:

now = datetime.now()

choices = {
'queryset': Poll.objects.filter(opening_date__lte=now,
closing_date__gte=now)
}

Or if I use:

choices = {
'queryset': Poll.objects.filter(opening_date__lte=datetime.now(),
closing_date__gte=datetime.now())
}

And then, can I somehow use date based generic view in this (selecting
polls that have starting and ending dates way presented)? In my
opinion, the date based generic view doesn't work here.

-- 
Jyrki // [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: Segmentation fault with mod_python (Ubuntu Edgy Eft)

2007-01-11 Thread James Turnbull


Hi Nikl,

> - have you tried to increase apache's loglevel?

Yes, but the errors were no more verbose.

> - do you have any php-extensions installed? if so, you might want  
> to check out
> if php is really the factor by loading it without any extensions.  
> if that
> works, try adding them back one by one.

Aha! Not sure why I didn't think of that, but a back and forth  
switching php modules on and off eventually led me to mhash.so -  
switching off that module solved all my woes.

Many thanks,

James


--~--~-~--~~~---~--~~
 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-11 Thread Russell Keith-Magee

On 1/11/07, medhat <[EMAIL PROTECTED]> wrote:
>
> The patch is in http://code.djangoproject.com/ticket/3283

Remember - no patch is complete without unit tests and documentation...

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: Creating an empty queryset

2007-01-11 Thread medhat

The patch is in http://code.djangoproject.com/ticket/3283

-- 
Thanks,
Medhat


--~--~-~--~~~---~--~~
 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: Segmentation fault with mod_python (Ubuntu Edgy Eft)

2007-01-11 Thread Nikolaus Schlemm

hi James,

> I'm running Ubuntu Edgy Eft, with the following versions (updated to
> the most recent available from  apt-get)
>   Apache/2.0.55 (Ubuntu) mod_python/3.2.8 Python/2.4.4c1 PHP/5.1.6
> mod_ssl/2.0.55 OpenSSL/0.9.8b
> and Django 0.95.
I'm running pretty much the same combo, but with django trunk (and apache also 
serves my svn repositories) - works like a charm!

> If I disable mod_php then the site does work, so there is some sort
> of conflict but I am unsure how to resolve what that conflict may be.
> Django is partly working as it gives me the Page not found debug page
> for 404s.
can you get it to work completely?

> Is anyone running successfully on Edgy Eft while still using PHP? Is
jepp

> there anything anyone can suggest to diagnose further?
- have you tried to increase apache's loglevel?
- do you have any php-extensions installed? if so, you might want to check out 
if php is really the factor by loading it without any extensions. if that 
works, try adding them back one by one.
- can you also rule out other possibilities? (corrupt memory and stuff like 
that)
-- 
cheers,

Nikl

--~--~-~--~~~---~--~~
 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
-~--~~~~--~~--~--~---



Segmentation fault with mod_python (Ubuntu Edgy Eft)

2007-01-11 Thread James Turnbull

Hi all,

I'm running Ubuntu Edgy Eft, with the following versions (updated to  
the most recent available from  apt-get)
Apache/2.0.55 (Ubuntu) mod_python/3.2.8 Python/2.4.4c1 PHP/5.1.6  
mod_ssl/2.0.55 OpenSSL/0.9.8b
and Django 0.95.

Following the documentation here (http://www.djangoproject.com/ 
documentation/modpython/) I have installed mod_python but when  
attempting to view a project I am getting Segmentation faults.
[Thu Jan 11 10:44:37 2007] [notice] child pid 10819 exit signal  
Segmentation fault (11)

I followed the tests here (http://www.dscpl.com.au/wiki/ModPython/ 
Articles/ExpatCausingApacheCrash) and verified that Expat is NOT the  
problem.

 From reading this page (http://modpython.org/FAQ/faqw.py? 
req=show=faq02.013.htp) I tried moving the app to SQLite from  
MySQL and removing the MySQLdb module, but that didn't make a  
difference.

If I disable mod_php then the site does work, so there is some sort  
of conflict but I am unsure how to resolve what that conflict may be.  
Django is partly working as it gives me the Page not found debug page  
for 404s.

Is anyone running successfully on Edgy Eft while still using PHP? Is  
there anything anyone can suggest to diagnose further?

Thanks,

James

--~--~-~--~~~---~--~~
 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
-~--~~~~--~~--~--~---



How to ensure model instance has at least one relater

2007-01-11 Thread Crispin Bennett

Hi,

I have a pair of models A and B, where B has a foreign key pointing to
A. I want to ensure that instances of A have at least one (B)
referrer. The obvious way (to me, still learning python and Django)
was to override A's 'save' method, checking for the existence of  at
least one referring B (using B's related_name on the FK field).

However this causes a problem with the Admin app. I'm editing B inline
on the A edit page, and it appears to me that Admin saves the related
object (here, A) before the relating object. So checking for the
existence of B  in A's 'save' doesn't work.

I could just remove B's 'edit_inline' on its FK field, and ensure
manually that at least one B is created for every A. But there must be
a smarter way, Any thoughts?

Cheers,

CB.

--~--~-~--~~~---~--~~
 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: admin > custom error message

2007-01-11 Thread Rob Slotboom

Hi James et all,

Because of what I want it isn't possible to just rely on a validator, I
need a manipulator to get a request object.

The manipulator only has to add an extra validator to one field. This
validator validates using the database. No custom form is needed. The
manipulator will be used within Django's admin.

I searched and red and searched and red again but I couldn't find an
answer on this one:
How to add a custom manipulator, extending the default one, to a model
using the default form?

--
Robert Slotboom


--~--~-~--~~~---~--~~
 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-11 Thread Perica Zivkovic

Thanks,

please send all your comments, ideas to me so I can add them in future
release(s)

grtz

Perica

On 1/10/07, Jeremy Dunck <[EMAIL PROTECTED]> wrote:
>
> 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: Python 2.5 + MySQLdb

2007-01-11 Thread John-Scott

I'm not using windows these days, but taking a quick look at
http://sourceforge.net/projects/mysql-python seems to indicate that
they've only compiled a windows installer that depends on python2.4.
You have at least two options, 1) download the source for mysql-python
and attempt to build it yourself or 2) install python2.4. It might just
be easiest to install python2.4 (unless 2.5 really has something you
can't live without), you can have both versions installed side by side
(c:\python2.4 & c:\python2.5).

John-Scott

On Jan 11, 3:41 am, Carl Holm <[EMAIL PROTECTED]> wrote:
> Thanks,
>
> I'm getting the impression that MySQLdb is not available to Python 2.5,
> but if anyone is using this configuration, I would like to
> find out about the details. The OS in question is WinXP - Version 5.1.2600.
>
> Regards,
>
> CL
>
> Brett Parker wrote:
> > 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,


--~--~-~--~~~---~--~~
 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-11 Thread Rob Slotboom

And of course a new kind of sorting function. Thank's to 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-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-11 Thread Robert Slotboom

I was thinking about a custom get_query_set().get_data() function but 
this is out of scope I suppose

So I figured out three possible solutions:

First is a recursive quey. Not supported bij Postgres :-(

Second is to add a column for storing the path value, calculated and 
added just before saving. Drawback: non database relations, custom 
update mechanism needed.

Third is to create seperate tables. In the case of taxanomy: Family, 
Genus, Species and Variety. A crop, in my case, is always a child of a 
variety, or a subvariety.
The subvar can recurse to var (same table) without the sorting problem 
because there can only be one level for parent .

Unfortunately none of these solutions can be applied for the simple 
category, subcategory, n-category realtions. But I've got my taxanomic 
tree!!!

--
Robert Slotboom

> Not since the sorting is done in Python instead of SQL. If you were 
> using
> order_by it would work how you want. (If your Category URLs all have 
> the
> same prefix, I would just sort by whatever field is being put in the 
> URL
> since that's probably the only difference). But since you are sorting 
> in
> Python in this case the QuerySet must be resolved into a list -- 
> there's no
> way to tell the SQL in the QuerySet to rearrange them in an arbitrary 
> order
> as far as I know (I'm not sure how that could work).
>
> But if get_absolute_url() just returns 'http://whatever/categories/' +
> self.name for example, it may make sense to just do
> Category.objects.order_by('name').filter(...).
>
> -- 
> Brian Beck
> Adventurer of the First Order
>
>
> >
>



--~--~-~--~~~---~--~~
 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 + MySQLdb

2007-01-11 Thread Carl Holm

Thanks,

I'm getting the impression that MySQLdb is not available to Python 2.5, 
but if anyone is using this configuration, I would like to
find out about the details. The OS in question is WinXP - Version 5.1.2600.

Regards,

CL



Brett Parker wrote:
> 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,
>   

--~--~-~--~~~---~--~~
 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
-~--~~~~--~~--~--~---