Account Options

  1. Sign in
The old Google Groups will be going away soon.
Switch to the new Google Groups.
Google Groups Home
« Groups Home
Message from discussion Changing the options in manage.py, adding more signals (was Re: Adding hooks to methods that generate SQL in django/core/management.py)
The group you are posting to is a Usenet group. Messages posted to this group will make your email address visible to anyone on the Internet.
Your reply message has not been sent.
Your post was successful
 
From:
To:
Cc:
Followup To:
Add Cc | Add Followup-to | Edit Subject
Subject:
Validation:
For verification purposes please type the characters you see in the picture below or the numbers you hear by clicking the accessibility icon. Listen and type the numbers you hear
 
George Vilches  
View profile  
 More options Aug 14 2007, 10:20 am
From: George Vilches <g...@thataddress.com>
Date: Tue, 14 Aug 2007 10:20:06 -0400
Local: Tues, Aug 14 2007 10:20 am
Subject: Re: Changing the options in manage.py, adding more signals (was Re: Adding hooks to methods that generate SQL in django/core/management.py)

George Vilches wrote:
> Russell Keith-Magee wrote:
>> On 8/12/07, George Vilches <g...@thataddress.com> wrote:
>>> 1) Add a signal to every option?
>> If we were going to go down this path, this would be the preferred
>> option. However, I'm not sure I'm convinced of the need. Which
>> commands exactly do you think require signals?

Since the first example I gave may not be particularly compelling, since
some craftiness with static Django models could be used to solve the
problem, let me give one that I don't believe could be solved that way.

Assume I'm building a row-based audit system.  I also want this audit
system to have one audit table/model per legitimate Django model.  So,
say I have an app.model called "wiki.article".  This would create a
"wiki_article" table.  I also want to have a "wiki_article_audit" table
keeping a full history of changes.  Now, since Django models don't
support inheritance yet, and I don't want to have to re-create every
model that I want to perform an audit on, I can instead create a dynamic
model from the original model with a small helper.  Unfortunately,
syncdb and the like don't have a way of detecting this dynamic model and
creating tables and such for it.  However, I've already got a mechanism
in syncdb (via signals) which uses the existing management functions to
write that new dynamic model to the database, and then in runtime
everything works perfectly happy.

Unfortunately, since there's only a syncdb signal, I can't even do
things like a reset on it, and there's definitely no way currently to
get the SQL generated from my syncdb signal.  Being able to get the
CREATE and DROP statements in text as well as each individually would be
a huge boon to this type of use (and any dynamic model use in general).

Is that a more reasonable example?

Thanks,
George


 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.