How to "automatically " populate "last_updated_by" DB columns with the current user's id

2014-10-13 Thread Ken Winter
I'm building a Django app that will work against a pre-existing PostgreSQL database. Every user data table in my DB has an auditing column called last_updated_by. The requirement I need to meet is that every time an UPDATE is run against a table, that column is automatically set to the id

Incremental inspectdb, anyone?

2014-10-15 Thread Ken Winter
Is there a Django utility or add-on that can read database schemas and turn them into Django data models *incrementally*? By "incrementally", I mean that the utility would be able to update a set of already existing Django models so they match the current DB schema. In other words, the utilit

Re: How to "automatically " populate "last_updated_by" DB columns with the current user's id

2014-10-15 Thread Ken Winter
Thanks, Collin, Carl, & Tom ~ Is this a reasonable summary of what you have said so far?: 1. You've suggested two solutions, which I'll call "middleware" (from Collin) and "save() argument" (from Carl and Tom). 2. A limitation of both is that they aren't what I'll call "universal".

Re: How to "automatically " populate "last_updated_by" DB columns with the current user's id

2014-10-17 Thread Ken Winter
To keep this conversation fairly modular, I'm responding to different possible solutions in different posts. This one is about Carl's comments on: > 1. Stick some code into the database connector, as I described in > possibility 1 of my original post. I guess the connector would be >

Re: How to "automatically " populate "last_updated_by" DB columns with the current user's id

2014-10-17 Thread Ken Winter
To keep this conversation fairly modular, I'm responding to different possible solutions in different posts. This one is about Carl's comments on: > 2. Have Django create a new *database user *for each session login, > using the user id that Django knows and that I want to record in the

Re: How to "automatically " populate "last_updated_by" DB columns with the current user's id

2014-10-17 Thread Ken Winter
Thanks again Carl (and others) ~ I agree wıth you that the "DB users" approach seems the most promısıng. It's the one I will pursue, and certainly glad to share the code when I have some worth sharing - and quite likely I'll have some more questions before that, as I try to implement this idea

Re: How to "automatically " populate "last_updated_by" DB columns with the current user's id

2014-10-18 Thread Ken Winter
again, Ken On Friday, October 17, 2014 5:46:05 PM UTC-6, Ken Winter wrote: > > Thanks again Carl (and others) ~ > > I agree wıth you that the "DB users" approach seems the most promısıng. > It's the one I will pursue, and certainly glad to share the code when I >