def handle_noargs(self, **options): norm = 'NFKC' for l in Library.objects.all(): l.name = _n(norm, l.name) l.save() for p in Publisher.objects.all(): if p.name: p.name = _n(norm, p.name) p.save() for s in STP.objects.all(): s.publisher_name = _n(norm, s.publisher_name) s.rubric = _n(norm, s.rubric) s.save() for a in Advert.objects.all(): a.publisher_name = _n(norm, a.publisher_name) a.rubric = _n(norm, a.rubric) a.save() for p in Page.objects.all(): p = p.specific p.title = _n(norm, p.title) if hasattr(p, 'content'): p.content = _n(norm, p.content) if hasattr(p, 'introduction'): p.introduction = _n(norm, p.introduction) p.save()
def __init__(self, row, orderno, mode): self.orderno = orderno self.id = row[0] self.mode = mode self.accode = _n(norm, row[9]) if mode == 'OCVE': self.label = row[2] else: self.label = row[3] self.label = _n(norm, self.label) #Anything not a manuscript is a printed edition #Set first edition type to printed edition if int(row[1]) == 3: self.type = 1 else: self.type = row[1] genres = [] #if source.getWork() is not None: # self.work = source.getWork().id for g in Genre.objects.filter(work__id=int(row[4])).distinct(): genres.append(int(g.id)) achash = row[11] if get_impression_exists(achash): self.achash = achash else: self.achash = '' self.work = row[4] self.genres = genres self.keypitches = keyPitch.objects.filter( workcomponent__sourcecomponent_workcomponent__sourcecomponent__source_id =self.id).distinct() self.keymodes = keyMode.objects.filter( workcomponent__sourcecomponent_workcomponent__sourcecomponent__source_id =self.id).distinct() years = [] self.dedicatee = row[5] self.publisher = row[6] self.platenumber = row[7] for y in Year.objects.filter( sourceinformation_year__sourceinformation_id=int(row[10])): years.append(y.year) #else: # self.dedicatee = '' # self.publisher = '' # self.platenumber = '' self.years = years
def __init__(self, row, orderno,mode): self.orderno = orderno self.id = row[0] self.mode=mode self.accode = _n(norm, row[9]) if mode == 'OCVE': self.label = row[2] else: self.label = row[3] self.label=_n(norm, self.label) #Anything not a manuscript is a printed edition #Set first edition type to printed edition if int(row[1]) == 3: self.type=1 else: self.type = row[1] genres = [] #if source.getWork() is not None: # self.work = source.getWork().id for g in Genre.objects.filter(work__id=int(row[4])).distinct(): genres.append(int(g.id)) achash=row[11] if get_impression_exists(achash): self.achash=achash else: self.achash='' self.work=row[4] self.genres = genres self.keypitches =keyPitch.objects.filter(workcomponent__sourcecomponent_workcomponent__sourcecomponent__source_id=self.id).distinct() self.keymodes =keyMode.objects.filter(workcomponent__sourcecomponent_workcomponent__sourcecomponent__source_id=self.id).distinct() years = [] self.dedicatee = row[5] self.publisher = row[6] self.platenumber = row[7] for y in Year.objects.filter(sourceinformation_year__sourceinformation_id=int(row[10])): years.append(y.year) #else: # self.dedicatee = '' # self.publisher = '' # self.platenumber = '' self.years = years