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

Django, inline conditionals - best way? #88

Closed
aaroncaito opened this issue Mar 19, 2013 · 2 comments
Closed

Django, inline conditionals - best way? #88

aaroncaito opened this issue Mar 19, 2013 · 2 comments

Comments

@aaroncaito
Copy link

Is this the best way to do this?

  - var auth_status = ""
  if user.is_authenticated
    auth_status = "loggedin"

  body(class='#{auth_status}')
    .wrapper
      include includes/header
      .container
        .main-content
          .main-head
            block main
          block content
    include includes/footer
@syrusakbary
Copy link
Owner

Try this:

  auth_status = ""
  if user.is_authenticated
    auth_status = "loggedin"

  body(class=auth_status)
    .wrapper
      include includes/header
      .container
        .main-content
          .main-head
            block main
          block content
    include includes/footer

@aaroncaito
Copy link
Author

so there isn't really a way to do it on the body line then?
body(class!='if user.is_authenticated: {loggedin} else{''}') sort of thing

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

No branches or pull requests

2 participants