<model> last changed by User

34 views
Skip to first unread message

Lachlan Musicman

unread,
Sep 27, 2012, 11:28:18 PM9/27/12
to django...@googlegroups.com
Hola,

I wanted to display the user that last changed a model instance.

It's hard to search for because the username/email-as-login makes up the majority of the search results.

Despite this, I've found a couple of pages, with this being the most like what I want:


I like this solution - simple and clean, easy to implement.

My only reservation is that I was under the impression that this information was already being kept and that putting a 

user = ForeignKey("User")

in each model that I want to track is doubling up on the data I'm keeping?

Cheers
L.


--
...we look at the present day through a rear-view mirror. This is something Marshall McLuhan said back in the Sixties, when the world was in the grip of authentic-seeming future narratives. He said, “We look at the present through a rear-view mirror. We march backwards into the future.”

http://www.warrenellis.com/?p=14314

Lachlan Musicman

unread,
Sep 27, 2012, 11:33:30 PM9/27/12
to django...@googlegroups.com
On Friday, September 28, 2012, Lachlan Musicman wrote:

I wanted to display the user that last changed a model instance.

Despite this, I've found a couple of pages, with this being the most like what I want:


I like this solution - simple and clean, easy to implement.

My only reservation is that I was under the impression that this information was already being kept and that putting a 

user = ForeignKey("User")

in each model that I want to track is doubling up on the data I'm keeping?

To clarify - I can see the last ten actions I've taken when I'm logged into the admin interface - is this info permanent and easy to access and display on the model DetailView?

cheers

Greg Donald

unread,
Sep 28, 2012, 12:16:29 AM9/28/12
to django...@googlegroups.com
On Thu, Sep 27, 2012 at 10:28 PM, Lachlan Musicman <dat...@gmail.com> wrote:
> I wanted to display the user that last changed a model instance.

I use django-reversion for this:

https://github.com/etianen/django-reversion


--
Greg Donald

Laxmikant Gurnalkar

unread,
Sep 28, 2012, 12:41:16 AM9/28/12
to django...@googlegroups.com
Hello.
       You can Hack the Default models & add new fields in User Table created_datetime, modified_datetime & created by, modified by etc.


Cheers

--
You received this message because you are subscribed to the Google Groups "Django users" group.
To post to this group, send email to django...@googlegroups.com.
To unsubscribe from this group, send email to django-users...@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/django-users?hl=en.



--
GlxGuru

Mike Dewhirst

unread,
Sep 28, 2012, 1:01:11 AM9/28/12
to django...@googlegroups.com
See also Pro Django by Marty Allchin and
https://bitbucket.org/q/django-current-user/src

Mike

Mike Dewhirst

unread,
Sep 28, 2012, 1:24:22 AM9/28/12
to django...@googlegroups.com
On 28/09/2012 3:01pm, Mike Dewhirst wrote:
> On 28/09/2012 2:16pm, Greg Donald wrote:
>> On Thu, Sep 27, 2012 at 10:28 PM, Lachlan Musicman <dat...@gmail.com>
>> wrote:
>>> I wanted to display the user that last changed a model instance.
>>
>> I use django-reversion for this:
>>
>> https://github.com/etianen/django-reversion
>>
>>
>
> See also Pro Django by Marty Allchin and

My apologies - Alchin with one 'l'

> https://bitbucket.org/q/django-current-user/src
>
> Mike
>

Reply all
Reply to author
Forward
0 new messages