Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Feature request] Configuration to customize or disable the page /cookies/ #114

Open
cdutr opened this issue Jan 22, 2024 · 3 comments
Open

Comments

@cdutr
Copy link

cdutr commented Jan 22, 2024

I installed django-cookie-consent on a website and tried to disable the main page on [site-url]/cookies/, but the code stops working. I can not translate it as well.

I suggest we have a logic to allow the website to disable this page, or customize it.

Maybe it is already possible, but I couldn't find anything related in the documentation. If it is, I would appreciate some help.

@some1ataplace
Copy link
Contributor

some1ataplace commented Jan 30, 2024

For now you can try overriding the URLs yourself or redirect your user somewhere else if they try to access that page. Add URL entries like these to urls.py before including django-cookie-consent urls.

from django.urls import path, re_path
from django.views.generic import TemplateView, RedirectView

urlpatterns = [
    # These URLs shadow django-cookie-consent URLs to shut them down:
    path('cookies/', RedirectView.as_view(url='/')),
]

Source:
https://stackoverflow.com/questions/14959217/django-url-redirect

It would not be a bad idea though to implement a True/False setting that disables the cookies URL.

@cdutr
Copy link
Author

cdutr commented Jan 30, 2024

I tried this, but the cookie logic stops working. Apparently the lib depends on the site.com/cookies URL being available and sending to the cookies page.

@sergei-maertens
Copy link
Collaborator

sergei-maertens commented Apr 5, 2024

I will look into this in the next few weeks!

The approach where you manage the URL conf yourself is favourable, as that is just a standard django mechanism and gives you as developer full control when you need it, but indeed, if there's other code that's reversing this URL, then that should be more decoupled.

Do you have a traceback for the situation where "the cookie logic stops working"?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants