Re: insert or update

2007-08-21 Thread George Vilches
Lic. José M. Rodriguez Bacallao wrote: > how can I know programatically if an operation in a model is an insert, > update or delete? > I just want to extend the admin log to log any action in my application > models. Right now, > admin app only log actions executed by itself. Part of your quest

Re: insert or update

2007-08-21 Thread George Vilches
Lic. José M. Rodriguez Bacallao wrote: > how can I vote? There's no official voting mechanism for the non-Django developers right now, it's mostly just based on putting a comment on the Trac ticket or in the mailing list saying that you would use this functionality for such and such a reason.

Re: insert or update

2007-08-21 Thread George Vilches
r_f_d wrote: > As far as insert or update, just overide the save method within the > class. It is something that must be done for each class, but what I > have done (for essentially the same purpose) is override save() on > each model I need to log the action for like so: > > def save(): > #

Re: management.py application commands and one off scripts

2007-08-22 Thread George Vilches
Graham Carlyle wrote: > The pending ability to allow custom application commands made me think > about a few on-off scripts i have that i wouldn't want to have available > as a command but do django stuff from the command line. > > Maybe its worth adding a new core command for invoke these sorts

Re: Marty Alchin's AuditTrail

2007-08-22 Thread George Vilches
Kai Kuehne wrote: > Hi, > > On 8/22/07, perrito666 <[EMAIL PROTECTED]> wrote: >> Hello people, i have found a situation where AutidTrail comes very >> handy, but it does not work out of the box on my model, it says here >> http://www.djangoproject.com/weblog/2007/aug/19/djangoroundup/#comments >>

Re: non-event driven method called?

2007-08-23 Thread George Vilches
James Bennett wrote: > On 8/23/07, John Menerick <[EMAIL PROTECTED]> wrote: >> Yeah, I was thinking of running a script in daemon mode, but I would prefer >> to keep the code inside the django instance to keep everything simpler. >> simpler as in the same settings for deployment, less hassle deplo

Audit Trail updates (was Re: Marty Alchin's AuditTrail)

2007-08-27 Thread George Vilches
perrito666 wrote: > Ah thank you, ill keep an eye, so far the only think I did to it was a > small hack to handle the error raised by trying to copy a fk to the > audit table but it is a not very clean hack. > Perrito. Took me an extra couple of days, but I've got all my modifications to AuditTr

Re: Keeping track of the original values for a record...

2007-08-29 Thread George Vilches
Jure Čuhalev wrote: > On 8/29/07, [EMAIL PROTECTED] <[EMAIL PROTECTED]> wrote: >> Since there isn't a load() method on a model... I'm thinking I somehow >> have to do this on the manager..but not sure ... any tips would be >> great. >> >> When I load a record, either via get() or by looping throug

Re: Another installation problem

2008-05-05 Thread George Vilches
Or run Debian testing. Why switch distros or even distro flavors if you don't have to? :) Python 2.5 and most of the packages that are needed for Django are fine straight from apt on testing/unstable. gav Tom Novelli wrote: > Debian Etch is meant to be stable, not up to date (except for secu

Re: Custom management command

2008-05-14 Thread George Vilches
On May 14, 2008, at 5:23 PM, Alex Morega wrote: > > On May 14, 2008, at 23:37 , J. Pablo Fernández wrote: >> I've made a custom management command like this: >> [...] >> but it is not being picked up. ./manage.py help doesn't list it and: >> >> $ ./manage.py import_vortaro >> Unknown command: 'i

Re: Just started the tutorial and already getting Errors.

2008-05-14 Thread George Vilches
Jason Ourscene wrote: > First i had my python issue, got that settled and now in the first > django tutorial I create my poll model and add the def __unicode__ > method and im getting an error. heres the code, and the error: > > Code: http://pastie.textmate.org/197323 > and my error: http://pasti

Re: moving from MySQL to PostgreSQL on a "live" site ..

2008-05-20 Thread George Vilches
Hanne Moa wrote: > I have a filter that makes django's json-dumps more human-readable, by > adding a newline after every occurence of "}},". Running such a filter > first would make for short and snappy lines for the rewriting filter: > > python manage.py dumpdata | prettifyjson | fixbooleans > p

Re: Data change history

2007-10-01 Thread George Vilches
Jon Atkinson wrote: > Hello, > > I'd like to add a feature to the web application I'm developing, which > will track the changes to the data in the system. I've created a web > interface for various items of data, and each has a create and an edit > view. > > If possible, I'd like to create a lo

Re: How to keep track of iterations through a for loop in my template?

2007-10-01 Thread George Vilches
Greg wrote: > Hello, > I have a table in my template that will contain an x number of rows > depanding on what I get back from the view. I want my table row > background color to rotate between red and white. As of now, I don't > know how to keep track of each iteration through my for loop to se

Re: Relating model to itself.

2007-10-16 Thread George Vilches
Dmitriy Sodrianov wrote: > Hi to all! > > Can anyone help me, why none of the following code works: > > class Task(models.Model): > parent = models.ForeignKey(Task) > > Try: class Task(models.Model): parent = models.ForeignKey('Task') It will do the lookup lat

QuerySet.count() inaccurate across ForeignKey relationships

2007-10-31 Thread George Vilches
Stated simply: queryset.select_related().count() with no filter criteria generates a wrong query across a ForeignKey relationship. The problem: A QuerySet operation that involves a .count() across a ForeignKey relationship does not actually join in the ForeignKey tables to do the select_relate

Re: QuerySet.count() inaccurate across ForeignKey relationships

2007-10-31 Thread George Vilches
[EMAIL PROTECTED] wrote: > On Wed, Oct 31, 2007 at 11:09:49AM -0400, George Vilches wrote: >> Stated simply: >> queryset.select_related().count() with no filter criteria generates a >> wrong query across a ForeignKey relationship. > > Hi, > > do you ge

Re: QuerySet.count() inaccurate across ForeignKey relationships

2007-10-31 Thread George Vilches
koenb wrote: > First things first: I would either define a separate Group object > here, or use a many2manyfield if you don't need to know the group > numbers. The example was crafted because the actual models and data are part of a internal application that I am not allowed to publish the sourc

Re: QuerySet.count() inaccurate across ForeignKey relationships

2007-10-31 Thread George Vilches
to simplify things with ForeignKeys) just caused people to try to think about the relationships here, and that's not what was really the problem. For that, I apologize. Thanks, George Karen Tracey wrote: > On 10/31/07, *George Vilches* <[EMAIL PROTECTED] > <mailto:[EMAIL PRO

