Open BergSoft opened 9 years ago
flavour was set permanently via GET parameter but after goto link on this page flavour lost. P.S. Sorry for my English.
@shtalinberg Hi, sorry I don't exactly understand in which cases it is breaking for you. Can you give an example of URLs that is triggering the problem and your settings.MIDDLEWARE_CLASSES
setting?
An example of URLs would be:
http://localhost:8000/articles/post/ # shows full flavour
http://localhost:8000/articles/post/?flavour=mobile # shows mobile flavour
http://localhost:8000/articles/post/ # shows full flavour again, but should show mobile
yes - the problem is as you have described in example
my MIDDLEWARE_CLASSES = ( 'corsheaders.middleware.CorsMiddleware', 'subdomains.middleware.SubdomainURLRoutingMiddleware', 'django.middleware.common.CommonMiddleware', 'django.contrib.sessions.middleware.SessionMiddleware', 'django.middleware.csrf.CsrfViewMiddleware', 'django.contrib.auth.middleware.AuthenticationMiddleware', ......... my apps 'django.contrib.messages.middleware.MessageMiddleware', 'django_mobile.middleware.MobileDetectionMiddleware', 'django_mobile.middleware.SetFlavourMiddleware', ......... my apps 'django.middleware.clickjacking.XFrameOptionsMiddleware', )
@shtalinberg Ok that looks correct. You need to have cookies enabled to make that work.
Please check if you have a cookie with the name flavour
set after you have set the flavour with ?flavour=mobile
.
yes, I have cookies enabled. but we use session backend
FLAVOURS_GET_PARAMETER = 'setmode' FLAVOURS = ('full', 'mobile') DEFAULT_MOBILE_FLAVOUR = "mobile" FLAVOURS_COOKIE_KEY = 'setmode' FLAVOURS_STORAGE_BACKEND = 'session' # Available values: 'session' and 'cookie'.
Hm ok, that looks good so far.
Can you somehow check that the 'flavour'
key is set in your session after you have visited a site with the ?flavour=...
GET parameter?
Hi, it is intended that the flavour is not set permanently if you don't do so explicitly with the GET paramter. The reason is that you don't lock in users into one flavour forever, but allow to adjust the target with a custom
MobileDetectionMiddleware
when you go along.In which cases did you have trouble when the flavour was not set permanently?