View for a manager to edit the details of a particular RegularWorkshift.
501071
def edit_shift_view(request, semester, pk, profile=None):
    
    shift = get_object_or_404(RegularWorkshift, pk=pk)

    if shift.is_manager_shift:
        # XXX: Bad way of doing this, we should make manager_shift point to
        # the related Manager object directly
        try:
            manager = Manager.objects.get(title=shift.workshift_type.title)
        except Manager.DoesNotExist:
            pass
        else:
            return HttpResponseRedirect(manager.get_edit_url())

    if not utils.can_manage(request.user, semester=semester, pool=shift.pool):
        messages.add_message(
            request,
            messages.ERROR,
            MESSAGES["ADMINS_ONLY"],
        )
        return HttpResponseRedirect(semester.get_view_url())

    edit_form = RegularWorkshiftForm(
        data=request.POST if "edit" in request.POST else None,
        instance=shift,
        semester=semester,
    )

    if "delete" in request.POST:
        # Open instances are deleted automatically
        shift.delete()
        return HttpResponseRedirect(wurl(
            "workshift:manage",
            sem_url=semester.sem_url,
        ))
    elif edit_form.is_valid():
        shift = edit_form.save()
        return HttpResponseRedirect(shift.get_view_url())

    page_name = "Edit {}".format(shift)

    return render_to_response("edit_shift.html", {
        "page_name": page_name,
        "shift": shift,
        "edit_form": edit_form,
    }, context_instance=RequestContext(request))
1333894
def change_view(self, request, object_id, extra_context=None, **kwargs):
        ""
        model = self.model
        opts = model._meta
        obj = self.get_object(request, unquote(object_id))

        if not self.has_change_permission(request, obj):
            raise PermissionDenied

        if obj is None:
            raise Http404(_('%(name)s object with primary key %(key)r does not exist.') %
                          {'name': force_unicode(opts.verbose_name), 'key': escape(object_id)})

        if request.method == 'POST' and "_saveasnew" in request.POST:
            return self.add_view(request, form_url='../add/')

        ModelForm = self.get_form(request, obj)
        formsets = []

        if request.method == 'POST':
            form = ModelForm(request.POST, request.FILES, instance=obj)

            if form.is_valid():
                form_validated = True
                new_object = self.save_form(request, form, change=True)
            else:
                form_validated = False
                new_object = obj

            prefixes = {}

            for FormSet, inline in zip(self.get_formsets(request, new_object),
                                       self.get_inline_instances(request)):
                prefix = FormSet.get_default_prefix()
                prefixes[prefix] = prefixes.get(prefix, 0) + 1

                if prefixes[prefix] != 1:
                    prefix = "{0}-{1}".format(prefix, prefixes[prefix])
                formset = FormSet(request.POST, request.FILES,
                                  instance=new_object, prefix=prefix,
                                  queryset=inline.queryset(request))

                formsets.append(formset)

                for inline in self.get_inline_instances(request):
                    # If this is the inline that matches this formset, and
                    # we have some nested inlines to deal with, then we need
                    # to get the relevant formset for each of the forms in
                    # the current formset.
                    if inline.inlines and inline.model == formset.model:
                        for nested in inline.inline_instances:
                            for the_form in formset.forms:
                                InlineFormSet = nested.get_formset(request, the_form.instance)
                                prefix = "{0}-{1}".format(the_form.prefix,
                                                          InlineFormSet.get_default_prefix())
                                formsets.append(InlineFormSet(request.POST, request.FILES,
                                                              instance=the_form.instance,
                                                              prefix=prefix))
            if all_valid(formsets) and form_validated:
                self.save_model(request, new_object, form, change=True)
                form.save_m2m()

                for formset in formsets:
                    self.save_formset(request, form, formset, change=True)

                change_message = self.construct_change_message(request, form, formsets)
                self.log_change(request, new_object, change_message)

                return self.response_change(request, new_object)

        else:
            form = ModelForm(instance=obj)
            prefixes = {}

            for FormSet, inline in zip(self.get_formsets(request, obj),
                                       self.get_inline_instances(request)):
                prefix = FormSet.get_default_prefix()
                prefixes[prefix] = prefixes.get(prefix, 0) + 1
                if prefixes[prefix] != 1:
                    prefix = "{0}-{1}".format(prefix, prefixes[prefix])
                formset = FormSet(instance=obj, prefix=prefix,
                                  queryset=inline.queryset(request))
                formsets.append(formset)

        adminForm = helpers.AdminForm(form, self.get_fieldsets(request, obj),
                                      self.prepopulated_fields,
                                      self.get_readonly_fields(request, obj),
                                      model_admin=self)
        media = self.media + adminForm.media
        inline_admin_formsets = []

        for inline, formset in zip(self.get_inline_instances(request), formsets):
            fieldsets = list(inline.get_fieldsets(request, obj))
            readonly = list(inline.get_readonly_fields(request, obj))
            inline_admin_formset = helpers.InlineAdminFormSet(inline, formset, fieldsets,
                                                              readonly, model_admin=self)
            if inline.inlines:
                for form in formset.forms:
                    if form.instance.pk:
                        instance = form.instance
                    else:
                        instance = None

                    form.inlines = inline.get_inlines(request, instance, prefix=form.prefix)

                inline_admin_formset.inlines = inline.get_inlines(request)

            inline_admin_formsets.append(inline_admin_formset)
            media = media + inline_admin_formset.media

        context = {
            'title': _('Change %s') % force_unicode(opts.verbose_name),
            'adminform': adminForm,
            'object_id': object_id,
            'original': obj,
            'is_popup': "_popup" in request.REQUEST,
            'media': mark_safe(media),
            'inline_admin_formsets': inline_admin_formsets,
            'errors': helpers.AdminErrorList(form, formsets),
            'app_label': opts.app_label,
        }

        context.update(extra_context or {})

        return self.render_change_form(request, context, change=True, obj=obj)
