Re: Bug with distinct + aggregate ?

2010-09-14 Thread donato.gr
I managed in this way: >>> subquery = Father.objects.filter(sons__in=[adam, bernard]) >>> Father.objects.filter(pk__in=subquery).aggregate(Sum('age')) this gives the correct result. Is there a better way to do so? (maybe more efficient?) Thanks On 13 Set, 17:

Bug with distinct + aggregate ?

2010-09-13 Thread donato.gr
Hi, when using 'aggregate(Sum(...))' on a queryset that is also using 'distinct()', 'DISTINCT' is misplaced in resulting SQL query... Here is a silly sample code: I have the following classes: class Son(models.Model): name = models.CharField(max_length=20) def __unicode__(self):

Re: Several translations for the same string

2010-07-06 Thread donato.gr
msgid "is active (m)" > msgstr "is active" > > #: .\myapp\models.py:87 > msgid "is active (f)" > msgstr "is active" > > HTH, > Nuno > > > > On Mon, Jul 5, 2010 at 10:53 AM, donato.gr wrote: > > Hello, > > I&#x

Several translations for the same string

2010-07-05 Thread donato.gr
Hello, I'm writing an application which has to be translated in English and Italian. The problem is that italian adjectives change form according to the gender of the word they are referred to. E. g. "is active" can be translated as 'è attivo' or 'è attiva'. My question is: is it possible to speci

Re: Force ContentType id

2010-06-22 Thread donato.gr
Thanks, I'll have a look On 22 Giu, 11:01, Simon Brunning wrote: > On 22 June 2010 09:58, donato.gr wrote: > > > I found some topics about tools such as 'django evolution' but I was > > wondering if Django itself provides a simpler way to make simple > >

Re: escapejs inside {% trans %}

2010-06-22 Thread donato.gr
Thanks, I'll try it! On 21 Giu, 15:19, Tom Evans wrote: > On Mon, Jun 21, 2010 at 2:17 PM, donato.gr wrote: > > Hi, > > I had this code in a template file: > > alert('{% trans "a string" %}') > > > It gave error when translated bacause t

Re: Force ContentType id

2010-06-22 Thread donato.gr
Thank you, your explanation was very clear and useful. > > Or, is there a way to run a syncdb to apply changes without losing > > data? Our software product is under development and sometimes we have the need to change a model definition (e.g. rename a field or change its definition): is there a

escapejs inside {% trans %}

2010-06-21 Thread donato.gr
Hi, I had this code in a template file: alert('{% trans "a string" %}') It gave error when translated bacause the translated string had a ' inside. So, I replaced " with ' in the template line and all worked fine. To avoid any problem with 'escape chars', is there a way to escape translated strin

Force ContentType id

2010-06-21 Thread donato.gr
I had to clean my application database from old models without losing data. So, I copied my tables to another db, dropped them, run syncdb and copied data back. But the app stopped working, because some tables used GenericRelations and still pointed to the old ContentType; so, I had to change that

Admin: issues in saving an object in popup

2010-05-28 Thread donato.gr
In the Admin application I can create related objects 'on the fly' in a popup (e.g. when changing a User I can create Groups by pressing the green 'plus' next to the Group list): this is done adding '_popup=1' to the url used in the popup (e.g. "/admin/auth/group/add/?_popup=1"). The 'Save' button