Changes between Version 10 and Version 11 of CookBookNewformsAdminAndUser
- Timestamp:
- Aug 9, 2008, 4:01:39 PM (16 years ago)
Legend:
- Unmodified
- Added
- Removed
- Modified
-
CookBookNewformsAdminAndUser
v10 v11 33 33 inlines = [CommentInline] 34 34 35 def save_ model(self, request, form, change):35 def save_form(self, request, form, change): 36 36 37 37 instance = form.save(commit=False) 38 38 39 39 instance.user = request.user 40 instance.save() 41 42 form.save_m2m() 43 40 44 41 return instance 45 42 … … 48 45 instances = formset.save(commit=False) 49 46 50 for instance in instances: 47 def set_user(instance): 48 instance.user = request.user 51 49 52 instance.user = request.user 53 instance.save() 54 55 formset.save_m2m() 50 return map(set_user, instances) 56 51 57 52 admin.site.register(Post, PostModelAdmin)