You could, on your views, get the DEBUG setting (using django.conf) and pass it 
to the templates, as you do with all other variable.

________________________________
From: [email protected] <[email protected]> on behalf 
of Alexander Joseph <[email protected]>
Sent: Monday, April 23, 2018 10:55:52 AM
To: Django users
Subject: Re: if statement for development/production mode in templates?

I dont know what that means

On Monday, April 23, 2018 at 7:49:25 AM UTC-6, [email protected] wrote:
On Mon, Apr 23, 2018 at 9:34 AM, Alexander Joseph
<[email protected]> wrote:
> Hello, is there a way to make an if statement that is based on whether you
> are running in development mode or production mode? Or based on which
> settings file you are using?
>
> My app allows users to login with their office365 account instead of with
> django allauth and I'd like to only give them that option, however I do need
> to login with allauth while developing because the settings for logging in
> to Office365 dont work with a development server. So I'd like to display the
> allauth login form and allow the user to login if it is in development mode,
> otherwise I'd only like to display the Office365 login.

Just pass in something in the context from the server to the template
and test that.

--
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 
[email protected]<mailto:[email protected]>.
To post to this group, send email to 
[email protected]<mailto:[email protected]>.
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/5aae6def-df66-40a1-90cc-733b2afa22b1%40googlegroups.com<https://groups.google.com/d/msgid/django-users/5aae6def-df66-40a1-90cc-733b2afa22b1%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 the Google Groups 
"Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To post to this group, send email to [email protected].
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/DM5PR18MB14191215E1DA33E55F88F380AE890%40DM5PR18MB1419.namprd18.prod.outlook.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to