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
For further actions, you may consider blocking this person and/or reporting abuse
We're a place where coders share, stay up-to-date and grow their careers.
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.
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
orCollectionUpdate
insideviews.py
then you can see that thecreated_by
field is always set to the user who executed the request. And the variablerequest.user
is only set, if a user is logged in.Hope that will help you to get the demo running ;-)
Best regards,
andi