Re: QuerySet.count() inaccurate across ForeignKey relationships

2007-10-31 Thread George Vilches
Malcolm Tredinnick wrote: >> >> >>> Assembly.objects.select_related() >> [, , > Assembly object>, , > object>, ] >> >>> len(Assembly.objects.select_related()) >> 6 >> >>> Assembly.objects.select_related().count() >> 2L >> >> >> Since I'm using select_related(), I would expect it to follow the I

Re: QuerySet.count() inaccurate across ForeignKey relationships

2007-10-31 Thread George Vilches
Karen Tracey wrote: > On 10/31/07, *George Vilches* <[EMAIL PROTECTED] > <mailto:[EMAIL PROTECTED]>> wrote: > > Or (I just saw your follow-up e-mail), is all of this a moot point since > something like this is going to be made totally invalid in the future? &g

OneToOneField direction? (was Re: QuerySet.count() inaccurate across ForeignKey relationships)

2007-11-01 Thread George Vilches
ere the likely place to go about fixing it is in qs-rf. Or, you can tell us that we're wrong about our assumption that OneToOneFields should be bidirectional, because of XXX, and we'll respect your decisions. You know what's better for Django than us, by far. :) Thanks, George Malco

Re: OneToOneField direction? (was Re: QuerySet.count() inaccurate across ForeignKey relationships)

2007-11-01 Thread George Vilches
Alright, I guess it's not offlist. Sorry for the extra chatter folks. George Vilches wrote: > (Off-list because this mostly doesn't apply to non qs-rf people) > > Thank you for the clarification on OneToOneFields and required > relationships. We've been working wit

Re: OneToOneField direction? (was Re: QuerySet.count() inaccurate across ForeignKey relationships)

2007-11-01 Thread George Vilches
Karen Tracey wrote: > On 11/1/07, *George Vilches* <[EMAIL PROTECTED] > <mailto:[EMAIL PROTECTED]>> wrote: > [snip] > > For reporting purposes though, we would like to be able to > .select_related() on User, and get a cached copy of each of the OneToOne