View to modify an existing manager.
    Parameters:
        request is an HTTP request
        managerTitle is URL title of the manager.
422502
def edit_manager_view(request, managerTitle):
    ''' 
    '''
    targetManager = get_object_or_404(Manager, url_title=managerTitle)
    form = ManagerForm(
        request.POST or None,
        instance=targetManager,
        )
    if form.is_valid():
        manager = form.save()
        messages.add_message(request, messages.SUCCESS,
                             MESSAGES['MANAGER_SAVED'].format(managerTitle=manager.title))
        return HttpResponseRedirect(reverse('managers:meta_manager'))
    return render_to_response('edit_manager.html', {
        'page_name': "Admin - Edit Manager",
        'form': form,
        "managerset": Manager.objects.all(),
        'manager_title': targetManager.title,
        }, context_instance=RequestContext(request))
1001003
def changelist_view(self, request, extra_context=None):
        
        model = self.model
        if model.objects.all().count() > 1:
            return super(HTMLSitemapAdmin, self).changelist_view(request)
        else:
            obj = model.singleton.get()
            return redirect(reverse('admin:jmbo_sitemap_%s_change' % \
                    model._meta.module_name, args=(obj.id,)))
776864
def add_event_view(request):
    
    is_events_admin = request.user.has_admin_permission('events')
    if not is_events_admin:
        return redirect("request_event")

    if request.method == "POST":
        form = EventForm(data=request.POST, all_groups=request.user.has_admin_permission('groups'))
        logger.debug(form)
        if form.is_valid():
            obj = form.save()
            obj.user = request.user
            # SAFE HTML
            obj.description = safe_html(obj.description)

            # auto-approve if admin
            obj.approved = True
            obj.approved_by = request.user
            messages.success(request, "Because you are an administrator, this event was auto-approved.")
            obj.created_hook(request)

            obj.save()
            return redirect("events")
        else:
            messages.error(request, "Error adding event.")
    else:
        form = EventForm(all_groups=request.user.has_admin_permission('groups'))
    context = {"form": form, "action": "add", "action_title": "Add" if is_events_admin else "Submit", "is_events_admin": is_events_admin}
    return render(request, "events/add_modify.html", context)
13310
def founditem_modify_view(request, item_id=None):
    
    if request.method == "POST":
        founditem = get_object_or_404(FoundItem, id=item_id)
        form = FoundItemForm(request.POST, instance=founditem)
        if form.is_valid():
            obj = form.save()
            logger.debug(form.cleaned_data)
            # SAFE HTML
            obj.description = safe_html(obj.description)
            obj.save()
            messages.success(request, "Successfully modified found item.")
            return redirect("founditem_view", obj.id)
        else:
            messages.error(request, "Error adding found item.")
    else:
        founditem = get_object_or_404(FoundItem, id=item_id)
        form = FoundItemForm(instance=founditem)

    context = {"form": form, "action": "modify", "id": item_id, "founditem": founditem}
    return render(request, "lostfound/founditem_form.html", context)
517561
public static function updateTitle()
    {
        if (Yii::$app instanceof Application === true && Yii::$app->request->get('page') !== null) {
            Yii::$app->view->title .= Yii::t(
                'plugin',
                ' - Page {page}',
                ['page' => (int)Yii::$app->request->get('page')]
            );
        }
    }
269948
def convert_http_request(request, referrer_host=None):
    '''
    '''
    new_request = urllib.request.Request(
        request.url_info.url,
        origin_req_host=referrer_host,
    )

    for name, value in request.fields.get_all():
        new_request.add_header(name, value)

    return new_request
508128
def announcements_view(request):
    '''  '''
    page_name = "Manager Announcements"
    userProfile = UserProfile.objects.get(user=request.user)
    announcement_form = None
    manager_positions = Manager.objects.filter(incumbent=userProfile)
    if manager_positions:
        announcement_form = AnnouncementForm(
            request.POST if "post_announcement" in request.POST else None,
            profile=userProfile,
            )
    if announcement_form and announcement_form.is_valid():
        announcement_form.save(request)
        return HttpResponseRedirect(reverse('managers:announcements'))

    # A pseudo-dictionary, actually a list with items of form:
    # (announcement, announcement_pin_form)
    announcements_dict = list()
    for a in Announcement.objects.filter(pinned=True):
        pin_form = None
        if (a.manager.incumbent == userProfile) or request.user.is_superuser:
            pin_form = PinForm(
                request.POST if "pin-{0}".format(a.pk) else None,
                instance=a,
                )
            if pin_form.is_valid():
                pin_form.save()
                return HttpResponseRedirect(reverse('managers:announcements'))
        announcements_dict.append((a, pin_form))
    # Oldest genesis of an pinned announcement to be displayed.
    within_life = now() - timedelta(hours=settings.ANNOUNCEMENT_LIFE)
    for a in Announcement.objects.filter(pinned=False, post_date__gte=within_life):
        pin_form = None
        if request.user.is_superuser or (a.manager.incumbent == userProfile):
            pin_form = PinForm(
                request.POST if "pin-{0}".format(a.pk) else None,
                instance=a,
                )
        announcements_dict.append((a, pin_form))
    return render_to_response('announcements.html', {
        'page_name': page_name,
        'manager_positions': manager_positions,
        'announcements_dict': announcements_dict,
        'announcement_form': announcement_form,
        }, context_instance=RequestContext(request))
