@login_required def edit_service(request, service_id, template_name="edit-service.html"): context = RequestContext(request)
context['service_id'] = request.COOKIES.get('service_id', None) ... response = render_to_response(template_name, context) response.set_cookie('service_id', service_id) return response On Tue, Oct 3, 2017 at 1:05 AM, ADEWALE ADISA <solixzsys...@gmail.com> wrote: > can you show the code where you set the cookie before retrieving it > On Oct 2, 2017 6:35 PM, "Samuel Muiruri" <muiruri.sam...@gmail.com> wrote: > >> 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/ms >> gid/django-users/fd1f686b-dded-4aaa-8f6b-274419afa0a1%40googlegroups.com >> <https://groups.google.com/d/msgid/django-users/fd1f686b-dded-4aaa-8f6b-274419afa0a1%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 a topic in the > Google Groups "Django users" group. > To unsubscribe from this topic, visit https://groups.google.com/d/ > topic/django-users/mSWmg0HVxz0/unsubscribe. > To unsubscribe from this group and all its topics, 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/CAMGzuy-N_znhTLZqD0zc4ED78pFNAgCH3ns17eY > R3ZR0xOrcyQ%40mail.gmail.com > <https://groups.google.com/d/msgid/django-users/CAMGzuy-N_znhTLZqD0zc4ED78pFNAgCH3ns17eYR3ZR0xOrcyQ%40mail.gmail.com?utm_medium=email&utm_source=footer> > . > > For more options, visit https://groups.google.com/d/optout. > -- Best Regards, Samuel Muiruri. Web Designer | +254 738 940064 -- 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/CAJZFZXojoRK00Pm7_%3D_BLHzEAia44Rifc8DNkg5QZAYeYNtYHA%40mail.gmail.com. For more options, visit https://groups.google.com/d/optout.