Re: select_related() and child rows

2007-05-22 Thread hartshorne
I think it's reasonable for Django to leave this one up to the framework user. Thanks! Beau On May 21, 10:12 pm, simonbun <[EMAIL PROTECTED]> wrote: > As far as i know, select_related doesn't work across reverse > relationships. Sometimes it's possible to just query the base model to > achieve t

select_related() and child rows

2007-05-21 Thread Beau Hartshorne
I've got some models that look something like this: class Entry(models.Model): text = models.TextField() class SubEntry(models.Model): text = models.TextField() sub_entry = models.ForeignKey(Entry) class SubSubEntry(models.Model): text = models.TextField() sub_sub_entry = models.

Calling Methods from Admin

2006-12-02 Thread Beau Hartshorne
What's the best way make a method call from Django's admin? I'd like to set up a link or button that re-sends emails to users who've lost them to the Internet or spam traps or whatever. Thanks, Beau --~--~-~--~~~---~--~~ You received this message because you

Re: extra(), dict and list?

2006-10-11 Thread Beau Hartshorne
On 10-Oct-06, at 5:30 PM, Malcolm Tredinnick wrote: > Looks like you're right; there is going to be a problem there. The > "params" attribute is typically more useful with extra "where" > clauses, > which is a list, so this doesn't come up in that case. > > Could you file a ticket about this, p

Re: extra(), dict and list?

2006-10-10 Thread Beau Hartshorne
On 10-Oct-06, at 5:04 PM, Russell Keith-Magee wrote: > More a limitation than a problem. Python dictionaries are what they > are - your use case is a little unusual compared to what I have > usually seen the extra(select=...) field used for. > > One workaround I can think of is to use > django.ut

extra(), dict and list?

2006-10-10 Thread Beau Hartshorne
extra() expects a dictionary of extra select fields, and a list of query parameters to go with it. Since dictionaries are unordered, something like this fails: extra(select={'thingOne': 'REGEX %s', 'thingTwo': 'REGEX %s'}, params = (one, two)) Is this a known problem? Should I be writing m

Re: Relevance

2006-10-05 Thread Beau Hartshorne
On 4-Oct-06, at 6:45 PM, Andy Dustman wrote: > Oh, *that's* interesting. It's not really execution of the query > that's causing the problem but the debug code that retains all > executed queries. Although the execution could be raising the same > exception: The part we are seeing above is in a f

Re: Relevance

2006-10-04 Thread Beau Hartshorne
On 4-Oct-06, at 6:12 PM, Andy Dustman wrote: > I'm not sure this will fix your problem, but it might from my reading > of the code. Try reversing the order of the filter() and extra() > methods, i.e. > > qs = Place.objects.all().extra(select={'relevance': match_expr}, > params=[query]).filter(nam

Re: Relevance

2006-10-04 Thread Beau Hartshorne
On 15-Sep-06, at 12:39 PM, mrstone wrote: > I'm fiddling around with MySQL fulltext search and run into a problem. > > Using the below code works: > > match_expr = "MATCH(name) AGAINST (%s IN BOOLEAN MODE)" > qs = > Place.objects.all().filter(name__search=query).extra(select= > {'relevance': > m

Re: Unicode and django/db/backends/util.py

2006-10-03 Thread Beau Hartshorne
On 3-Oct-06, at 7:36 PM, Malcolm Tredinnick wrote: > So this is the value that the string has right at the moment the > exception occurs? Can you paste the traceback you see, please (and > preferably the value of 'sql' and 'params' at that point as well). > > I'm a bit in the dark about what is h

Re: Unicode and django/db/backends/util.py

2006-10-03 Thread Beau Hartshorne
On 3-Oct-06, at 6:56 PM, Malcolm Tredinnick wrote: > This probably isn't going to solve your problem, but it might help > track > down what is really happening... > > UnicodeDecodeError usually means that you are trying to use unicode > strings that haven't been converted to UTF-8 when they nee

Unicode and django/db/backends/util.py

2006-10-03 Thread Beau Hartshorne
On database updates, utf-8 strings like ’ raise an UnicodeDecodeError exception on line 19 of util.py (version 0.9.5). I can get around this by commenting out this code in util.py, but is there something else I could do? self.db.queries.append({ 'sql': sql % tuple(params), 'time':

Re: settings.py help please

2006-09-21 Thread Beau Hartshorne
On 21-Sep-06, at 6:28 AM, zehi wrote: > Not sure how to install MySQLdb . for OS X 10.4 > > I am following "Installing Django on Mac OS > X" word by word, but still can't get things run. > > Somebody have some experience? Hi zehi, Bob Ippolito built an OS X package for MySQLdb. You can get it

Re: RequiredIfOtherFieldDoesNotEqual + checkbox bug?

2006-09-10 Thread Beau Hartshorne
On 10-Sep-06, at 2:27 PM, Don Arbow wrote: >> My use case is to make a field required only if a checkbox is >> unchecked. If this is a bug, what can I do to help? > > Have you tried RequiredIfOtherFieldNotGiven()? Do you know if all browsers just leave unchecked checkboxes out of the POST? Th

RequiredIfOtherFieldDoesNotEqual + checkbox bug?

2006-09-10 Thread Beau Hartshorne
I tried using django.core.validators.RequiredIfOtherFieldDoesNotEqual to validate against a checkbox, and I think I ran into a bug. Browsers often don't include checkboxes in POST data, and it seems that RequiredIfOtherFieldDoesNotEqual assumes that they are: def __call__(self, field_data,