DEV Community

Discussion on: Django inline formsets with Class-based views and crispy forms

Collapse
 
elisa55516883 profile image
elisa

Haiiii,

I got some bug in this code.please help me to find out.The bug is

ValueError: Cannot assign ">": "Collection.created_by" must be a "User" instance.

Collapse
 
andi1337 profile image
Andreas • Edited

Hey elisa,

I think you have to call localhost:8000/admin and log in as user "admin" and password "admin". If you take a look into the classes CollectionCreate or CollectionUpdate inside views.py then you can see that the created_by field is always set to the user who executed the request. And the variable request.user is only set, if a user is logged in.

Hope that will help you to get the demo running ;-)
Best regards,
andi