Re: Improvements to better support implementing optimistic concurrency control

2011-08-09 Thread akaariai
hat can be done without too much code duplication. I had another idea for optimistic locking: why not use the pre_save signal for this? There is a proof of concept how to do this in https://github.com/akaariai/django_optimistic_lock The idea is basically that if you add a OptimisticLockField to you

Re: Improvements to better support implementing optimistic concurrency control

2011-08-08 Thread akaariai
On Aug 8, 6:30 pm, Steven Cummings wrote: > For backward compatibility, there may be a Model sub-class that would leave > Model alone altogether (this was suggested on the ticket). This seems fair > since many seem to be getting by without better optimistic concurrency > control from Django's ORM

Re: Improvements to better support implementing optimistic concurrency control

2011-08-08 Thread akaariai
On Aug 8, 4:54 pm, Steven Cummings wrote: > Interesting feature I hadn't noticed in memcached. That does seem like it > would do the trick where memcached is being used. I think the ability to > control it in Django would generally still be desirable though, as that is > where the data ultimately

Re: Weekly check-in #1

2011-07-27 Thread akaariai
Just a quick note: It could be a good idea to have concrete_fields in addition to virtual_fields in the Meta class. Concrete fields would be the fields having a database column directly attached to it, the rest would be in virtual fields. The fields attribute would be these two joined together. Thi

Re: Weekly check-in #1

2011-07-27 Thread akaariai
On Jul 20, 4:18 pm, Michal Petrucha wrote: > The last week I've been looking into related fields and all that > stuff. As it turns out, the issue is much more complex than I > originally anticipated and at the moment I have some doubts whether > this can be achieved as part of this GSoC. > > Basic

Re: localization in python code (views, models etc)

2011-07-12 Thread akaariai
On Jul 12, 12:28 pm, Jannis Leidel wrote: > Yeah, django.utils.formats.localize is the main function to localize > a value using the format localization engine from Python. The missing > documentation is a bug, IMO. Just a minor correction: localize does not use the localization engine from Pytho

