Ticket #2859: create_update.diff

File create_update.diff, 1.1 KB (added by anonymous, 18 years ago)

Patch

  • django/views/generic/create_update.py

     
    7070            c[key] = value
    7171    return HttpResponse(t.render(c))
    7272
    73 def update_object(request, model, object_id=None, slug=None,
     73def update_object(request, model, queryset=None, object_id=None, slug=None,
    7474        slug_field=None, template_name=None, template_loader=loader,
    7575        extra_context=None, post_save_redirect=None,
    7676        login_required=False, follow=None, context_processors=None,
     
    9898    else:
    9999        raise AttributeError("Generic edit view must be called with either an object_id or a slug/slug_field")
    100100    try:
    101         object = model.objects.get(**lookup_kwargs)
     101        if queryset:
     102            object = queryset.get(**lookup_kwargs)
     103        else:
     104            object = model.objects.get(**lookup_kwargs)
    102105    except ObjectDoesNotExist:
    103106        raise Http404, "No %s found for %s" % (model._meta.verbose_name, lookup_kwargs)
    104107
Back to Top