@login_required
def edit_media(request, media_id, media_type='image'):
    media, media_format = _get_media_info(media_id, media_type)

    check_media_permissions(media, request.user, 'change')

    if media_type == 'image':
        media_form = _init_media_form(ImageForm, request, media,
                                      ('locale', 'title'))
    else:
        raise Http404

    if request.method == 'POST' and media_form.is_valid():
        media = media_form.save(update_user=request.user, is_draft=False)
        return HttpResponseRedirect(
            reverse('gallery.media', args=[media_type, media_id]))

    return render(request, 'gallery/edit_media.html', {
        'media': media,
        'media_format': media_format,
        'form': media_form,
        'media_type': media_type})
Test that we can hack posts in on the fly'
dataset/ETHPy150Open mozilla/kitsune/kitsune/gallery/views.py/edit_media--crossover with--dataset/ETHPy150Open opencivicdata/pupa/pupa/tests/scrape/test_people_org_scrape.py/test_org_add_post