please send  your http header. Look like auth header is present by  browser
default

<https://www.avast.com/sig-email?utm_medium=email&utm_source=link&utm_campaign=sig-email&utm_content=webmail>
Вірусів
немає. www.avast.com
<https://www.avast.com/sig-email?utm_medium=email&utm_source=link&utm_campaign=sig-email&utm_content=webmail>
<#DDB4FAA8-2DD7-40BB-A1B8-4E2AA1F9FDF2>

Many thanks,

Serge


+380 636150445
skype: skhohlov

On Thu, Jun 16, 2016 at 8:29 PM, Lee Hinde <leehi...@gmail.com> wrote:

> I always assume it's me. That was some errant copy and paste.
>
> Thanks!
>
> On Wed, Jun 15, 2016 at 11:51 PM, Babatunde Akinyanmi <
> tundeba...@gmail.com> wrote:
>
>> Actually it's you. Please see inline:
>>
>> On Jun 15, 2016 11:56 PM, "Lee Hinde" <leehi...@gmail.com> wrote:
>> >
>> > Using Django 1.9.7.
>> >
>> > I have the following class:
>> >
>> > class AddView(LoginRequiredMixin, CreateView):
>> >     template_name = "entry.html"
>> >     model = Property
>> >     form_class = AddPropertyForm
>> >     success_url = "/buy/"
>> >     login_url = '/account/login/'
>> >
>>
>> Consider your code for `dispatch`
>> >     def dispatch(self, request, *args, **kwargs):
>> >         print request.user
>> >         print request.user.is_authenticated()
>> >         return super(AddView, self).post(request, *args, **kwargs)
>> >
>> You have bypassed `LoginRequiredMixin` implementation of `dispatch` and
>> there's where the login logic is done. You should be returning a super call
>> to `dispatch` not `post`. If you are actually trying to force all requests
>> into POSTs (which I doubt), you are better off doing it in the `get`
>> method.
>>
>> >     def form_valid(self, form):
>> >         ls_property = form.save(commit=False)
>> >         ls_property.user = get_user(self.request)
>> >         ls_property.latitude = form.cleaned_data['latitude']
>> >         ls_property.longitude = form.cleaned_data['longitude']
>> >         submit =  form.cleaned_data['submit']
>> >         ls_property.visible = (submit != 'draft')
>> >         ls_property.save()
>> >         return super(AddView, self).form_valid(form)
>> >
>> >
>> > The LoginRequiredMixin is ignored, i.e, I can get to the page without
>> being logged in.
>> >
>> > request.user reports: AnonymousUser
>> > request.user.is_authenticated() reports: False
>> >
>> > If I wrap the url:
>> >
>> > url(r'^sell', user_passes_test(user_is_active)(AddView.as_view()),
>> name="add"),
>> >
>> > the page is protected, so I have a work around.
>> >
>> > This seems basic and I don't find other reports of LoginRequiredMixin
>> not working, so I assume it's me.
>> >
>> > What am I missing?
>> >
>>
> --
> 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/CA%2BePoMwMHRW6cEbzPypBhTnGCRJ7W0nGE%2BvaQ_ytmA_D2WhiSg%40mail.gmail.com
> <https://groups.google.com/d/msgid/django-users/CA%2BePoMwMHRW6cEbzPypBhTnGCRJ7W0nGE%2BvaQ_ytmA_D2WhiSg%40mail.gmail.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/CADTRxJMCA8NRG9hVtg%3DMDXiwCLrcwfeuw3tUXFqbenrxqwqdTA%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to