Re: has more than 1 ForeignKey to

2008-11-10 Thread Michael Ellis
Try settting related_name on "user" as well. user = models.ForeignKey(User, unique=True, related_name='foo') ME --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send e

Re: Sorl Thumbnails Directory Permissions

2008-05-28 Thread Michael Ellis
Graham, you've once again made my life easier. Your solution solved ALL my ownership/permission issues. Thank you! My mod_wsgi directive now looks like so: WSGIDaemonProcess user1 threads=15 user=user1 group=user1 display-name= %{GROUP} WSGIProcessGroup user1 WSGIApplicationGroup %{GLOBAL} I th

Re: Django's flexibility

2008-05-28 Thread Michael Ellis
Hi Bernard, To me, one of the attractions of Django is that the look and feel is COMPLETELY up to you. Django does not come with templates. You create them...and they're just HTML files. Wherever you want Django to do something in your page, insert the proper Django Template code: http://www.dja

Re: Sorl Thumbnails Directory Permissions

2008-05-28 Thread Michael Ellis
Here's my clunky, but working, solution. In the following example, I have solved two security issues I was experiencing: 1) the original sorl directory permissions—now 755—and 2) the 'upload_to' folder of the source images—also now 755. In the following example... Apache with mod_wsgi v2.0 (daem

Re: Sorl Thumbnails Directory Permissions

2008-05-28 Thread Michael Ellis
Thanks, John. I found a clunky solution (see next post), but I like your solution better. I'm using mod_wsgi in daemon mode, but Django seems to be running as 'nobody'. Here's my mod_wsgi directive in httpd.conf's Virtualhost section: WSGIDaemonProcess user1 threads=15 display-name=%{GROUP} WSGIP

Sorl Thumbnails Directory Permissions

2008-05-27 Thread Michael Ellis
I'm using sorl-thumbnails on Apache. It's working fine, except permissions on the directory in which it writes the thumbnails — / media/images — must be set to 777. For obvious security reasons, I'd like to work around this somehow...or at least minimize the threat. Any suggestions? Thanks! ME --

Re: Search Result Pagination

2008-05-15 Thread Michael Ellis
Adi. That got the pagination working on the first page! Thank you! I'm getting no results on page 2, however. I know this is in the way I'm handling GET requests (see the 'else' statement). I'm just not sure how this should be handled. I'll be reading some docs and searching around for a solution

Re: Search Result Pagination

2008-05-14 Thread Michael Ellis
> What does the search funtion return? > A django queryset or a xapian result and are you sure that > the Paginator can handle the returned value? Hmmm. Great question. I believe it's returning a xapian result set. In my template, I'm looping through the paginator.object_list. Here's a simple e

Re: Search Result Pagination

2008-05-14 Thread Michael Ellis
> what does the search method of your model do? > I can't find any reference of a search function in the docs. I'm sorry, but I don't think I understand the question. I'm searching on a full-text index. ME --~--~-~--~~~---~--~~ You received this message because y

Re: Search Result Pagination

2008-05-14 Thread Michael Ellis
You're right. The form action was blank. I changed it to "/Catalog/ search/?page=1". I'm now seeing the page parameter, but I'm still seeing all the results on one page. >> Have you tried 'results': results.object_list in your render_to_response? I tried this and still no luck. Also, using "'re

Re: Search Result Pagination

2008-05-14 Thread Michael Ellis
> shouldn't this be > results = paginator.page(pager).object_list Thanks, Adi. I get the same result set with that. The only exception is that I get the following error: 'generator' object has no attribute 'has_next' If I comment out the 'has_next' and 'has_previous' lines in the render

Search Result Pagination

2008-05-13 Thread Michael Ellis
Hello all. I'm having trouble getting pagination working on search results in a custom view. I have djapian/xapian full-text indexing working and I have some pagination code cobbled together from various sources. I can get the search results and all the pagination (result count, page x of y, etc)

Categorize and List if Item Exists

2008-04-22 Thread Michael Ellis
Hello all, I have the following models: class Category(models.Model): name = models.CharField(core=True, max_length=100) parent = models.ForeignKey('self', blank=True, null=True, related_name='child') class Product(models.Model): name = models.CharField('name', max_lengt