Reputation: 41
When overriding the django save_model method, how do I extract the key value. Let's say the admin page has a input for the key "name". How do I extract that value in the method:
def save_model(self, request, obj, form, change):
//request.name?
Upvotes: 0
Views: 408
Reputation: 21844
You can access a field by making use of form.cleaned_data
, like this:
def save_model(self, request, obj, form, change):
name = form.cleaned_data['name']
# ...
Upvotes: 1