show different content based on different users! urgent

let’s say i have 2 data entries for user A and 3 data entries for user B. How can I show different content based on different logged in users.

Urgent! Pls thx a lot

Hi,

You can always get a logged-in user instance from the request object. Depending on where you do it, the syntax will differ, though.

If you need to pull it in view, then do something like:

def my_view(request):
	user = request.user

If you are doing it in a template then you can get current user like this:

{{ request.user }}

Those are high-level suggestions, just to give you an idea of which direction to dig.

Let me know if something is not clear.

oh, thank you, but after trying this, i don’t think it show different content based on different users

hey, that doesn’t give you the full solution, I just showed you how to get a user instance, the rest of logic is up to you.

What are you trying to accomplish? I think getting a bit of context would be helpful. Could you provide any code examples?

okay? I am working on it. But do you know why i got a programing error: relation auth_user does not exist when running this command using heroku cli: “heroku run python manage.py migrate”

Looks like you’re missing a migration that creates a user relation. Try to run heroku run python manage.py makemigrations at first.