On 2/3/07, Rob Hudson <[EMAIL PROTECTED]> wrote:
>
>     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?

Why not take the example of User (from django.contrib.auth), and put
it in a custom manager? If you want to create a User, you write:

newuser = User.object.create_user(username='foo',...)

which creates a new user with the provided arguments, saves it, and
returns the instance.

Look in django.contrib.auth.models for UserManager for implementation details.

Yours,
Russ Magee %-)

--~--~---------~--~----~------------~-------~--~----~
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