def encoder(obj): items = [] for item in obj: # Check if hidden (TODO: this method is slow) if models.Transfer.objects.is_hidden(item['sipuuid']): continue jobs = helpers.get_jobs_by_sipuuid(item['sipuuid']) item['directory'] = os.path.basename(utils.get_directory_name(jobs[0])) item['timestamp'] = calendar.timegm(item['timestamp'].timetuple()) item['uuid'] = item['sipuuid'] item['id'] = item['sipuuid'] del item['sipuuid'] item['jobs'] = [] for job in jobs: newJob = {} item['jobs'].append(newJob) newJob['uuid'] = job.jobuuid newJob['type'] = job.jobtype newJob['microservicegroup'] = job.microservicegroup newJob['subjobof'] = job.subjobof newJob['currentstep'] = job.currentstep newJob['timestamp'] = '%d.%s' % (calendar.timegm(job.createdtime.timetuple()), str(job.createdtimedec).split('.')[-1]) try: mcp_status except NameError: pass else: xml_unit = mcp_status.xpath('choicesAvailableForUnit[UUID="%s"]' % job.jobuuid) if xml_unit: xml_unit_choices = xml_unit[0].findall('choices/choice') choices = {} for choice in xml_unit_choices: choices[choice.find("chainAvailable").text] = choice.find("description").text newJob['choices'] = choices items.append(item) return items
def ingest_metadata_edit(request, uuid, id=None): if id: dc = models.DublinCore.objects.get(pk=id) else: # Right now we only support linking metadata to the Ingest try: dc = models.DublinCore.objects.get_sip_metadata(uuid) return HttpResponseRedirect(reverse('components.ingest.views.ingest_metadata_edit', args=[uuid, dc.id])) except ObjectDoesNotExist: dc = models.DublinCore(metadataappliestotype=1, metadataappliestoidentifier=uuid) fields = ['title', 'creator', 'subject', 'description', 'publisher', 'contributor', 'date', 'type', 'format', 'identifier', 'source', 'relation', 'language', 'coverage', 'rights'] if request.method == 'POST': form = forms.DublinCoreMetadataForm(request.POST) if form.is_valid(): for item in fields: setattr(dc, item, form.cleaned_data[item]) dc.save() return HttpResponseRedirect(reverse('components.ingest.views.ingest_metadata_list', args=[uuid])) else: initial = {} for item in fields: initial[item] = getattr(dc, item) form = forms.DublinCoreMetadataForm(initial=initial) jobs = models.Job.objects.filter(sipuuid=uuid) name = utils.get_directory_name(jobs[0]) return render(request, 'ingest/metadata_edit.html', locals())
def inner(request, uuid, *args, **kwargs): jobs = models.Job.objects.filter(sipuuid=uuid, subjobof='') if 0 == jobs.count: raise Http404 kwargs['jobs'] = jobs kwargs['name'] = utils.get_directory_name(jobs[0]) return view(request, uuid, *args, **kwargs)
def ingest_browse_aip(request, jobuuid): """ jobs = models.Job.objects.filter(jobuuid=jobuuid) if jobs.count() == 0: raise Http404 job = jobs[0] sipuuid = job.sipuuid sips = models.SIP.objects.filter(uuid=sipuuid) sip = sips[0] aipdirectory = sip.currentpath.replace( '%sharedPath%', '/var/archivematica/sharedDirectory/' ) """ jobs = models.Job.objects.filter(jobuuid=jobuuid) job = jobs[0] title = 'Review AIP' name = utils.get_directory_name(job) directory = '/var/archivematica/sharedDirectory/watchedDirectories/storeAIP' return render(request, 'ingest/aip_browse.html', locals())
def get_title(self): try: jobs = main.models.Job.objects.filter(sipuuid=self.sipuuid, subjobof='') return utils.get_directory_name(jobs[0]) except: return 'N/A'
def ingest_browse_normalization(request, jobuuid): jobs = models.Job.objects.filter(jobuuid=jobuuid) job = jobs[0] title = 'Review normalization' name = utils.get_directory_name(job) directory = '/var/archivematica/sharedDirectory/watchedDirectories/approveNormalization' return render(request, 'ingest/aip_browse.html', locals())
def ingest_browse_aip(request, jobuuid): jobs = models.Job.objects.filter(jobuuid=jobuuid, subjobof='') job = jobs[0] title = 'Review AIP' name = utils.get_directory_name(job) directory = '/var/archivematica/sharedDirectory/watchedDirectories/storeAIP' return render(request, 'ingest/aip_browse.html', locals())
def rights_list(request, uuid, section): jobs = models.Job.objects.filter(sipuuid=uuid, subjobof='') name = utils.get_directory_name(jobs[0]) # See MetadataAppliesToTypes table types = {'transfer': 'Transfer', 'ingest': 'SIP', 'file': 'File'} type_id = helpers.get_metadata_type_id_by_description(types[section]) grants = models.RightsStatementRightsGranted.objects.filter( rightsstatement__metadataappliestotype__exact=type_id, rightsstatement__metadataappliestoidentifier__exact=uuid) # create result list that incorporates multiple restriction records modifiedGrants = [] for grant in grants: item = { 'act': grant.act, 'basis': grant.rightsstatement.rightsbasis, 'restrictions': [], 'startdate': grant.startdate, 'enddate': grant.enddate, 'rightsstatement': grant.rightsstatement } if (grant.enddateopen): item['enddate'] = '(open)' restriction_data = models.RightsStatementRightsGrantedRestriction.objects.filter( rightsgranted=grant) restrictions = [] for restriction in restriction_data: #return HttpResponse(restriction.restriction) restrictions.append(restriction.restriction) item['restrictions'] = restrictions modifiedGrants.append(item) grants = modifiedGrants # When listing ingest rights we also want to show transfer rights # The only way I've found to get the related transfer of a SIP is looking into the File table if section is "ingest": try: transfer_uuid = models.File.objects.filter( sip__uuid__exact=uuid)[0].transfer.uuid transfer_grants = models.RightsStatementRightsGranted.objects.filter( rightsstatement__metadataappliestotype__exact=types[ 'transfer'], rightsstatement__metadataappliestoidentifier__exact= transfer_uuid) except: pass return render(request, 'rights/rights_list.html', locals())
def rights_list(request, uuid, section): jobs = models.Job.objects.filter(sipuuid=uuid, subjobof='') name = utils.get_directory_name(jobs[0]) # See MetadataAppliesToTypes table types = {'transfer': 'Transfer', 'ingest': 'SIP', 'file': 'File'} type_id = helpers.get_metadata_type_id_by_description(types[section]) grants = models.RightsStatementRightsGranted.objects.filter( rightsstatement__metadataappliestotype__exact=type_id, rightsstatement__metadataappliestoidentifier__exact=uuid ) # create result list that incorporates multiple restriction records modifiedGrants = [] for grant in grants: item = { 'id': grant.pk, 'act': grant.act, 'basis': grant.rightsstatement.rightsbasis, 'restrictions': [], 'startdate': grant.startdate, 'enddate': grant.enddate, 'rightsstatement': grant.rightsstatement } if (grant.enddateopen): item['enddate'] = '(open)' restriction_data = models.RightsStatementRightsGrantedRestriction.objects.filter(rightsgranted=grant) restrictions = [] for restriction in restriction_data: #return HttpResponse(restriction.restriction) restrictions.append(restriction.restriction) item['restrictions'] = restrictions modifiedGrants.append(item) grants = modifiedGrants # When listing ingest rights we also want to show transfer rights # The only way I've found to get the related transfer of a SIP is looking into the File table if section is "ingest": try: transfer_uuid = models.File.objects.filter(sip__uuid__exact=uuid)[0].transfer.uuid transfer_grants = models.RightsStatementRightsGranted.objects.filter( rightsstatement__metadataappliestotype__exact=types['transfer'], rightsstatement__metadataappliestoidentifier__exact=transfer_uuid ) except: pass return render(request, 'rights/rights_list.html', locals())
def ingest_normalization_report(request, uuid, current_page=None): jobs = models.Job.objects.filter(sipuuid=uuid, subjobof='') job = jobs[0] sipname = utils.get_directory_name(job) objects = getNormalizationReportQuery(sipUUID=uuid) results_per_page = 10 if current_page == None: current_page = 1 page = helpers.pager(objects, results_per_page, current_page) hit_count = len(objects) return render(request, 'ingest/normalization_report.html', locals())
def ingest_metadata_edit(request, uuid, id=None): if id: dc = models.DublinCore.objects.get(pk=id) else: # Right now we only support linking metadata to the Ingest try: dc = models.DublinCore.objects.get_sip_metadata(uuid) return HttpResponseRedirect( reverse('components.ingest.views.ingest_metadata_edit', args=[uuid, dc.id])) except ObjectDoesNotExist: dc = models.DublinCore( metadataappliestotype=ingest_sip_metadata_type_id(), metadataappliestoidentifier=uuid) fields = [ 'title', 'creator', 'subject', 'description', 'publisher', 'contributor', 'date', 'type', 'format', 'identifier', 'source', 'relation', 'language', 'coverage', 'rights' ] if request.method == 'POST': form = DublinCoreMetadataForm(request.POST) if form.is_valid(): for item in fields: setattr(dc, item, form.cleaned_data[item]) dc.save() return HttpResponseRedirect( reverse('components.ingest.views.ingest_metadata_list', args=[uuid])) else: initial = {} for item in fields: initial[item] = getattr(dc, item) form = DublinCoreMetadataForm(initial=initial) jobs = models.Job.objects.filter(sipuuid=uuid, subjobof='') name = utils.get_directory_name(jobs[0]) return render(request, 'ingest/metadata_edit.html', locals())
def ingest_microservices(request, uuid): jobs = models.Job.objects.filter(sipuuid=uuid, subjobof='') name = utils.get_directory_name(jobs[0]) return render(request, 'ingest/microservices.html', locals())
def ingest_detail(request, uuid): jobs = models.Job.objects.filter(sipuuid=uuid, subjobof='') is_waiting = jobs.filter(currentstep='Awaiting decision').count() > 0 name = utils.get_directory_name(jobs[0]) return render(request, 'ingest/detail.html', locals())
def rights_edit(request, uuid, id=None, section='ingest'): jobs = models.Job.objects.filter(sipuuid=uuid, subjobof='') name = utils.get_directory_name(jobs[0]) # flag indicating what kind of new content, if any, has been created new_content_type_created = None max_notes = 1 if id: viewRights = models.RightsStatement.objects.get(pk=id) agentId = None if request.method == 'POST': postData = request.POST.copy() """ agentId = rights_parse_agent_id(postData.get('rightsholder')) if agentId == 0 and postData.get('rightsholder') != '0' and postData.get('rightsholder') != '': agent = models.RightsStatementLinkingAgentIdentifier() agent.rightsstatement = viewRights agent.linkingagentidentifiervalue = postData.get('rightsholder') agent.save() agentId = agent.id postData.__setitem__('rightsholder', agentId) """ form = forms.RightsForm(postData, instance=viewRights) form.cleaned_data = postData viewRights = form.save() else: form = forms.RightsForm(instance=viewRights) form.cleaned_data = viewRights form.save() # determine how many empty forms should be shown for children extra_copyright_forms = max_notes - models.RightsStatementCopyright.objects.filter(rightsstatement=viewRights).count() extra_statute_forms = max_notes - models.RightsStatementStatuteInformation.objects.filter(rightsstatement=viewRights).count() extra_license_forms = max_notes - models.RightsStatementLicense.objects.filter(rightsstatement=viewRights).count() extra_other_forms = max_notes - models.RightsStatementOtherRightsInformation.objects.filter(rightsstatement=viewRights).count() else: if request.method == 'POST': postData = request.POST.copy() agentId = rights_parse_agent_id(postData.get('rightsholder')) postData.__setitem__('rightsholder', agentId) form = forms.RightsForm(postData) else: form = forms.RightsForm() viewRights = models.RightsStatement() extra_copyright_forms = max_notes extra_statute_forms = max_notes extra_license_forms = max_notes extra_license_notes = max_notes extra_other_forms = max_notes # create inline formsets for child elements CopyrightFormSet = inlineformset_factory( models.RightsStatement, models.RightsStatementCopyright, extra=extra_copyright_forms, can_delete=False, form=forms.RightsCopyrightForm ) StatuteFormSet = inlineformset_factory( models.RightsStatement, models.RightsStatementStatuteInformation, extra=extra_statute_forms, can_delete=False, form=forms.RightsStatuteForm ) LicenseFormSet = inlineformset_factory( models.RightsStatement, models.RightsStatementLicense, extra=extra_license_forms, can_delete=False, form=forms.RightsLicenseForm ) OtherFormSet = inlineformset_factory( models.RightsStatement, models.RightsStatementOtherRightsInformation, extra=extra_other_forms, can_delete=False, form=forms.RightsOtherRightsForm ) # handle form creation/saving if request.method == 'POST': if id: createdRights = viewRights else: sectionTypeID = {'transfer': 'Transfer', 'ingest': 'SIP'} type_id = helpers.get_metadata_type_id_by_description(sectionTypeID[section]) newRights = models.RightsStatement(metadataappliestotype=type_id, metadataappliestoidentifier=uuid) form = forms.RightsForm(request.POST, instance=newRights) createdRights = form.save() copyrightFormset = CopyrightFormSet(request.POST, instance=createdRights) createdCopyrightSet = copyrightFormset.save() # establish whether or not there is a copyright information instance to use as a parent if len(createdCopyrightSet) == 1: createdCopyright = createdCopyrightSet[0] else: createdCopyright = False # handle creation of new copyright notes, creating parent if necessary if request.POST.get('copyright_note', '') != '': # make new copyright record if it doesn't exist if not createdCopyright: try: createdCopyright = models.RightsStatementCopyright.objects.get(rightsstatement=createdRights) except: createdCopyright = models.RightsStatementCopyright(rightsstatement=createdRights) createdCopyright.save() copyrightNote = models.RightsStatementCopyrightNote(rightscopyright=createdCopyright) copyrightNote.copyrightnote = request.POST.get('copyright_note', '') copyrightNote.save() new_content_type_created = 'copyright' # handle creation of new documentation identifiers if request.POST.get('copyright_documentation_identifier_type', '') != '' or request.POST.get('copyright_documentation_identifier_value', '') != '' or request.POST.get('copyright_documentation_identifier_role', ''): # make new copyright record if it doesn't exist if not createdCopyright: try: createdCopyright = models.RightsStatementCopyright.objects.get(rightsstatement=createdRights) except: createdCopyright = models.RightsStatementCopyright(rightsstatement=createdRights) createdCopyright.save() copyrightDocIdentifier = models.RightsStatementCopyrightDocumentationIdentifier(rightscopyright=createdCopyright) copyrightDocIdentifier.copyrightdocumentationidentifiertype = request.POST.get('copyright_documentation_identifier_type', '') copyrightDocIdentifier.copyrightdocumentationidentifiervalue = request.POST.get('copyright_documentation_identifier_value', '') copyrightDocIdentifier.copyrightdocumentationidentifierrole = request.POST.get('copyright_documentation_identifier_role', '') copyrightDocIdentifier.save() new_content_type_created = 'copyright' licenseFormset = LicenseFormSet(request.POST, instance=createdRights) createdLicenseSet = licenseFormset.save() # establish whether or not there is a license instance to use as a parent if len(createdLicenseSet) == 1: createdLicense = createdLicenseSet[0] else: createdLicense = False # handle creation of new copyright notes, creating parent if necessary if request.POST.get('license_note', '') != '': # make new copyright record if it doesn't exist if not createdLicense: try: createdLicense = models.RightsStatementLicense.objects.get(rightsstatement=createdRights) except: createdLicense = models.RightsStatementLicense(rightsstatement=createdRights) createdLicense.save() licenseNote = models.RightsStatementLicenseNote(rightsstatementlicense=createdLicense) licenseNote.licensenote = request.POST.get('license_note', '') licenseNote.save() new_content_type_created = 'license' # handle creation of new documentation identifiers if request.POST.get('license_documentation_identifier_type', '') != '' or request.POST.get('license_documentation_identifier_value', '') != '' or request.POST.get('license_documentation_identifier_role', ''): # make new license record if it doesn't exist if not createdLicense: try: createdLicense = models.RightsStatementLicense.objects.get(rightsstatement=createdRights) except: createdLicense = models.RightsStatementLicense(rightsstatement=createdRights) createdLicense.save() licenseDocIdentifier = models.RightsStatementLicenseDocumentationIdentifier(rightsstatementlicense=createdLicense) licenseDocIdentifier.licensedocumentationidentifiertype = request.POST.get('license_documentation_identifier_type', '') licenseDocIdentifier.licensedocumentationidentifiervalue = request.POST.get('license_documentation_identifier_value', '') licenseDocIdentifier.licensedocumentationidentifierrole = request.POST.get('license_documentation_identifier_role', '') licenseDocIdentifier.save() new_content_type_created = 'license' statuteFormset = StatuteFormSet(request.POST, instance=createdRights) createdStatuteSet = statuteFormset.save() if request.POST.get('statute_previous_pk', '') == 'None' and len(createdStatuteSet) == 1: new_content_type_created = 'statute' noteCreated = False for form in statuteFormset.forms: statuteCreated = False # handle documentation identifier creation for a parent that's a blank statute if (request.POST.get('statute_documentation_identifier_type_None', '') != '' or request.POST.get('statute_documentation_identifier_value_None', '') != '' or request.POST.get('statute_documentation_identifier_role_None', '') != ''): if form.instance.pk: statuteCreated = form.instance else: statuteCreated = models.RightsStatementStatuteInformation(rightsstatement=createdRights) statuteCreated.save() statuteDocIdentifier = models.RightsStatementStatuteDocumentationIdentifier(rightsstatementstatute=statuteCreated) statuteDocIdentifier.statutedocumentationidentifiertype = request.POST.get('statute_documentation_identifier_type_None', '') statuteDocIdentifier.statutedocumentationidentifiervalue = request.POST.get('statute_documentation_identifier_value_None', '') statuteDocIdentifier.statutedocumentationidentifierrole = request.POST.get('statute_documentation_identifier_role_None', '') statuteDocIdentifier.save() new_content_type_created = 'statute' else: # handle documentation identifier creation for a parent statute that already exists if request.POST.get('statute_documentation_identifier_type_' + str(form.instance.pk), '') != '' or request.POST.get('statute_documentation_identifier_value_' + str(form.instance.pk), '') or request.POST.get('statute_documentation_identifier_role_' + str(form.instance.pk), ''): statuteDocIdentifier = models.RightsStatementStatuteDocumentationIdentifier(rightsstatementstatute=form.instance) statuteDocIdentifier.statutedocumentationidentifiertype = request.POST.get('statute_documentation_identifier_type_' + str(form.instance.pk), '') statuteDocIdentifier.statutedocumentationidentifiervalue = request.POST.get('statute_documentation_identifier_value_' + str(form.instance.pk), '') statuteDocIdentifier.statutedocumentationidentifierrole = request.POST.get('statute_documentation_identifier_role_' + str(form.instance.pk), '') statuteDocIdentifier.save() new_content_type_created = 'statute' # handle note creation for a parent that's a blank grant if request.POST.get('new_statute_note_None', '') != '' and not form.instance.pk: if not statuteCreated: statuteCreated = models.RightsStatementStatuteInformation(rightsstatement=createdRights) statuteCreated.save() noteCreated = models.RightsStatementStatuteInformationNote(rightsstatementstatute=statuteCreated) noteCreated.statutenote = request.POST.get('new_statute_note_None', '') noteCreated.save() new_content_type_created = 'statue' else: # handle note creation for a parent grant that already exists if request.POST.get('new_statute_note_' + str(form.instance.pk), '') != '': noteCreated = models.RightsStatementStatuteInformationNote(rightsstatementstatute=form.instance) noteCreated.statutenote = request.POST.get('new_statute_note_' + str(form.instance.pk), '') noteCreated.save() new_content_type_created = 'statute' # handle note creation for a parent that's just been created if request.POST.get('new_statute_note_None', '') != '' and not noteCreated: noteCreated = models.RightsStatementStatuteInformationNote(rightsstatementstatute=form.instance) noteCreated.statutenote = request.POST.get('new_statute_note_None', '') noteCreated.save() # display (possibly revised) formset statuteFormset = StatuteFormSet(instance=createdRights) otherFormset = OtherFormSet(request.POST, instance=createdRights) createdOtherSet = otherFormset.save() # establish whether or not there is an "other" instance to use as a parent if len(createdOtherSet) == 1: createdOther = createdOtherSet[0] else: createdOther = False # handle creation of new "other" notes, creating parent if necessary if request.POST.get('otherrights_note', '') != '': # make new "other" record if it doesn't exist if not createdOther: try: createdOther = models.RightsStatementOtherRightsInformation.objects.get(rightsstatement=createdRights) except: createdOther = models.RightsStatementOtherRightsInformation(rightsstatement=createdRights) createdOther.save() otherNote = models.RightsStatementOtherRightsInformationNote(rightsstatementotherrights=createdOther) otherNote.otherrightsnote = request.POST.get('otherrights_note', '') otherNote.save() new_content_type_created = 'other' # handle creation of new documentation identifiers if request.POST.get('other_documentation_identifier_type', '') != '' or request.POST.get('other_documentation_identifier_value', '') != '' or request.POST.get('other_documentation_identifier_role', ''): # make new other record if it doesn't exist if not createdOther: try: createdOther = models.RightsStatementOtherRightsInformation.objects.get(rightsstatement=createdRights) except: createdOther = models.RightsStatementOtherRightsInformation(rightsstatement=createdRights) createdOther.save() otherDocIdentifier = models.RightsStatementOtherRightsDocumentationIdentifier(rightsstatementotherrights=createdOther) otherDocIdentifier.otherrightsdocumentationidentifiertype = request.POST.get('other_documentation_identifier_type', '') otherDocIdentifier.otherrightsdocumentationidentifiervalue = request.POST.get('other_documentation_identifier_value', '') otherDocIdentifier.otherrightsdocumentationidentifierrole = request.POST.get('other_documentation_identifier_role', '') otherDocIdentifier.save() new_content_type_created = 'other' if request.POST.get('next_button', '') != None and request.POST.get('next_button', '') != '': return HttpResponseRedirect( reverse('components.rights.views.%s_rights_grants_edit' % section, args=[uuid, createdRights.pk]) ) else: url = reverse('components.rights.views.%s_rights_edit' % section, args=[uuid, createdRights.pk]) try: new_content_type_created url = url + '?created=' + new_content_type_created except: pass return HttpResponseRedirect(url) else: copyrightFormset = CopyrightFormSet(instance=viewRights) statuteFormset = StatuteFormSet(instance=viewRights) licenseFormset = LicenseFormSet(instance=viewRights) otherFormset = OtherFormSet(instance=viewRights) # show what content's been created after a redirect if request.GET.get('created', '') != '': new_content_type_created = request.GET.get('created', '') return render(request, 'rights/rights_edit.html', locals())
def rights_grants_edit(request, uuid, id, section='ingest'): jobs = models.Job.objects.filter(sipuuid=uuid, subjobof='') name = utils.get_directory_name(jobs[0]) viewRights = models.RightsStatement.objects.get(pk=id) # determine how many empty forms should be shown for children extra_grant_forms = 1 # create inline formsets for child elements GrantFormSet = inlineformset_factory( models.RightsStatement, models.RightsStatementRightsGranted, extra=extra_grant_forms, can_delete=False, form=forms.RightsGrantedForm ) # handle form creation/saving if request.method == 'POST': grantFormset = GrantFormSet(request.POST, instance=viewRights) grantFormset.save() restrictionCreated = False noteCreated = False for form in grantFormset.forms: grantCreated = False # handle restriction creation for a parent that's a blank grant if request.POST.get('new_rights_restriction_None', '') != '' and not form.instance.pk: grantCreated = models.RightsStatementRightsGranted(rightsstatement=viewRights) grantCreated.save() restrictionCreated = models.RightsStatementRightsGrantedRestriction(rightsgranted=grantCreated) restrictionCreated.restriction = request.POST.get('new_rights_restriction_None', '') restrictionCreated.save() else: # handle restriction creation for a parent grant that already exists if request.POST.get('new_rights_restriction_' + str(form.instance.pk), '') != '': restrictionCreated = models.RightsStatementRightsGrantedRestriction(rightsgranted=form.instance) restrictionCreated.restriction = request.POST.get('new_rights_restriction_' + str(form.instance.pk), '') restrictionCreated.save() # handle note creation for a parent that's a blank grant if request.POST.get('new_rights_note_None', '') != '' and not form.instance.pk: if not grantCreated: grantCreated = models.RightsStatementRightsGranted(rightsstatement=viewRights) grantCreated.save() noteCreated = models.RightsStatementRightsGrantedNote(rightsgranted=grantCreated) noteCreated.rightsgrantednote = request.POST.get('new_rights_note_None', '') noteCreated.save() else: # handle note creation for a parent grant that already exists if request.POST.get('new_rights_note_' + str(form.instance.pk), '') != '': noteCreated = models.RightsStatementRightsGrantedNote(rightsgranted=form.instance) noteCreated.rightsgrantednote = request.POST.get('new_rights_note_' + str(form.instance.pk), '') noteCreated.save() # handle restriction creation for a parent that's just been created if request.POST.get('new_rights_restriction_None', '') != '' and not restrictionCreated: restrictionCreated = models.RightsStatementRightsGrantedRestriction(rightsgranted=form.instance) restrictionCreated.restriction = request.POST.get('new_rights_restriction_None', '') restrictionCreated.save() # handle note creation for a parent that's just been created if request.POST.get('new_rights_note_None', '') != '' and not noteCreated: noteCreated = models.RightsStatementRightsGrantedNote(rightsgranted=form.instance) noteCreated.rightsgrantednote = request.POST.get('new_rights_note_None', '') noteCreated.save() # display (possibly revised) formset grantFormset = GrantFormSet(instance=viewRights) if request.method == 'POST': if request.POST.get('next_button', '') != None and request.POST.get('next_button', '') != '': return HttpResponseRedirect(reverse('components.rights.views.%s_rights_list' % section, args=[uuid])) else: url = reverse('components.rights.views.%s_rights_grants_edit' % section, args=[uuid, viewRights.pk]) try: new_content_type_created url = url + '?created=' + new_content_type_created except: pass return HttpResponseRedirect(url) else: return render(request, 'rights/rights_grants_edit.html', locals())
def microservices(request, uuid): jobs = models.Job.objects.filter(sipuuid=uuid) name = utils.get_directory_name(jobs[0]) return render(request, 'transfer/microservices.html', locals())
def transfer_detail(request, uuid): jobs = models.Job.objects.filter(sipuuid=uuid) name = utils.get_directory_name(jobs[0]) is_waiting = jobs.filter(currentstep='Awaiting decision').count() > 0 return render(request, 'transfer/detail.html', locals())
def transfer_microservices(request, uuid): jobs = models.Job.objects.filter(sipuuid=uuid) name = utils.get_directory_name(jobs[0]) return render(request, 'transfer/microservices.html', locals())
def get_title(self): try: jobs = main.models.Job.objects.filter(sipuuid=self.sipuuid) return utils.get_directory_name(jobs[0]) except: return 'N/A'
def detail(request, uuid): jobs = models.Job.objects.filter(sipuuid=uuid) name = utils.get_directory_name(jobs[0]) is_waiting = jobs.filter(currentstep='Awaiting decision').count() > 0 return render(request, 'transfer/detail.html', locals())