43👍
Turns out that the problem here was actually very unrelated to the errors thrown.
I realized I was actually calling
UserObject.objects.get('user@email.com')
instead of
UserObject.objects.get(email='user@email.com')
which is why the errors were being thrown. If you look into the Django source code, you’ll find that when building a filter for a QuerySet
, Django unpacks the field name and data for use in the filter, but since I had provided no field name to objects.get(...)
, there was an error thrown when unpacking.
Used the Werkzeug live browser debugger for this; I highly recommend it.
1👍
You have to implement has_module_perms
method as stated in the Django custom user documentation:
If you want your custom User model to also work with Admin, your User model must define some additional attributes and methods.
- The default "delete selected" admin action in Django
- Python Django custom template tags register.assignment_tag not working
- Load Balancing Multiple Django Webservers
- ValueError: Field 'id' expected a number but got 'Processing'
- Combine prefetch_related and annotate in Django
0👍
May not be useful for this specific problem,
But I got the same error for using a model to populate the form object…
(with different error messages saying formObject does not have 'get' attribute
)
should use form=formObject(instance=modelInstance)
instead of using form=formObject(data=modelInstance)