Re: RelatedObjectDoesNotExist: User has no vendor

2021-06-09 Thread Indu Chouhan
Hi , You can also try this. vendor = User.objects.get(pk=request.user.id).vender Thanks, Indu Chouhan On Wednesday, June 9, 2021 at 12:44:14 PM UTC+5:30 gwisum...@gmail.com wrote: > Hi Every one! I 'm looking for help. > > I'm working with a multi vendor website using django. But there is

Re: RelatedObjectDoesNotExist: User has no vendor

2021-06-09 Thread Lalit Suthar
vendor = Vendor.objects.get(created_by=request.user) you have to pick vendor like this On Wed, 9 Jun 2021 at 15:43, GWISU MANYANDA wrote: > thank you Lalit for you respond > I have changed this line > > vendor = request.user.vendor > > to > > user = vendor.created_by > > Now i'm getting this

Re: RelatedObjectDoesNotExist: User has no vendor

2021-06-09 Thread GWISU MANYANDA
thank you Lalit for you respond I have changed this line vendor = request.user.vendor to user = vendor.created_by Now i'm getting this error NameError at /maduka/vendor_admin/ name 'vendor' is not defined On Wed, Jun 9, 2021 at 11:10 AM Lalit Suthar wrote: > coming because of `vendor =

Re: RelatedObjectDoesNotExist: User has no vendor

2021-06-09 Thread Lalit Suthar
coming because of `vendor = request.user.vendor` you have attached user to vendor so you can access user from vendor by doing `user = vendor.created_by` but you can not access vendor from user On Wed, 9 Jun 2021 at 12:43, GWISU MANYANDA wrote: > Hi Every one! I 'm looking for help. > > I'm

RelatedObjectDoesNotExist: User has no vendor

2021-06-09 Thread GWISU MANYANDA
Hi Every one! I 'm looking for help. I'm working with a multi vendor website using django. But there is an issue that I have vendor object vendor but it says User has no vendor. Why is this happening and how may I solve this? *MY model* from django.contrib.auth.models import Userfrom django.db