Changes between Version 10 and Version 11 of CookBookNewformsAdminAndUser


Ignore:
Timestamp:
08/09/2008 04:01:39 PM (7 years ago)
Author:
oyvind
Comment:

--

Legend:

Unmodified
Added
Removed
Modified
  • CookBookNewformsAdminAndUser

    v10 v11  
    3333    inlines = [CommentInline]
    3434
    35     def save_model(self, request, form, change):
     35    def save_form(self, request, form, change):
    3636
    3737        instance = form.save(commit=False)
    3838
    3939        instance.user = request.user
    40         instance.save()
    41 
    42         form.save_m2m()
    43        
     40       
    4441        return instance
    4542
     
    4845        instances = formset.save(commit=False)
    4946
    50         for instance in instances:
     47        def set_user(instance):
     48            instance.user = request.user
    5149
    52             instance.user = request.user
    53             instance.save()
    54 
    55         formset.save_m2m()
     50        return map(set_user, instances)
    5651
    5752admin.site.register(Post, PostModelAdmin)
Back to Top