if you can get the request object you can get the current user with
request.user


On Mon, Apr 18, 2016 at 9:38 PM, Elias Coutinho <coutinho.el...@gmail.com>
wrote:

> Good afternoon people,
>
> I am using django material, LayoutMixin
>
> My view is:
>
> class NewProfissoesPessoaView (LoginRequiredMixin, LayoutMixin,
>                      extra_views.NamedFormsetsMixin,
>                      extra_views.CreateWithInlinesView):
>    title = "New Job"
>    model = ProfissoesPessoa
>
>     print ( 'come on line 334')
>
>     layout = Layout (
>        Row ( 'person', 'profession', 'rating'),
>        # Fieldset ( 'Address'
>        # Row (Span7 ( 'address'), Span5 ( 'zipcode'))
>        # Row (Span5 ( 'city'), Span2 ( 'state'), Span5 ( 'country')))
>        Inline ( 'Qualifications Profession', ItemInline)
>    )
>
>     def form_valid (self, form):
>        print ( 'come on line 343')
>        profession = self.object.save (commit = False)
>        profissao.pessoa = request.user
>        profissao.save ()
>
>     def get_success_url (self):
>        return self.object.get_absolute_url ()
>
>
>
> If you look has form_valid function, I'm trying to get my registration can
> be done without having to manually enter the logged in user.
>
> A View only enter if you login, but when loading the template it does not
> meet the user field. (This field wanted to hide)
>
> As I am using django materials needed to create the forms.py
>
> Can someone help me? All he wanted was to save without informing the user
> logged in, he seve be added without the intervention of anyone.
>
> --
> 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 django-users+unsubscr...@googlegroups.com.
> To post to this group, send email to django-users@googlegroups.com.
> Visit this group at https://groups.google.com/group/django-users.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/django-users/d5d3b9d5-dba6-4361-999c-e0467ad69a3a%40googlegroups.com
> <https://groups.google.com/d/msgid/django-users/d5d3b9d5-dba6-4361-999c-e0467ad69a3a%40googlegroups.com?utm_medium=email&utm_source=footer>
> .
> For more options, visit https://groups.google.com/d/optout.
>

-- 
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 django-users+unsubscr...@googlegroups.com.
To post to this group, send email to django-users@googlegroups.com.
Visit this group at https://groups.google.com/group/django-users.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/CAFWa6tLMZ4MJKYTzqMYWJw9XgPj2_nBMduNUqzpw32FmMac5%2BA%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.
  • request user Elias Coutinho
    • Re: request user Avraham Serour

Reply via email to