You don't want to save the user id explicitly. Your model should be

updater = models.ForeignKey(User)

Since you'll be setting the updater (or some other better word) from  
within a view, you'll have access to the currently logged-in user.  
Just do

foo.updater = request.user

and you're good to go.

Todd

On Jun 13, 2006, at 7:09 PM, Nuno Mariz wrote:

>
> Ok, I agree.
> But if I want to save the ID of the user logged-in in a field in my
> table, I can't.
>
> Basically in almost of my tables I will have this fields:
> ip (IP Address)
> last_update (Record last update)
> user_id (User id that make the change)
>
> Don Arbow wrote:
>> On Jun 13, 2006, at 7:58 AM, [EMAIL PROTECTED] wrote:
>>
>>> I have a problem then.
>>> I just need to test if a user have permission to edit a field in
>>> Admin.
>>>
>>
>>
>>
>> Then in the view that calls the template, you determine if the user
>> is authorized to edit the field. You can test the authorization in
>> the view to prevent the user from seeing the template or test it in
>> the template to prevent the user from editing the field.
>>
>> Seriously, you don't want to hard code permissions into a model.
>> Whenever the permission requirements change you'll have to change
>> your model.
>>
>> Take a look at (specifically the Permissions section)
>>
>> http://www.djangoproject.com/documentation/authentication/
>>
>> Don
>
> >


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

Reply via email to