Re: set current user value in Django admin for Foreign Key

2014-12-11 Thread Collin Anderson
Hi, I agree excluding it from the form is the way to go and setting it in one of the save_* methods. But, couldn't you also do _both_ of your methods :) Collin On Wednesday, December 10, 2014 3:38:48 AM UTC-5, Akshay Mukadam wrote: > > Hi, > I just want to show the current logged in user in fo

Re: set current user value in Django admin for Foreign Key

2014-12-10 Thread Vijay Khemlani
Hmmm... why are you showing the user field in the first place? I would exclude it from the form and set it programatically after the user as submitted the form. On Wed, Dec 10, 2014 at 5:38 AM, Akshay Mukadam wrote: > Hi, > I just want to show the current logged in user in for foreign key in > D

set current user value in Django admin for Foreign Key

2014-12-10 Thread Akshay Mukadam
Hi, I just want to show the current logged in user in for foreign key in Django admin. Following are the approach used buy me: 1-> def formfield_for_foreignkey(self, db_field, request, **kwargs): if db_field.name == "user": "set the current user as a default value for drop dow