ShieldsJohn / Stompbox

0 stars 1 forks source link

BUG: Listings not linked to user #31

Closed ShieldsJohn closed 5 months ago

ShieldsJohn commented 5 months ago

Issue

Users can access the listing form and save a new listing. However, when checking this in django admin, it became clear the listing was not assigned to the user that created it.

Solution

I amended the create_lisiting view a lot in the process of establishing what was going on. As a result of one of the amendments, I got an error saying the user did not have a profile and from there I realised profiles were not associated with their respective users. With the assistance of a fellow Code Institute student, we established both user and profile needed to be separately defined in this view and not in the way that I had it, which was profile=request.user.profile