On 22/08/2018 9:05 AM, chanman wrote:
I want to have a page look different for users who are logged in and
those who aren't.
This is the "normal" way to do things
For users that are signed in the page will have a sidebar with account
management options. For users who aren't signed in, this sidebar
shouldn't show up. The most obvious way to do this would be to have a
common layout inherited by the member viewable and outsider viewable
pages. But is there a way to do this by having some kind of optional
component on the page?
In the page you would have something like ...
{% if user.has_usable_password %} display side bar with account
management options {% endif %}
The question then becomes how do you get user into the page. You
probably know the answer but in case not, in your view - the first
argument is always request - you include request.user in the rendering
context as 'user' ie., context['user'] = request.user
hth
mike
--
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 django-users+unsubscr...@googlegroups.com
<mailto:django-users+unsubscr...@googlegroups.com>.
To post to this group, send email to django-users@googlegroups.com
<mailto:django-users@googlegroups.com>.
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/88655d5f-e431-4ab6-a957-f0e53097df12%40googlegroups.com
<https://groups.google.com/d/msgid/django-users/88655d5f-e431-4ab6-a957-f0e53097df12%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 django-users+unsubscr...@googlegroups.com.
To post to this group, send email to django-users@googlegroups.com.
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/9cfb0bd6-d2fa-e35b-26b3-56b08fc3c9d7%40dewhirst.com.au.
For more options, visit https://groups.google.com/d/optout.