Changes between Version 14 and Version 15 of CookBookNewformsAdminAndUser


Ignore:
Timestamp:
08/12/2008 10:19:53 AM (7 years ago)
Author:
oyvind
Comment:

--

Legend:

Unmodified
Added
Removed
Modified
  • CookBookNewformsAdminAndUser

    v14 v15  
    3333    inlines = [CommentInline]
    3434
    35     def save_form(self, request, form, change):
     35    def save_model(self, request, form, change):
    3636
    3737        instance = form.save(commit=False)
    3838
    3939        instance.user = request.user
    40        
     40
     41        instance.save()
     42
    4143        return instance
    4244
    4345    def save_formset(self, request, form, formset, change):
    4446
    45         instances = formset.save(commit=False)
    46 
    4747        def set_user(instance):
    4848            instance.user = request.user
     49            instance.save()
    4950
    5051        if formset.__name__ == 'CommentInline':
     52            instances = formset.save(commit=False)
    5153            return map(set_user, instances)
    5254        else:
    53             return instances
     55            return formset.save()
    5456
    5557admin.site.register(Post, PostModelAdmin)
Back to Top