@never_cache
@login_required
def change(request, app_label, model_name, instance_id, mode_name='change',
                                           form_fields=None,
                                           form_exclude=None):

    # Get model, instance_form and instance for arguments
    instance_return = _get_instance(request, mode_name, app_label, model_name,
                                                           instance_id,
                                                           form_fields=form_fields,
                                                           form_exclude=form_exclude)
    if isinstance(instance_return, HttpResponseForbidden):
        return instance_return
    model, instance_form, instance = instance_return

    # Handle cancel request
    cancel = _handle_cancel(request)
    if cancel:
        return cancel

    if request.method == 'POST':
        form = instance_form(request.POST, request.FILES, instance=instance)
        if form.is_valid():
            instance = form.save()
            msg=_(u'Your %(model_name)s was changed successfully') % \
                                {'model_name': model._meta.verbose_name}           
            # Give the user a nice message
            try:
                request.user.message_set.create(message=msg)
            except __HOLE__:
                messages.success(request, msg)
                
            # Return to success page
            if request.is_ajax():
                return success(request)
            return _handle_response(request, instance)
    else:
        form = instance_form(instance=instance)

    template_context = {
        'action': 'change',
        'action_url': request.get_full_path(),
        'model_title': model._meta.verbose_name,
        'form': form,
    }

    return render_to_response(
        _get_template(request, app_label, model_name),
        template_context,
        RequestContext(request)
    )
dataset/ETHPy150Open bartTC/django-frontendadmin/frontendadmin/views.py/change