Re: How soon will a stable magic-removal version probably be released?

2006-04-19 Thread Russell Cloran
Hi, Have a look at : http://groups.google.com/group/django-developers/browse_thread/thread/ea36b87b30cc9e1/34d4734058c2285e Russell On Wed, 2006-04-19 at 17:17 +0800, flyaflya wrote: > Several days? several weeks? several months? or several years? > If too far,I will use 0.91 version. > > -- >

Re: Query for "missing" information

2006-04-11 Thread Russell Cloran
Hi, On Tue, 2006-04-11 at 09:24 -0500, Adrian Holovaty wrote: > That's not possible with the Django ORM, but you can drop into raw SQL > quite easily. See this page for an example: > http://www.djangoproject.com/documentation/models/custom_methods/ Thanks Adrian, this is exactly what I was looki

Re: querying for an empty set in m-r?

2006-04-11 Thread Russell Cloran
Hi, On Tue, 2006-04-11 at 21:20 -0400, Max Battcher wrote: > if sometag.article_set.count() == 0: > pass # your code here This will test if one tag has an empty article_set. AFAICT, the question is on how to find all tags which have an empty article_set. Yes, you could do it this way, but it

Re: Query for "missing" information

2006-04-10 Thread Russell Cloran
Hi Tone, Either I misunderstand the docs, or I misunderstand how this can be useful to me. Or this is not particularly useful to me. B.objects.extra(select={'foo': 'SELECT COUNT(*) FROM app_a WHERE b_id=app_b.id'}, where=['`foo` > 0']) generates a SQL query: SELECT `app_b`.`id`,(SELECT COUNT(*

Query for "missing" information

2006-04-10 Thread Russell Cloran
Hi all, I have a model (A) which has a foreign key to another (B). I wish to construct a query for all B which have an empty a_set. This is possible with SQL, using something like: SELECT b.id FROM b LEFT OUTER JOIN a ON b.id=a.b_id WHERE b.a_id IS NULL; How would I construct such a query usin

Re: Modify pulldown contents in admin interface

2006-04-10 Thread Russell Cloran
Hi, On Mon, 2006-04-10 at 15:36 +0100, Graham King wrote: > Is there a way to control the values that appear in a pulldown (a > ForeignKey field) on the admin interface ? > > I would like the ForeignKey to only be assignable to a subset of all > values. Is the limit_choices_to option suit

Re: sending an email

2006-02-27 Thread Russell Cloran
Hi Mary, On Mon, 2006-02-27 at 13:06 +, Mary Adel wrote: > send_mail('test', 'i am succeded', '[EMAIL PROTECTED]', > ['[EMAIL PROTECTED]']) > and i am having error which is: > Exception Type: error Exception Value: (111, 'Connection refused') > Exception Location: /usr/lib64/python2.4/

Re: weekend datetime objects

2006-02-22 Thread Russell Cloran
Hi, On Wed, 2006-02-22 at 19:12 -0800, Luke Skibinski Holt wrote: > dt = datetime.now() > dt.replace(day=28, month=2) > wd = dt.weekday() > sat = dt.replace(day=dt.day+(5-wd)) > sun = dt.replace(day=dt.day+(6-wd)) >>> from datetime import datetime, timedelta >>> dt = datetime(2006, 2, 28) >>> wd

Validation across multiple fields

2006-02-22 Thread Russell Cloran
Hi, I have a sinking feeling that I'm missing something obvious here, so I guess it's worth asking the list :) I'm using magic-removal, and... I have a model which defines a time range, using a from_date and to_date DateTimeField. Only one record may exist in the database for any one point in t