Re: Weekly check-in (this should be #5, right...?)

2011-07-07 Thread akaariai
s. No wonder the patch is quite big. I accidentally branched from the conditional aggregation branch, so it has all the things in that patch included. And that patch is much larger than the multicolumn_join patch. I pushed a new branch to github (https://github.com/akaariai/django/ tree/multic

Re: Weekly check-in (this should be #5, right...?)

2011-07-05 Thread akaariai
On Jul 6, 1:39 am, akaariai wrote: > Having said all this, for this project "extend the connection tuple" > approach seems to be the only sane choice. I implemented this in my github branch https://github.com/akaariai/django/tree/composite_join With this you can do: a = Art

Re: Weekly check-in (this should be #5, right...?)

2011-07-05 Thread akaariai
On Jun 27, 4:22 am, Michal Petrucha wrote: > some visible progress on my project at long last. I spent most of the > last week digging deep inside the ORM's entrails to make composite > field lookups possible and finally it looks promising. > > While working on this I found out the extra_filters a

Django ORM enchantments

2011-07-04 Thread akaariai
I have implemented proof of concept versions of conditional aggregation, F-lookups in aggregates and annotating fields to a model (qs.field_annotate(age_x2=F('age')*2), note: no aggregation here). See ticket #11305 for more details. I would also hope to implement a patch which would allow to annot

Re: Idea for i18n fields

2011-07-02 Thread akaariai
On Jul 2, 12:59 am, Ric wrote: > Hi there, > > i have got a simple approach to make all django fields with a full > i18n support > > the django.models.fields.Field class can be subclassed like this > > from django.db import models > from django.utils.translation import get_language > > class i18nF

Re: Conditional aggregations.

2011-06-29 Thread akaariai
On Jun 28, 5:46 pm, Javier Guerra Giraldez wrote: > i might be totally wrong (wouldn't be first time..) but i've found > myself having to adapt to local dialects almost every time i see some > SQL inside a function, especially on mysql and sqlite.   maybe it's > because of the bad quality of code

Re: Thoughts on solution to forward references in MySQL (#3615)

2011-06-28 Thread akaariai
On Jun 28, 12:24 am, "Jim D." wrote: > I spent some time last week and over the weekend nailing down a > solution forhttps://code.djangoproject.com/ticket/3615. This is the > ticket about allowing forward references when loading data on the > MySQL InnoDB backend. My patch implements the proposed

Re: Conditional aggregations.

2011-06-28 Thread akaariai
On Jun 28, 5:18 pm, Javier Guerra Giraldez wrote: > On Tue, Jun 28, 2011 at 8:41 AM, akaariai wrote: > > This should translate to the following SQL: > > SELECT sum(case when house.price > 41000 and house.price < 43000 then > > 1 else 0 end) as expensive_house, > >

Re: Conditional aggregations.

2011-06-28 Thread akaariai
On Jun 27, 4:54 pm, Russell Keith-Magee wrote: > > queryset.aggregate( > >    expensive_house=Count(house__price, > > only=(Q(house__price__gt=41000), Q(house__price__lt=43000))), > >    ... > >    ) > > Ok, so that's you're syntax proposal. Now show me the SQL that this > translates into. In part

Re: Removal of DictCursor from raw query.. why??

2011-06-17 Thread akaariai
On Jun 17, 8:02 pm, Ian Kelly wrote: > The thing is, this is a DB API snippet, not a Django snippet > specifically.  If Django were a DB API toolbox, then it might make > sense to include it in some form or other.  But it's not, so in the > interest of keeping things relatively tidy I'm a -0 on t

Re: Removal of DictCursor from raw query.. why??

2011-06-17 Thread akaariai
On Jun 17, 2:54 pm, "Cal Leeming [Simplicity Media Ltd]" wrote: > Because I feel this is just something that should work (or be available) out > of the box. There are plenty of other places where Django docs has included > code snippets to give the user a heads up, and I think this is the perfect

Re: RFC: Composite fields API

2011-05-17 Thread akaariai
On May 17, 5:32 pm, Michal Petrucha wrote: > Proper subquery support is something that can be addressed once the > rest of the implementation is stable. To me the plan looks very reasonable (both disallowing subqueries and converting to disjunction form), unless there is some part in the internal

Re: RFC: Composite fields API

2011-05-17 Thread akaariai
On May 12, 2:41 pm, Michal Petrucha wrote: > Due to the nature of this field type, other lookup filters than > ``exact`` and ``in`` would have unclear semantics and won't be > supported. The original plan was to also exclude support for ``in`` > but as it turns out, ``in`` is used in several place

Re: Resetting settings under test

2011-05-13 Thread akaariai
On May 13, 3:41 pm, Jeremy Dunck wrote: > In general, the TestCase does a good job of cleaning up the > environment (resetting the DB, etc.), but I've run across an edge case > that might be worth putting upstream. > > I have a large codebase running multi-tenant -- lots of sites per WSGI > proces

Re: Accidental logging disabling

2011-04-15 Thread akaariai
On Apr 15, 7:34 am, Ivan Sagalaev wrote: >      import logging > >      import settings >      from django.core.management import setup_environ >      setup_environ(settings) > >      from django.test.client import RequestFactory > >      factory = RequestFactory() >      factory.get('/') >      l

Re: Read-only forms and DataBrowse

2011-04-07 Thread akaariai
ango (last commit is from August 23, 2010). [1] https://github.com/akaariai/django/tree/ticket10427 - Anssi -- You received this message because you are subscribed to the Google Groups "Django developers" group. To post to this group, send email to django-developers@googlegroups.com.

Re: Django Template Compilation rev.2

2011-03-30 Thread akaariai
On Mar 30, 6:18 am, xtrqt wrote: >     def templ(context, divisibleby=divisibleby): >         my_list = context.get("my_list") >         _loop_len = len(my_list) >         result = [] >         for forloop, i in enumerate(my_list): >             forloop = { >                 "counter0": forloop,

Re: Template Compilation

2011-03-28 Thread akaariai
On Mar 27, 5:48 am, "G.Boutsioukis" wrote: > Hi, I'm thinking about submitting a proposal for template compilation > and I'm posting this as a request for more info. > > In particular, I remember this project being discussed last year and I > pretty much assumed that Alex Gaynor's proposal would h

Re: Composite primary keys

2011-03-21 Thread akaariai
On Mar 21, 1:20 pm, Michal Petrucha wrote: > > My suggestion is to create an Index type that can be included in a > > class just like a field can.  The example we've been using would > > then look like: > > > class Foo(Model): > >    x = models.FloatField() > >    y = models.FloatField() > >    a

Re: Expensive queryset cloning

2011-03-16 Thread akaariai
On Mar 17, 3:11 am, Alexander Schepanovski wrote: > Can you find that patch and post somewhere? > If not still thanks for this idea. Unfortunately, no. Gone with my old laptop. - Anssi -- You received this message because you are subscribed to the Google Groups "Django developers" group. To

Re: Expensive queryset cloning

2011-03-16 Thread akaariai
On Mar 16, 10:14 am, Thomas Guettler wrote: > Hi Alexander, > > I have seen this in my app, too. It still runs fast enough. But > I guess the django code could be optimized. > I had a patch for this problem somewhere, but can't find it now. Basically it added inplace() method to queryset, and a

Re: the new SELECT DISTINCT query in 1.3 rc1, and how to turn it off

2011-03-05 Thread akaariai
On Mar 5, 7:29 am, Karen Tracey wrote: > It's probably best if you open a ticket in trac > (http://code.djangoproject.com/newticket) for this. I can't think offhand how > to solve both the problem that changeset fixed and the one you are > encountering > If Django ORM would be able to perf

Forms: display_value for BoundFields and widgets

2010-11-30 Thread akaariai
s used for viewing data, the link "Muokkaa" in the upper left corner is a edit link. http://users.tkk.fi/akaariai/Screenshot-7.png The second picture is what you get when clicking the edit link. This is rendered with {{ form.as_table }}. http://users.tkk.fi/akaariai/Screenshot-8.png It is

Re: Changing settings per test

2010-11-05 Thread akaariai
On Nov 5, 2:18 am, Alex Gaynor wrote: > def setUp(self): >    self.old_SETTING = getattr(settings, "SETING", _missing) > > def tearDown(self): >     if self.old_SETTING is _missing: >         del settings.SETTING" >     else: >         settings.SETTING = self.old_SETTING How about introducing a n

Re: AutoFields, legacy databases and non-standard sequence names.

2010-10-08 Thread akaariai
On 8 loka, 10:41, Hanne Moa wrote: > You can't necessarily do this with a legacy database, as other systems > also using that database expect the existing names. alter sequence owned by does not change the sequnce name, just what pg_get_serial_sequence will return for given table, column combi

Re: AutoFields, legacy databases and non-standard sequence names.

2010-10-07 Thread akaariai
> Sorry, I should have been more clear. > > What I'm trying to do is solicit suggestions from django developers as > to how I *can* move ticket #1946 forward. I can find a way to work > around it in my own project, but it would be ideal to solve it on the > Django side, for everybody. > > I mention

Re: Changes to LazySettings

2010-09-28 Thread akaariai
On Sep 28, 3:42 am, Luke Plant wrote: > But can anyone else think of any gotchas with this change before I > commit it? It produces a 30% improvement for the benchmark that relates > to the ticket [3]. Not directly related to this change, but there are at least one part in Django that will cache

Re: Speed testing Django

2010-09-16 Thread akaariai
On Sep 16, 10:43 am, Russell Keith-Magee wrote: > Do we have a continuous performance benchmark at present? No. > > Would it be worth having one? Certainly. > > There's a long standing ticket proposing just such a change: > > http://code.djangoproject.com/ticket/8949 > > And there was a sprint ea

Speed testing Django

2010-09-16 Thread akaariai
Is there any continuous speed testing done for Django? It would be nice to see how performance of Django is evolving. For example while working on ticket #14290, seeing how my changes to utils/translation/ __init__.py affect other parts of the framework would be useful. In general, speed testing sh

Re: I need a pony: Model translations (aka "my proposal")

2009-09-14 Thread akaariai
When using related table based approach for the translations, django could use pivoting to fetch all the translations with just one normal join. Some pseudo sql, skipping constrains and indexes... create table a ( id integer pkey ); create table b ( id integer pkey, a_id integer references