388961
def edit(options = { only: [], except: [:id, :created_at, :updated_at], required: [] })
      @required_keys = options[:required]
      @attrs = CEO::Iterator.filter(@thing.attributes.keys, options)
      @model = @thing.model_name.name.constantize
      @route_name ||= @controller_name ||= controller_name
      @index_route = send(:"admin_#{@route_name}_path")

      render 'admin/edit'
    end
547070
def changelist_view(self, request, extra_context=None):
        
        model = self.model
        if model.objects.all().count() > 1:
            return super(PreferencesAdmin, self).changelist_view(request)
        else:
            obj = model.singleton.get()
            return redirect(
                reverse(
                    'admin:%s_%s_change' % (
                        model._meta.app_label, model._meta.model_name
                    ),
                    args=(obj.id,)
                )
            )
253118
def edit_entry(self, id_, **kwargs):
        
        data = self._wrap_dict("time_entry", kwargs)

        return self.patch("/time_entries/{}.json".format(id_), data)
597714
def _management_form(self):
        """"""
        if self.is_bound:
            form = ConcurrentManagementForm(self.data, auto_id=self.auto_id,
                                            prefix=self.prefix)
            if not form.is_valid():
                raise ValidationError('ManagementForm data is missing or has been tampered with')
        else:
            form = ConcurrentManagementForm(auto_id=self.auto_id,
                                            prefix=self.prefix,
                                            initial={TOTAL_FORM_COUNT: self.total_form_count(),
                                                     INITIAL_FORM_COUNT: self.initial_form_count(),
                                                     MAX_NUM_FORM_COUNT: self.max_num},
                                            versions=[(form.instance.pk, get_revision_of_object(form.instance)) for form
                                                      in self.initial_forms])
        return form
1159391
def clean(self):
        '''  '''
        cleaned_data = super(ManagerForm, self).clean()
        compensation = cleaned_data.get("compensation")
        duties = cleaned_data.get("duties")
        if compensation == '<br data-mce-bogus="1">':
            cleaned_data["compensation"] = ""
        if duties == '<br data-mce-bogus="1">':
            cleaned_data["duties"] = ""
        return cleaned_data
1140966
def changelist_view(self, request, extra_context=None):
        

        return super(TrackedLiveAdmin, self).changelist_view(
            request, dict(extra_context or {},
                          url_name='admin:%s_%s_tracking_report' % (self.model._meta.app_label, self.model._meta.model_name),
                          period_options=self.get_period_options(),
                          report_options=self.get_report_options())
        )
473861
def changelist_view(self, request, extra_context=None):
        """"""
        if extra_context is None:
            extra_context = {}
        response = self.adv_filters_handle(request,
                                           extra_context=extra_context)
        if response:
            return response
        return super(AdminAdvancedFiltersMixin, self
                     ).changelist_view(request, extra_context=extra_context)
406098
private function changed()
    {
        if ($this->isDirty) {
            return;
        }

        $this->isDirty = true;

        if (!$this->needsSchedulingForDirtyCheck()) {
            return;
        }

        $this->uow->scheduleForDirtyCheck($this->owner);
    }
65049
def edit_thing_path(model, object)
      id = object['ID'] || object['id']
      send(:"edit_admin_#{undersingularize(model)}_path", id: id)
    end
1139669
def add_manager(self, manager):
        
        select_action = 'add_manager'

        self._update_scope_project_team(select_action=select_action, user=manager, user_type='manager')
443039
void editJob(String jobId) {

        String stateEdit = CmsScheduledJobsAppConfig.APP_ID + "/" + CmsJobManagerApp.PATH_NAME_EDIT;
        stateEdit = A_CmsWorkplaceApp.addParamToState(stateEdit, CmsJobManagerApp.PARAM_JOB_ID, jobId);
        CmsAppWorkplaceUi.get().getNavigator().navigateTo(stateEdit);
    }
1338073
def add_manager_view(request):
    '''  '''
    form = ManagerForm(request.POST or None)
    if form.is_valid():
        manager = form.save()
        messages.add_message(request, messages.SUCCESS,
                             MESSAGES['MANAGER_ADDED'].format(managerTitle=manager.title))
        return HttpResponseRedirect(reverse('managers:add_manager'))
    return render_to_response('edit_manager.html', {
        'page_name': "Admin - Add Manager",
        'managerset': Manager.objects.all(),
        'form': form,
        }, context_instance=RequestContext(request))
432135
private void updateManagementGraph(final JobID jobID, final VertexAssignmentEvent vertexAssignmentEvent) {

		synchronized (this.recentManagementGraphs) {

			final ManagementGraph managementGraph = this.recentManagementGraphs.get(jobID);
			if (managementGraph == null) {
				return;
			}
			final ManagementVertex vertex = managementGraph.getVertexByID(vertexAssignmentEvent.getVertexID());
			if (vertex == null) {
				return;
			}

			vertex.setInstanceName(vertexAssignmentEvent.getInstanceName());
			vertex.setInstanceType(vertexAssignmentEvent.getInstanceType());
		}
	}
977306
def file_modify(filename, settings):
        
        for k, v in settings.items():
            if k == "mode":
                os.chmod(filename,v)
            if k == "owners":
                os.chown(filename,v)
872549
def edit(self, changelist=0):
        
        command = 'reopen' if self.action in ('add', 'edit') else 'edit'
        if int(changelist):
            self._connection.run([command, '-c', str(changelist.change), self.depotFile])
        else:
            self._connection.run([command, self.depotFile])

        self.query()