[Django]-'Member' object has no attribute 'all'

10👍

If you check proper django docs section, you can see that

get()

get(**kwargs)

Returns the object matching the given lookup parameters

which means it returns an object in proper case not queryset, but form needs queryset so instead of using get method use filter.

self.fields['mem_name'].queryset = Member.objects.filter(user=self.user)

4👍

I assume its because you’re not assigning a queryset to the mem_name queryset.

Use filter instead of get

Member.objects.filter(user=self.user)

Although at this point, I wonder why you need a queryset at all, it would make more sense to exclude this field from the form, then set the user before saving the instance.

👤Sayse

Leave a comment