200285
def change_view(self, request, object_id, **kwargs):
        
        page = get_object_or_404(Page, pk=object_id)
        content_model = page.get_content_model()

        kwargs.setdefault("extra_context", {})
        kwargs["extra_context"].update({
            "hide_delete_link": not content_model.can_delete(request),
            "hide_slug_field": content_model.overridden(),
        })

        return super(PageAdmin, self).change_view(request, object_id, **kwargs)
1185078
def edit(request, translation):
	
	translation = get_object_or_404(FieldTranslation, id=translation)
	if request.method == 'POST':
		if "cancel" in request.POST:
			return HttpResponseRedirect(reverse("modeltranslation:view_all_url",args=(translation.lang,"all")))
		elif "save" in request.POST:
			form = FieldTranslationForm(request.POST, instance=translation)
			valid_form = form.is_valid()
			if valid_form:
				translation = form.save(commit=False)
				translation.context = u"Admin. Traducciones"
				translation.save()
				return HttpResponseRedirect(reverse("modeltranslation:view_all_url",args=(translation.lang,"all")))
		else:
			form = FieldTranslationForm(instance=translation)
	else:
		form = FieldTranslationForm(instance=translation)

	LANGUAGES = dict(lang for lang in settings.LANGUAGES)
	language = LANGUAGES[translation.lang]
	
	return render_to_response('modeltranslation/admin/edit_translation.html',{"translation":translation, "form":form, "lang":translation.lang, "language":language}, RequestContext(request))
630077
def update_data_request(data_request_id, update_submission_data_request_data, opts = {})
      data, _status_code, _headers = update_data_request_with_http_info(data_request_id, update_submission_data_request_data, opts)
      data
    end
627716
def modify(self, view):
        
        view.params['extra_context'][self.get['name']] = self.get['value']
        return view
1139669
def add_manager(self, manager):
        
        select_action = 'add_manager'

        self._update_scope_project_team(select_action=select_action, user=manager, user_type='manager')
238165
def get_main_title(self, path_name, request_name):
        '''
        
        '''
        main_title = '.. http:{}:: {}'.format(request_name, path_name)
        self.write(main_title)
        self.write('')
703968
def put(self, request, id=None, **kwargs):
        
        if id:
            obj = get_object_or_404(self.queryset(request), id=id)
            if not self.has_update_permission(request, obj):
                return HttpResponseForbidden(_('You do not have permission to perform this action.'))
            else:
                return self.update_object(request, obj)
        else:
            # No putting on a collection.
            return HttpResponseForbidden()
1172789
def change_view(self, request, object_id, extra_context=None):
        """"""
        language = get_language_from_request(request)
        extra_context = {
            'language': language,
            # don't see where it's used
            #'lang': current_lang,
            'page_languages': settings.PAGE_LANGUAGES,
        }
        try:
            int(object_id)
        except ValueError:
            raise Http404('The "%s" part of the location is invalid.'
                % str(object_id))
        try:
            obj = self.model.objects.get(pk=object_id)
        except self.model.DoesNotExist:
            # Don't raise Http404 just yet, because we haven't checked
            # permissions yet. We don't want an unauthenticated user to be able
            # to determine whether a given object exists.
            obj = None
        else:
            template = get_template_from_request(request, obj)
            extra_context['placeholders'] = get_placeholders(template)
            extra_context['traduction_languages'] = [l for l in
                settings.PAGE_LANGUAGES if Content.objects.get_content(obj,
                                    l[0], "title") and l[0] != language]
        extra_context['page'] = obj
        return super(PageAdmin, self).change_view(request, object_id,
                                                        extra_context=extra_context)
762226
def request(self, cmd, *args, **kwargs):
        
        params = {'action': cmd}
        #TODO: serialize the kwargs?
        params.update(kwargs)
        return self.__request(self.url, params)
811866
def patch(query_url,
              headers: {},
              parameters: {})
      HttpRequest.new(HttpMethodEnum::PATCH,
                      query_url,
                      headers: headers,
                      parameters: parameters)
    end