I have a model called "Log" which logs access to certain pages or sets
variables that we're tracking.

The way I'm inserting new records into the log table is like this:

    Log(user=request.user, session=request.session.session_key,
varname='somename').save()

But I'm finding that I'm writing the above line in a number of
places.  I'd like to create a method to do this for me.  But where?

I thought about putting it in the model but can it be a method of Log
itself?  Can I call something like Log.set_log(request, varname)?
Would this need to call __init__ or something?

If not, would it make sense in the view file of the code that's using
it?  It's really not a "view" itself.

Thanks for any advice.

-Rob


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

Reply via email to