On Tue, Jan 22, 2013 at 8:01 PM, Fellipe Henrique wrote:
> The problem is, I need to pass this request.user to one form, using a
> inlineformset_factory..in these code:
>
> class PedidoItensForm(ModelForm):
> class Meta:
> model = ItensPedido
>
> def
> I don`t understand that.. in my form, I don't have the request, or I have?
>
> I know I have request in my view, but I need to pass UserProfile to my form,
> but inlineformset_factory doesn't accept to pass vUserProfile as parameter,
> even I modified __init__ to get this parameter.
OK, so
I don`t understand that.. in my form, I don't have the request, or I have?
I know I have request in my view, but I need to pass UserProfile to my
form, but inlineformset_factory doesn't accept to pass vUserProfile as
parameter, even I modified __init__ to get this parameter.
Here is my form
vUserProfile=request.user.profile
or
vUserProfile=request.user.get_profile()
to be more flexible
On Tue, Jan 22, 2013 at 5:01 PM, Fellipe Henrique wrote:
> The problem is, I need to pass this request.user to one form, using a
> inlineformset_factory..in these code:
>
>
The problem is, I need to pass this request.user to one form, using a
inlineformset_factory..in these code:
class PedidoItensForm(ModelForm):
class Meta:
model = ItensPedido
def __init__(self, *args, **kwargs):
profile = kwargs.pop('vUserProfile', None)
what mengu says is good for templates, but not so for views.
But lo! your request should have a .user property that points to the
currently logged user, so try
request.user
in your view
On Tue, Jan 22, 2013 at 4:49 PM, Mengu wrote:
> hi fellipe,
>
> if you enable auth
hi fellipe,
if you enable auth context processors and pass in RequestContext to
render_to_response you can always access the user in your templates
which also means you can access the associated profile as user.profile
(assuming your model is named profile)
please read more at
Hello,
It's possible, when the user make a login, I set one "global" variable, and
get this value in my view?
My question is because I have a inlineformset_factory, and I need to pass a
user profile do my view.. but it`s doesn't work.
Regards,
T.·.F.·.A.·. S+F
*Fellipe Henrique P. Soares*
8 matches
Mail list logo