Hi,

The form doesn't have access to the current user. I'd attach it using the 
view.

Thanks,
Collin

On Wednesday, February 25, 2015 at 3:53:40 AM UTC-5, Mike wrote:
>
> Hi,
> I have created modelFormset using SchoolHistory model and SchoolForm form.
>
> "SchoolFormSet = modelformset_factory(SchoolHistory, form=SchoolForm)"
>
> I get other content from Form, but should save current user to 
> SchoolHistory model too.
>   
>     user=models.ForeignKey(User)
>     school_name = models.CharField(max_length = 100)
>     rating_average = models.PositiveIntegerField()
>
> I am overriding is_valid or save in order to save user field. 
> My question is how to find current user in model or form level as there is 
> no request parameter available ( request.user).
> request was available in Formset level but I cannot save user to each 
> record there, or could I?
>
> -Thanks
>
>
>
>

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To post to this group, send email to [email protected].
Visit this group at http://groups.google.com/group/django-users.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/6a149437-2dd6-4d5c-bcce-a304b9fcbcbd%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to