d33tah
d33tah

Reputation: 11569

How to create a "created by" field that non-admin users cannot change?

I am looking for a way to create an added_by field to a Django admin model that is set to the currently logged in Django admin user and can only be changed by admins (so that users can only create items that claim to be added by themselves). I would welcome solutions that rely on external libraries. How can I achieve that functionality?

Upvotes: 0

Views: 37

Answers (1)

Rob L
Rob L

Reputation: 3734

You could make a Creator object that has an FK relationship to the model in question. And only give admins access to change that object.

Upvotes: 1

Related Questions