I have a site that relies on checking if a cookie exists for service_id and 
if it does checks if you can upload files for service... this works nicely 
offline but on pushing changes to server it created a bug where even though 
the cookie can be seen (on the dev console)

[image: enter image description here] <https://i.stack.imgur.com/zx6Ir.png>

and I assign the cookie to a context variable which ends up saying None even 
though I can see the cookie from the dev console.

class PictureCreateView(CreateView):
    model = Picture
    fields = "__all__"
    template_name = 'accounts/upload-file.html'

    def get_context_data(self, **kwargs):

        context = super(PictureCreateView, self).get_context_data(**kwargs)
        context['service_id'] = self.request.COOKIES.get('service_id', None)

        return context

on the template

{% if service_id %}
    #display form{% else %}
    Sorry it seems you're missing some vital data needed before ...
{% endif %}

any ideas?

here's a screen record (local & live): https://youtu.be/aud59Avp1aI

-- 
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/fd1f686b-dded-4aaa-8f6b-274419afa0a1%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to