A slight variation of this approach is to map some Django template context info to Javascript variables in one of your templates, making that data accessible to your compressed / minified JS code:
# in a template, "base.html" perhaps..
<script>
window.DjangoContext = {
userLoggedIn: {{ user.is_authenticated|yesno:"true,false" }}
}
</script>
Note the use of the 'yesno' filter to convert "True" to "true" to match JS syntax.
Now you can access DjangoContext.userLoggedIn anywhere in your JS.
** It's important to note that users can modify any JS variable they wish, so don't rely on something like this for security **