22.2.3 Profile Update
A user profile is meaningless if the user can’t control it, and so we create ProfileUpdate
for users to change their profile as they see fit.
Thanks to ProfileGetObjectMixin
, creating the view is very simple. We also gain the benefit of our own UpdateView
GCBV, as shown in Example 22.13.
26 from core.utils import UpdateView . ... 134 @class_login_required 135 class ProfileUpdate( 136 ProfileGetObjectMixin, UpdateView): 137 fields = ('about',) 138 model = Profile
Unlike with many of our other UpdateView
subclasses, we are not setting the form_class
attribute and are instead using the fields
attribute. ...
Get Django Unleashed now with the O’Reilly learning platform.
O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.