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

some time lost without FLAVOURS_GET_PARAMETER #54

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

BergSoft
Copy link

@BergSoft BergSoft commented Apr 8, 2015

No description provided.

@gregmuellegger
Copy link
Owner

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?

@shtalinberg
Copy link

flavour was set permanently via GET parameter
but after goto link on this page flavour lost.
P.S. Sorry for my English.

@gregmuellegger
Copy link
Owner

@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

@shtalinberg
Copy link

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',
)

@gregmuellegger
Copy link
Owner

@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.

@shtalinberg
Copy link

yes, I have cookies enabled. but we use session backend
#django-mobile
FLAVOURS_GET_PARAMETER = 'setmode'
FLAVOURS = ('full', 'mobile')
DEFAULT_MOBILE_FLAVOUR = "mobile"
FLAVOURS_COOKIE_KEY = 'setmode'
FLAVOURS_STORAGE_BACKEND = 'session' # Available values: 'session' and 'cookie'.

@gregmuellegger
Copy link
Owner

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?

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

Successfully merging this pull request may close these issues.

3 participants