I am trying to connect the default Django User model with another one I made to store extra info. but even after following all the proper steps, I am getting an error. I have spent way to much time trying to figure it out, hopefully, you guys can figure it out and help me. (you probably will you all are much smarter than me)
here is the import command :
from django.contrib.auth.models import User
here is the integration with the premade model:
class User_Info(models.Model):
user = models.OneToOneField(User,null = True, on_delete = models.CASCADE)
here is the view I am using :
def userPage(request):
_user_ = request.user.User_Info.all()
trades = request.user.User_Info.trade_set.all()
total_trades = trades.count()
context = {"_user_" : _user_,"trades" : trades, "total_trades" : total_trades}
return render(request, "accounts/user.html", context)
This is the error I am getting:
AttributeError at /user/
'User' object has no attribute 'User_Info'
Request Method:GET
Request URL:http://127.0.0.1:8000/user/
Django Version:3.1.2Exception
Type:AttributeError
Exception Value:'User' object has no attribute 'User_Info'
if you need any more information let me know I will be more than happy to help!
Thank you for your time! :)