Friday, April 15, 2022

Re: Filtering User Data/Records

On Thu, Apr 07, 2022 at 01:08:19PM +0300, tech george wrote:
> I am trying to filter my medicine stock data so that Pharmacist 1 can only
> view their records but not Pharmacist 's 2 records.
>
> So far nothing is filtered and all the pharmacists can see all the
> available records, Please advise.

I'm assuming the view you're having problems with is manageStock3. You
probably want to filter stocks based on the pharmacist that is logged in. Try
something like:

stocks = Stock.objects.filter(pharmacist_id=request.user)

--
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+unsubscribe@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/django-users/20220415180258.GB15520%40fattuba.com.

No comments:

Post a Comment