make an attribute named "user"

On Fri, Nov 13, 2020 at 2:27 PM Apolo Machine <[email protected]>
wrote:

> I'm trying to get the username within a view(CBV), the documentation I
> found says that the logged user is within the request, but when I do
>
> class ServiceCreateView(LoginRequiredMixin, CreateView):
>           model = Service
>           form_class = ServiceForm
>           user=request.user.username
>
> i get this error
>
> AttributeError: module 'django.http.request' has no attribute 'user
>
> any help is appreciated
>
> --
> 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 view this discussion on the web visit
> https://groups.google.com/d/msgid/django-users/8635848c-b7fc-4b6b-9b53-f6107ce42717n%40googlegroups.com
> <https://groups.google.com/d/msgid/django-users/8635848c-b7fc-4b6b-9b53-f6107ce42717n%40googlegroups.com?utm_medium=email&utm_source=footer>
> .
>

-- 
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 view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/CAAcuwDfBL82t2WebGvYmUEiP%2BCD7tv3aBTL7f%2BrH0igzVUbSuQ%40mail.gmail.com.

Reply via email to