def C(en, de, fr='', nl='', jargon=None, obsoletes=None, **kw): texts = dict(en=en, de=de, fr=fr, nl=nl) name = dict() abbr = dict() for lang in 'en', 'de', 'fr', 'nl': t = texts.get(lang) if t: mo = abbrRE.match(t) if mo: abbr[lang] = mo.group(1).strip() name[lang] = mo.group(2).strip() else: name[lang] = t kw.update(dd.babel_values('name', **name)) kw.update(dd.babel_values('abbr', **abbr)) obj = Concept(**kw) yield obj if obsoletes is not None: if isinstance(obsoletes, dd.Model): obsoletes = [obsoletes] for obsoleted in obsoletes: yield Link(parent=obsoleted, child=obj, type=LinkTypes.obsoletes) if jargon is not None: if isinstance(jargon, dd.Model): jargon = [jargon] for domain in jargon: yield Link(parent=domain, child=obj, type=LinkTypes.jargon)
def objects(): ptype = Instantiator('properties.PropType').build properties = dd.resolve_app('properties') yield ptype(id=1, **dd.babel_values( 'name', **dict( en="Present or not", de=u"Vorhanden oder nicht", fr=u"Présent ou pas", et=u"Olemas või mitte", nl=u"Ja of niet", ))) yield ptype(id=2, choicelist=properties.HowWell.actor_id, default_value=properties.HowWell.default.value, **dd.babel_values( 'name', **dict( en="Rating", de=u"Bewertung", et=u"Hinnang", fr=u"Appréciation(?)", nl=u"Hoe goed", )))
def objects(): #~ yield companyType('Firma','Firma') #~ yield companyType('asbl','asbl') #~ yield companyType('A.S.B.L.','A.S.B.L.') #~ yield companyType('sprl','sprl') #~ yield companyType('GmbH','GmbH') #~ yield companyType('AG','AG') #~ yield companyType('S.A.','S.A.') #~ yield companyType('S.C.','S.C.') #~ yield companyType('V.o.G.','V.o.G.') #~ yield companyType('G.o.E.','G.o.E.') #~ yield companyType('A.S.B.L.','Association sans but lucratif') #~ yield companyType('Maison','Maison') #~ yield companyType('Fachklinik','Fachklinik') #~ yield companyType("Centre d'Accueil d'Urgence","Centre d'Accueil d'Urgence") #~ yield companyType(**babel_values('name', #~ en=u"Public Limited Company", #~ nl=u'NV (Naamloze Vennootschap)', #~ fr=u'SA (Société Anonyme)', #~ de=u"AG (Aktiengesellschaft)")) for ct in COMPANY_TYPES: yield companyType(**ct) yield roletype(**babel_values('name', en="Manager", fr='Gérant', de="Geschäftsführer", et="Tegevjuht")) yield roletype(**babel_values('name', en="Director", fr='Directeur', de="Direktor", et="Direktor")) yield roletype(**babel_values('name', en="Secretary", fr='Secrétaire', de="Sekretär", et="Sekretär")) yield roletype(**babel_values('name', en="IT Manager", fr='Gérant informatique', de="EDV-Manager", et="IT manager")) yield roletype(**babel_values('name', en="President", fr='Président', de="Präsident", et="President")) if settings.SITE.is_installed('contenttypes'): from django.contrib.contenttypes.models import ContentType I = Instantiator('gfks.HelpText', 'content_type field help_text').build Person = resolve_model("contacts.Person") t = ContentType.objects.get_for_model(Person) #~ yield I(t,'birth_date',u"""\ #~ Unkomplette Geburtsdaten sind erlaubt, z.B. #~ <ul> #~ <li>00.00.1980 : irgendwann in 1980</li> #~ <li>00.07.1980 : im Juli 1980</li> #~ <li>23.07.0000 : Geburtstag am 23. Juli, Alter unbekannt</li> #~ </ul> #~ """) Partner = resolve_model('contacts.Partner') t = ContentType.objects.get_for_model(Partner) yield I(t, 'language', u"""\ Die Sprache, in der Dokumente ausgestellt werden sollen. """)
def objects(): from lino_welfare.modlib.newcomers.models import Broker, Faculty, Competence pcsw = dd.resolve_app('pcsw') Person = dd.resolve_model('contacts.Person') I = Instantiator(Broker).build #~ yield I(**babel_values('name', #~ de=u"Polizei", fr=u"Police",en=u"Police")) #~ yield I(**babel_values('name', #~ de=u"Jugendgericht", fr=u"Jugendgericht",en=u"Jugendgericht")) yield I(name="Police") yield I(name="Other PCSW") I = Instantiator(Faculty).build yield I(weight=10, **babel_values('name', de=u"Eingliederungseinkommen (EiEi)", fr=u"Revenu d'intégration sociale (RIS)", en=u"EiEi")) yield I(weight=5, **babel_values('name', de=u"DSBE", fr=u"Service d'insertion socio-professionnelle", en=u"DSBE")) yield I(weight=4, **babel_values('name', de=u"Ausländerbeihilfe", fr=u"Aide sociale équivalente (pour étrangers)", en=u"Ausländerbeihilfe")) yield I(weight=6, **babel_values('name', de=u"Finanzielle Begleitung", fr=u"Accompagnement budgétaire", en=u"Finanzielle Begleitung")) yield I(weight=2, **babel_values('name', de=u"Laufende Beihilfe", fr=u"Aide complémenataire", en=u"Laufende Beihilfe")) #~ User = resolve_model('users.User') #~ yield User(username="******", #~ first_name="Caroline",last_name="Carnol", # ~ profile='200') # UserTypes.caroline) #~ FACULTIES = Cycler(Faculty.objects.all()) #~ profiles = [p for p in UserTypes.items() if p.integ_level] #~ USERS = Cycler(User.objects.filter(profile__in=profiles)) #~ for i in range(7): #~ yield Competence(user=USERS.pop(),faculty=FACULTIES.pop()) #~ for p in pcsw.Client.objects.filter(client_state=pcsw.ClientStates.new): #~ p.faculty = FACULTIES.pop() #~ p.save() newcomers = dd.resolve_app('newcomers') users = dd.resolve_app('users') QUOTAS = Cycler(100, 60, 50, 20) FACULTIES = Cycler(newcomers.Faculty.objects.all()) profiles = [ p for p in UserTypes.items() if isinstance(p.role, IntegrationAgent) and not isinstance(p.role, dd.SiteStaff)] qs = users.User.objects.filter(profile__in=profiles) for u in qs: u.newcomer_quota = QUOTAS.pop() yield u USERS = Cycler(qs) for i in range(7): yield newcomers.Competence(user=USERS.pop(), faculty=FACULTIES.pop()) for p in pcsw.Client.objects.exclude( client_state=pcsw.ClientStates.former): p.faculty = FACULTIES.pop() p.save()
def objects(): mailType = Instantiator('notes.NoteType').build yield mailType(**dd.babel_values( 'name', en="Enrolment", fr=u'Inscription', de=u"Einschreibeformular")) yield mailType(**dd.babel_values( 'name', en="Timetable", fr=u'Horaire', de=u"Stundenplan")) yield mailType( **dd.babel_values('name', en="Letter", fr=u'Lettre', de=u"Brief"))
def be_province(de, fr, nl): if False: # AFTER17: p = Place( country=BE, type=PlaceTypes.province.pk, **dd.babel_values('name', de=de, fr=fr, nl=nl, en=fr, et=fr)) else: p = Place( country=BE, type=PlaceTypes.province, **dd.babel_values('name', de=de, fr=fr, nl=nl, en=fr, et=fr)) return p
def objects(): add = Instantiator('cal.Priority', 'ref').build yield add('1', **dd.babel_values('name', en=u"very urgent", de=u"sehr dringend", fr=u"très urgent", et=u"väga kiire")) yield add('3', **dd.babel_values('name', en=u"urgent", de=u"dringend", fr=u"urgent", et="kiire")) yield add('5', **dd.babel_values('name', en=u"normal", de=u"normal", fr=u"normal", et="keskmine")) yield add('9', **dd.babel_values('name', en=u"not urgent", de=u"nicht dringend", fr=u"pas urgent", et="mitte kiire")) calendar = Instantiator('cal.Calendar').build general = calendar(**dd.str2kw('name', _("General"))) # de="Allgemein", # fr="Général", yield general settings.SITE.site_config.site_calendar = general yield settings.SITE.site_config event_type = Instantiator('cal.EventType').build holidays = event_type( is_appointment=False, all_rooms=True, **dd.str2kw('name', _("Holidays"))) yield holidays yield event_type(**dd.str2kw('name', _("Meeting"))) RecurrentEvent = dd.resolve_model('cal.RecurrentEvent') add = Instantiator(RecurrentEvent, event_type=holidays).build def holiday(month, day, en, de, fr, et=None): if et is None: et = en return add( every_unit=cal.Recurrencies.yearly, monday=True, tuesday=True, wednesday=True, thursday=True, friday=True, saturday=True, sunday=True, every=1, start_date=datetime.date( year=cal.DEMO_START_YEAR, month=month, day=day), **dd.babelkw('name', en=en, de=de, fr=fr, et=et)) yield holiday(1, 1, "New Year's Day", "Neujahr", "Jour de l'an", "Uusaasta") yield holiday(5, 1, "International Workers' Day", "Tag der Arbeit", "Premier Mai", "kevadpüha") yield holiday(7, 21, "National Day", "Nationalfeiertag", "Fête nationale", "Belgia riigipüha") yield holiday(8, 15, "Assumption of Mary", "Mariä Himmelfahrt", "Assomption de Marie") yield holiday(10, 31, "All Souls' Day", "Allerseelen", "Commémoration des fidèles défunts") yield holiday(11, 1, "All Saints' Day", "Allerheiligen", "Toussaint") yield holiday(11, 11, "Armistice with Germany", "Waffenstillstand", "Armistice") yield holiday(12, 25, "Christmas", "Weihnachten", "Noël", "Esimene Jõulupüha") summer = holiday(07, 01, "Summer holidays", "Sommerferien", "Vacances d'été", "Suvevaheaeg") summer.end_date = summer.start_date.replace(month=8, day=31) yield summer ar = settings.SITE.login() for obj in RecurrentEvent.objects.all(): if not obj.update_reminders(ar): raise Exception("Oops, %s generated no events" % obj)
def objects(): mailType = Instantiator('notes.NoteType').build yield mailType(**dd.babel_values('name', en="Enrolment", fr=u'Inscription', de=u"Einschreibeformular")) yield mailType(**dd.babel_values('name', en="Timetable", fr=u'Horaire', de=u"Stundenplan")) yield mailType(**dd.babel_values('name', en="Letter", fr=u'Lettre', de=u"Brief"))
def objects(): ptype = Instantiator('properties.PropType').build division = ptype( **dd.babel_values('name', **dict( en="Division", fr="Division", de=u"Abteilung"))) yield division divchoice = Instantiator( 'properties.PropChoice', 'value', type=division).build yield divchoice('1', **dd.babel_values( 'text', **dict(en="Furniture", de=u"Möbel", fr=u"Meubles"))) yield divchoice('2', **dd.babel_values( 'text', **dict(en="Web hosting", de=u"Hosting", fr=u"Hosting")))
def objects(): if False: yield sales.InvoicingMode(**dd.babel_values( 'name', en='Default', de="Standard", fr="Standard")) if ledger: Invoice = dd.resolve_model('sales.VatProductInvoice') InvoiceItem = dd.resolve_model('sales.InvoiceItem') vt = ledger.VoucherTypes.get_for_model(Invoice) JOURNALS = Cycler(vt.get_journals()) if len(JOURNALS.items) == 0: raise Exception("20140127 no journals for %s" % vt) PARTNERS = Cycler(Partner.objects.all()) USERS = Cycler(settings.SITE.user_model.objects.all()) PRODUCTS = Cycler(rt.models.products.Product.objects.all()) ITEMCOUNT = Cycler(1, 2, 3) for i in range(20): jnl = JOURNALS.pop() invoice = Invoice(journal=jnl, partner=PARTNERS.pop(), user=USERS.pop(), date=settings.SITE.demo_date(i - 21)) yield invoice for j in range(ITEMCOUNT.pop()): item = InvoiceItem(voucher=invoice, product=PRODUCTS.pop()) item.product_changed(REQUEST) item.before_ui_save(REQUEST) yield item invoice.register(REQUEST) invoice.save()
def objects(): if False: yield sales.InvoicingMode( **dd.babel_values( 'name', en='Default', de="Standard", fr="Standard")) if ledger: Invoice = dd.resolve_model('sales.VatProductInvoice') InvoiceItem = dd.resolve_model('sales.InvoiceItem') vt = ledger.VoucherTypes.get_for_model(Invoice) JOURNALS = Cycler(vt.get_journals()) if len(JOURNALS.items) == 0: raise Exception("20140127 no journals for %s" % vt) PARTNERS = Cycler(Partner.objects.all()) USERS = Cycler(settings.SITE.user_model.objects.all()) PRODUCTS = Cycler(rt.models.products.Product.objects.all()) ITEMCOUNT = Cycler(1, 2, 3) for i in range(20): jnl = JOURNALS.pop() invoice = Invoice( journal=jnl, partner=PARTNERS.pop(), user=USERS.pop(), date=settings.SITE.demo_date(i-21)) yield invoice for j in range(ITEMCOUNT.pop()): item = InvoiceItem(voucher=invoice, product=PRODUCTS.pop()) item.product_changed(REQUEST) item.before_ui_save(REQUEST) yield item invoice.register(REQUEST) invoice.save()
def objects(): Sector = resolve_model('cbss.Sector') #~ for ln in SECTORS.splitlines(): #~ if ln: #~ a = ln.split(None,1) #~ labels = [s.strip() for s in a[1].split('|')] #~ if len(labels) != 3: #~ raise Exception("Line %r : labels is %r" %(ln,labels)) #~ if not labels[2]: #~ labels[2] = labels[0] #~ yield Sector(code=int(a[0]),**babel_values('name',fr=labels[0],nl=labels[1],de=labels[2])) Purpose = resolve_model('cbss.Purpose') for ln in PURPOSES.splitlines(): if ln: a = ln.split(None, 2) #~ assert a[0] in ('*', '17') sc = a[0] if sc == '*': sc = None else: #~ sector = Sector.objects.get(code=int(sc)) sc = int(sc) labels = [s.strip() for s in a[2].split('|')] if len(labels) == 2: labels.append(labels[0]) elif len(labels) != 3: raise Exception("Line %r : labels is %r" % (ln, labels)) yield Purpose(sector_code=sc, code=int(a[1]), **babel_values('name', en=labels[0], fr=labels[0], nl=labels[1], de=labels[2]))
def objects(): countries = dd.resolve_app('countries') city = Instantiator(countries.Place, "zip_code name", country='BE', type=countries.PlaceTypes.city).build for ln in belgian_cities.splitlines(): ln = ln.strip() if ln and ln[0] != '#': args = ln.split(None, 1) o = city(*args) # print "%r %r" % (o.zip_code, o.name) yield o #~ print __name__, "20121114" #~ return for ln in belgian_cities_nl_fr.splitlines(): ln = ln.strip() if ln and ln[0] != '#': args = ln.split('|') if len(args) != 4: raise Exception("Invalid format : \n%s" % ln) args = [x.strip() for x in args] o = city(zip_code=args[0], **dd.babel_values('name', nl=args[1], fr=args[2], de=args[3], en=args[3])) yield o
def be_city(zip_code, de=None, fr=None, nl=None, en=None, **kw): kw.update(dd.babel_values('name', de=de, fr=fr, nl=nl, en=en, et=en)) if False: # AFTER17: kw.setdefault('type', PlaceTypes.city.pk) if kw.get('type',False) and isinstance(kw.get('type',False),PlaceType): kw['type'] = kw['type'].pk else: kw.setdefault('type', PlaceTypes.city) return Place(country=BE, zip_code=zip_code, **kw)
def Group(ref, type, fr, de, en, et=None): if et is None: et = en global current_group current_group = rt.models.accounts.Group( ref=ref, account_type=AccountTypes.get_by_name(type), **dd.babel_values('name', de=de, fr=fr, en=en, et=et)) return current_group
def Group(ref, type, fr, de, en, et=None): if et is None: et = en global current_group current_group = accounts.Group( ref=ref, account_type=accounts.AccountTypes.get_by_name(type), **dd.babel_values('name', de=de, fr=fr, en=en, et=et)) return current_group
def objects(): Partner = rt.models.contacts.Partner Person = rt.models.contacts.Person for ct in COMPANY_TYPES: yield companyType(**ct) yield roletype(**babel_values('name', en="Manager", fr='Gérant', de="Geschäftsführer", et="Tegevjuht")) yield roletype(**babel_values('name', en="Director", fr='Directeur', de="Direktor", et="Direktor")) yield roletype(**babel_values('name', en="Secretary", fr='Secrétaire', de="Sekretär", et="Sekretär")) yield roletype(**babel_values('name', en="IT Manager", fr='Gérant informatique', de="EDV-Manager", et="IT manager")) yield roletype(**babel_values('name', en="President", fr='Président', de="Präsident", et="President")) if dd.is_installed('excerpts') and dd.is_installed('appypod'): ExcerptType = rt.models.excerpts.ExcerptType ContentType = rt.models.contenttypes.ContentType yield ExcerptType( build_method='appypdf', template="TermsConditions.odt", content_type=ContentType.objects.get_for_model(Person), **dd.str2kw('name', _("Terms & conditions"))) if dd.is_installed('contenttypes'): ContentType = rt.models.contenttypes.ContentType I = Instantiator('gfks.HelpText', 'content_type field help_text').build t = ContentType.objects.get_for_model(Person) #~ yield I(t,'birth_date',u"""\ #~ Unkomplette Geburtsdaten sind erlaubt, z.B. #~ <ul> #~ <li>00.00.1980 : irgendwann in 1980</li> #~ <li>00.07.1980 : im Juli 1980</li> #~ <li>23.07.0000 : Geburtstag am 23. Juli, Alter unbekannt</li> #~ </ul> #~ """) t = ContentType.objects.get_for_model(Partner) yield I(t, 'language', u"""\ Die Sprache, in der Dokumente ausgestellt werden sollen. """)
def objects(): ptype = Instantiator('properties.PropType').build properties = dd.resolve_app('properties') yield ptype(id=1, **dd.babel_values('name', **dict( en="Present or not", de=u"Vorhanden oder nicht", fr=u"Présent ou pas", et=u"Olemas või mitte", nl=u"Ja of niet", ))) yield ptype(id=2, choicelist=properties.HowWell.actor_id, default_value=properties.HowWell.default.value, **dd.babel_values('name', **dict( en="Rating", de=u"Bewertung", et=u"Hinnang", fr=u"Appréciation(?)", nl=u"Hoe goed", )))
def objects(): n = 0 for code, kw in LANGUAGES.items(): iso2 = kw['iso2'] kw = dd.babel_values('name', **kw) if kw.get('name'): n += 1 kw.update(iso2=iso2) yield Language(id=code, **kw) else: logger.debug("%r : no name for default site language %s", code, settings.SITE.DEFAULT_LANGUAGE.django_code)
def objects(): if False: guest_role = Instantiator('cal.GuestRole').build yield guest_role(**dd.babel_values( 'name', de=u"Teilnehmer", fr=u"Participant", en=u"Participant", et=u"Osavõtja", )) yield guest_role(**dd.babel_values( 'name', de=u"Reiseführer", fr=u"Guide", en=u"Guide", et=u"Reisijuht", )) yield guest_role(**dd.babel_values( 'name', de=u"Vorsitzender", fr=u"Président", en=u"Presider", et=u"Eesistuja", )) yield guest_role(**dd.babel_values( 'name', de=u"Protokollführer", fr=u"Greffier", en=u"Reporter", et=u"Sekretär", )) if False: place = Instantiator('cal.Room').build yield place(**dd.babel_values( 'name', de=u"Büro", fr=u"Bureau", en=u"Office", )) yield place(**dd.babel_values( 'name', de=u"Beim Klienten", fr=u"Chez le client", en=u"A the client's", )) yield place(**dd.babel_values( 'name', de=u"beim Arbeitgeber", fr=u"chez l'employeur", en=u"at employer's", ))
def objects(): n = 0 Country = settings.SITE.models.countries.Country """ """ fn = os.path.join(os.path.dirname(__file__), 'countries.xml') logger.debug("Reading %s", fn) dom = minidom.parse(fn) #~ print dom.documentElement.__class__ #~ print dom.documentElement for coun in dom.documentElement.getElementsByTagName('coun:country'): names = {} for name in coun.getElementsByTagName('coun:name'): assert len(name.childNodes) == 1 #~ print [n.data for n in ] #~ print name.firstChild.data names[str(name.attributes['lang'].value)] = name.firstChild.data kw = dd.babel_values('name', **names) iso2 = coun.getElementsByTagName('coun:alpha2')[0].childNodes[0].data if Country.objects.filter(pk=iso2).count() > 0: logger.debug("ISO code %r already exists %s", iso2, coun) continue kw.update( isocode=iso2, iso3=coun.getElementsByTagName( 'coun:alpha3')[0].childNodes[0].data, ) if not 'name' in kw: kw['name'] = names['en'] if kw['name']: #~ kw.update(iso3=iso3) n += 1 yield Country(**kw) else: logger.warning( "%r : no name for default site language %s", coun, settings.SITE.DEFAULT_LANGUAGE.django_code) for ln in TABLE2.splitlines(): ln = ln.strip() if ln: code1, code2, code3, name = ln.split(None, 3) n += 1 yield Country(isocode=code1, name=name) logger.info("Installed %d countries", n)
def objects(): productcat = Instantiator('products.ProductCat').build product = Instantiator('products.Product', "cat name").build food = productcat(**dd.babel_values( 'name', en="Food", et="Toit", de="Lebensmittel", fr="Alimentaire")) yield food yield product( food, "Le petit Fagnard", **dd.babel_values( 'description', en="Handmade cheese from Hautes Ardennes", et="Käsitsi valmistatud juust Ardenne'idest", de="Handgemachter Käse aus den Hohen Ardennen", fr="Fromage artisanal au lait cru des Hautes Ardennes")) if False: # we need an address parser which either returns or # creates the city. Here we don't want to know whether # `countries.fixtures.be` has been loaded. company = Instantiator('contacts.Company', "name country:isocode city:zip_code").build yield company("Fromagerie du Troufleur", "BE", "4950 Waimes")
def objects(): productcat = Instantiator('products.ProductCat').build product = Instantiator('products.Product', "cat name").build food = productcat(**dd.babel_values( 'name', en="Food", et="Toit", de="Lebensmittel", fr="Alimentaire")) yield food yield product(food, "Le petit Fagnard", **dd.babel_values( 'description', en="Handmade cheese from Hautes Ardennes", et="Käsitsi valmistatud juust Ardenne'idest", de="Handgemachter Käse aus den Hohen Ardennen", fr="Fromage artisanal au lait cru des Hautes Ardennes")) if False: # we need an address parser which either returns or # creates the city. Here we don't want to know whether # `countries.fixtures.be` has been loaded. company = Instantiator( 'contacts.Company', "name country:isocode city:zip_code").build yield company("Fromagerie du Troufleur", "BE", "4950 Waimes")
def objects(): n = 0 Country = settings.SITE.modules.countries.Country """ """ fn = os.path.join(os.path.dirname(__file__), 'countries.xml') logger.debug("Reading %s", fn) dom = minidom.parse(fn) #~ print dom.documentElement.__class__ #~ print dom.documentElement for coun in dom.documentElement.getElementsByTagName('coun:country'): names = {} for name in coun.getElementsByTagName('coun:name'): assert len(name.childNodes) == 1 #~ print [n.data for n in ] #~ print name.firstChild.data names[str(name.attributes['lang'].value)] = name.firstChild.data kw = dd.babel_values('name', **names) iso2 = coun.getElementsByTagName('coun:alpha2')[0].childNodes[0].data if Country.objects.filter(pk=iso2).count() > 0: logger.debug("ISO code %r already exists %s", iso2, coun) continue kw.update( isocode=iso2, iso3=coun.getElementsByTagName('coun:alpha3') [0].childNodes[0].data, ) if not 'name' in kw: kw['name'] = names['en'] if kw['name']: #~ kw.update(iso3=iso3) n += 1 yield Country(**kw) else: logger.warning("%r : no name for default site language %s", coun, settings.SITE.DEFAULT_LANGUAGE.django_code) for ln in TABLE2.splitlines(): ln = ln.strip() if ln: code1, code2, code3, name = ln.split(None, 3) n += 1 yield Country(isocode=code1, name=name) logger.info("Installed %d countries", n)
def objects(): if False: guest_role = Instantiator('cal.GuestRole').build yield guest_role(**dd.babel_values('name', de=u"Teilnehmer", fr=u"Participant", en=u"Participant", et=u"Osavõtja", )) yield guest_role(**dd.babel_values('name', de=u"Reiseführer", fr=u"Guide", en=u"Guide", et=u"Reisijuht", )) yield guest_role(**dd.babel_values('name', de=u"Vorsitzender", fr=u"Président", en=u"Presider", et=u"Eesistuja", )) yield guest_role(**dd.babel_values('name', de=u"Protokollführer", fr=u"Greffier", en=u"Reporter", et=u"Sekretär", )) if False: place = Instantiator('cal.Room').build yield place(**dd.babel_values('name', de=u"Büro", fr=u"Bureau", en=u"Office", )) yield place(**dd.babel_values('name', de=u"Beim Klienten", fr=u"Chez le client", en=u"A the client's", )) yield place(**dd.babel_values('name', de=u"beim Arbeitgeber", fr=u"chez l'employeur", en=u"at employer's", ))
def objects(): # source: https://www.riziv.fgov.be/fr/professionnels/autres/mutualites/Pages/contactez-mutualites.aspx bxl = rt.models.countries.Place.objects.get( **dd.babel_values('name', de="Brüssel", en="Brussels")) kw = dict(country_id="BE", city=bxl) def provider(ref, name, **kwargs): prov = Company(name=name, **kwargs) yield prov yield Plan(provider=prov, ref=ref) yield provider(_("Christian HIS"), "Alliance nationale des mutualités chrétiennes", street="Haachtsesteenweg 579", street_box="postbus 40", zip_code="1031") yield provider(_("Neutral HIS"), "Union nationale des mutualités neutres", street="Chaussée de Charleroi", street_no="145", zip_code="1060") yield provider(_("Socialist HIS"), "Union nationale des mutualités socialistes", street="Rue Saint-Jean", street_no="32-38", zip_code="1000") yield provider(_("Liberal HIS"), "Union nationale des Mutualités Libérales", street="Rue de Livourne", street_no="25", zip_code="1050") yield provider(_("Libre HIS"), "Union nationale des mutualités libres", street="Lenniksebaan", street_no="788A", zip_code="1070")
def objects(): """ Education levels in Belgium: http://www.guide-enseignement.be/infos_pages/diplomes.html Certificat d'études de base (CEB) Certificat d'enseignement secondaire du deuxième degré (C.E.S.D.D.) Certificat d'études de sixième année de l'enseignement secondaire professionnel (C.E.6.P.) Certificat de qualification (C.Q.) Certificat d'enseignement secondaire supérieur (C.E.S.S.) Certificat relatif aux connaissances de gestion de base Brevet d’enseignement secondaire complémentaire – section "soins infirmiers(E.P.S.C.)" """ eduLevel = Instantiator('cv.EducationLevel').build yield eduLevel( **dd.babel_values('name', de="Primär", fr="Primaire", en="Primary")) yield eduLevel(**dd.babel_values( 'name', de="Sekundär", fr="Secondaire", en="Secondary")) yield eduLevel(**dd.babel_values( 'name', de="Hochschule", fr="Supérieur", en="Higher")) yield eduLevel( **dd.babel_values('name', de="Bachelor", fr="Bachelor", en="Bachelor")) yield eduLevel( **dd.babel_values('name', de="Master", fr="Master", en="Master")) studyType = Instantiator('cv.StudyType').build yield studyType(**dd.babel_values( 'name', de=u"Schule", fr=u"École", en=u"School", )) yield studyType(**dd.babel_values( 'name', de=u"Sonderschule", fr=u"École spéciale", en=u"Special school", )) yield studyType(**dd.babel_values( 'name', de=u"Ausbildung", fr=u"Formation", en=u"Training", )) yield studyType(**dd.babel_values( 'name', de=u"Lehre", fr=u"Apprentissage", en=u"Apprenticeship", )) yield studyType(**dd.babel_values( 'name', de=u"Hochschule", fr=u"École supérieure", en=u"Highschool", )) yield studyType(**dd.babel_values( 'name', de=u"Universität", fr=u"Université", en=u"University", )) yield studyType(**dd.babel_values( 'name', de=u"Teilzeitunterricht", fr=u"Cours à temps partiel", en=u"Part-time study", )) yield studyType(**dd.babel_values( 'name', de=u"Fernkurs", fr=u"Cours à distance", en=u"Remote study", )) M = Instantiator('cv.StudyType', is_training=True, is_study=False).build yield M(**dd.str2kw('name', _("Prequalifying"))) yield M(**dd.str2kw('name', _("Qualifying"))) yield M(**dd.str2kw('name', _("Alpha"))) M = Instantiator('cv.Duration').build yield M(**dd.str2kw('name', _("Unlimited duration"))) yield M(**dd.str2kw('name', _("Limited duration"))) yield M(**dd.str2kw('name', _("Clearly defined job"))) yield M(**dd.str2kw('name', _("Replacement"))) yield M(**dd.str2kw('name', _("Interim"))) """ Contrat de travail à durée indéterminée - Arbeidsovereenkomst voor onbepaalde tijd Contrat de travail à durée déterminée - Arbeidsovereenkomst voor bepaalde tijd Contrat pour un travail nettement défini - Arbeidsovereenkomst voor een duidelijk omschreven werk Contrat de remplacement - Vervangingsovereenkomst Contrat d’intérim Convention de premier emploi Contrat de travail à temps partiel """ status = Instantiator('cv.Status').build yield status(**dd.str2kw('name', _("Worker"))) yield status(**dd.str2kw('name', _("Employee"))) yield status(**dd.str2kw('name', _("Freelancer"))) yield status(**dd.str2kw('name', _("Voluntary"))) yield status(**dd.str2kw('name', _("Student"))) yield status(**dd.str2kw('name', _("Laboratory"))) # fr=Stage, # de=Praktikum yield status(**dd.str2kw('name', _("Interim"))) regime = Instantiator('cv.Regime').build yield regime(**dd.str2kw('name', _("Full-time"))) yield regime(**dd.str2kw('name', _("Part-time"))) yield regime(**dd.str2kw('name', _("Other")))
def objects(): cal = rt.modules.cal add = Instantiator('cal.Priority', 'ref').build yield add('1', **dd.babel_values('name', en=u"very urgent", de=u"sehr dringend", fr=u"très urgent", et=u"väga kiire")) yield add('3', **dd.babel_values('name', en=u"urgent", de=u"dringend", fr=u"urgent", et="kiire")) yield add('5', **dd.babel_values('name', en=u"normal", de=u"normal", fr=u"normal", et="keskmine")) yield add('9', **dd.babel_values('name', en=u"not urgent", de=u"nicht dringend", fr=u"pas urgent", et="mitte kiire")) calendar = Instantiator('cal.Calendar').build general = calendar(**dd.str2kw('name', _("General"))) yield general # settings.SITE.site_config.site_calendar = general settings.SITE.site_config.update( site_calendar=general, hide_events_before=dd.demo_date().replace(month=4, day=1)) # yield settings.SITE.site_config event_type = Instantiator('cal.EventType').build holidays = event_type( is_appointment=False, all_rooms=True, **dd.str2kw('name', _("Holidays"))) yield holidays yield event_type(**dd.str2kw('name', _("Meeting"))) RecurrentEvent = rt.modules.cal.RecurrentEvent add = Instantiator(RecurrentEvent, event_type=holidays).build def holiday(month, day, en, de, fr, et=None): if et is None: et = en return add( every_unit=cal.Recurrencies.yearly, monday=True, tuesday=True, wednesday=True, thursday=True, friday=True, saturday=True, sunday=True, every=1, start_date=datetime.date( year=cal.DEMO_START_YEAR, month=month, day=day), **dd.babelkw('name', en=en, de=de, fr=fr, et=et)) yield holiday(1, 1, "New Year's Day", "Neujahr", "Jour de l'an", "Uusaasta") yield holiday(5, 1, "International Workers' Day", "Tag der Arbeit", "Premier Mai", "kevadpüha") yield holiday(7, 21, "National Day", "Nationalfeiertag", "Fête nationale", "Belgia riigipüha") yield holiday(8, 15, "Assumption of Mary", "Mariä Himmelfahrt", "Assomption de Marie") yield holiday(10, 31, "All Souls' Day", "Allerseelen", "Commémoration des fidèles défunts") yield holiday(11, 1, "All Saints' Day", "Allerheiligen", "Toussaint") yield holiday(11, 11, "Armistice with Germany", "Waffenstillstand", "Armistice") yield holiday(12, 25, "Christmas", "Weihnachten", "Noël", "Esimene Jõulupüha") easter1 = easter(cal.DEMO_START_YEAR) def relative_holiday(offset, name): return add( every_unit=cal.Recurrencies.easter, every=1, start_date=easter1+relativedelta(days=offset), **dd.str2kw('name', name)) yield relative_holiday(0, _("Easter sunday")) yield relative_holiday(1, _("Easter monday")) yield relative_holiday(39, _("Ascension of Jesus")) yield relative_holiday(50, _("Pentecost")) yield relative_holiday(-2, _("Good Friday")) yield relative_holiday(-46, _("Ash Wednesday")) yield relative_holiday(-48, _("Rosenmontag")) ar = settings.SITE.login() for obj in RecurrentEvent.objects.all(): if not obj.update_reminders(ar): raise Exception("Oops, %s generated no events" % obj)
def objects(): LANGUAGES = {} fn = os.path.join(os.path.dirname(__file__), 'iso-639-3_20100707.tab') n = 0 #~ for ln in file(fn).readlines(): with codecs.open(fn, encoding="UTF-8") as fd: for ln in fd.readlines(): n += 1 if ln: rec = ln.split('\t') if len(rec) != 8: dd.logger.warning("Ignored line %d (len(rec) is %d)", n, len(rec)) elif len(rec[0]) != 3: dd.logger.warning("Ignored line %d", n) else: language_type = rec[5] if language_type == 'L': ref_name = rec[6] if ref_name: code = rec[0] if len(rec[1]) == 3: code = rec[1] LANGUAGES[code] = dict(en=ref_name, iso2=rec[3]) else: dd.logger.debug( "Ignored line %d : language type is %r", n, language_type) n = 0 for ln in german.splitlines(): n += 1 if ln: ln = ln.strip() if not ln[-4:-3].isspace(): logger.warning("german %d: syntax", n) else: code = ln[-3:] name = ln[:-4] d = LANGUAGES.get(code, None) if d is None: pass #~ logger.warning("%r in german but not english",code) #~ d = dict(en=name) #~ LANGUAGES[code] = d else: d.update(de=name) n = 0 for ln in french.splitlines(): n += 1 if ln: ln = ln.strip() rec = ln.split('\t') if len(rec) < 6: logger.warning("Ignored french:%d:%s (len(rec) is %d)", n, ln, len(rec)) code = rec[1] if len(code) == 7: if code[3:4] == '/': code = code[:3] else: code = None if code: name = rec[3] d = LANGUAGES.get(code, None) if d is not None: d.update(fr=name) n = 0 for code, kw in LANGUAGES.items(): iso2 = kw['iso2'] kw = dd.babel_values('name', **kw) if kw.get('name'): n += 1 kw.update(iso2=iso2) yield Language(id=code, **kw) else: logger.debug("%r : no name for default site language %s", code, settings.SITE.DEFAULT_LANGUAGE.django_code)
def objects(): #~ dblogger.info("Installing countries few_cities fixture") countries = dd.resolve_app('countries') #~ Place = resolve_model('countries.Place') Place = countries.Place Country = countries.Country PlaceTypes = countries.PlaceTypes city = Instantiator(Place, 'name country').build def make_city(country_id, name=None, **kw): if False: # AFTER17: kw.setdefault('type', PlaceTypes.city.pk) if kw.get('type',False) and isinstance(kw.get('type',False),PlaceType): kw['type'] = kw['type'].pk else: kw.setdefault('type', PlaceTypes.city) flt = rt.lookup_filter( 'name', name, country__isocode=country_id, **kw) try: return Place.objects.get(flt) # return Place.objects.exclude(type__in=[ # PlaceTypes.county, PlaceTypes.province]).get(flt) except MultipleObjectsReturned: #~ qs = Place.objects.exclude(type=PlaceTypes.county).filter(country__isocode=country_id,name=name) raise Exception("Oops, there are multiple cities for %r", name) except Place.DoesNotExist: obj = city(name, country_id, **kw) obj.full_clean() obj.save() return obj BE = Country.objects.get(pk='BE') DE = Country.objects.get(pk='DE') FR = Country.objects.get(pk='FR') eupen = make_city('BE', 'Eupen', zip_code='4700') yield eupen yield make_city('BE', 'Nispert', type=PlaceTypes.township, parent=eupen) reuland = make_city('BE', 'Burg-Reuland ', zip_code='4790') yield make_city('BE', 'Ouren', type=PlaceTypes.township, parent=reuland) yield Place(country=BE, zip_code='4720', type=PlaceTypes.city, **dd.babel_values('name', de='Kelmis', fr='La Calamine', en="Kelmis", et="Kelmis")) yield make_city('BE', 'Kettenis', zip_code='4701', type=PlaceTypes.village) yield make_city('BE', 'Raeren', zip_code='4730', type=PlaceTypes.village) yield make_city('BE', 'Angleur', zip_code='4031') yield make_city('BE', 'Ans', zip_code='4430') yield make_city('BE', 'Ottignies', zip_code='1340') yield make_city('BE', 'Thieusies', zip_code='7061') yield make_city('BE', 'Cuesmes', zip_code='7033') yield make_city('BE', 'La Reid', zip_code='4910') yield make_city('BE', 'Blégny ', zip_code='4670') yield make_city('BE', 'Trembleur ', zip_code='4670') yield make_city('BE', 'Mortier ', zip_code='4670') yield make_city('BE', 'Cerfontaine', zip_code='5630') yield make_city('BE', 'Burdinne', zip_code='4210') def be_province(de, fr, nl): if False: # AFTER17: p = Place( country=BE, type=PlaceTypes.province.pk, **dd.babel_values('name', de=de, fr=fr, nl=nl, en=fr, et=fr)) else: p = Place( country=BE, type=PlaceTypes.province, **dd.babel_values('name', de=de, fr=fr, nl=nl, en=fr, et=fr)) return p def be_city(zip_code, de=None, fr=None, nl=None, en=None, **kw): kw.update(dd.babel_values('name', de=de, fr=fr, nl=nl, en=en, et=en)) if False: # AFTER17: kw.setdefault('type', PlaceTypes.city.pk) if kw.get('type',False) and isinstance(kw.get('type',False),PlaceType): kw['type'] = kw['type'].pk else: kw.setdefault('type', PlaceTypes.city) return Place(country=BE, zip_code=zip_code, **kw) yield be_province("Antwerpen", "Anvers", "Antwerpen") yield be_province("Luxemburg", "Luxembourg", "Luxemburg") yield be_province("Namür", "Namur", "Namen") prov = be_province("Limburg", "Limbourg", "Limburg") yield prov yield make_city('BE', 'Aalst-bij-Sint-Truiden', zip_code='3800', parent=prov, type=PlaceTypes.village) prov = be_province("Lüttich", "Liège", "Luik") yield prov yield be_city('4000', "Lüttich", "Liège", "Luik", "Liège", parent=prov) yield be_city('4750', "Bütgenbach", "Butgenbach", "Butgenbach", "Butgenbach", parent=prov) yield be_city('4760', "Büllingen", "Bullange", "Büllingen", "Büllingen", parent=prov) yield be_city('4780', "Sankt Vith", "Saint-Vith", "Sankt Vith", "Sankt Vith", parent=prov) yield be_city('4780', "Recht", "Recht", "Recht", "Recht", parent=prov) yield be_city('4837', "Baelen", "Baelen", "Baelen", "Baelen", parent=prov) yield be_province("Hennegau", "Hainaut", "Henegouwen") yield be_province("Wallonisch-Brabant", "Brabant wallon", "Waals-Brabant") yield be_province("Flämisch-Brabant", "Brabant flamant", "Vlaams-Brabant") prov = be_province("Ostflandern", "Flandre de l'Est", "Oost-Vlaanderen") yield prov aalst = be_city('9300', "Aalst", "Alost", "Aalst", "Aalst", parent=prov) yield aalst yield be_city('9308', name="Gijzegem", parent=aalst, type=PlaceTypes.village) yield be_city('9310', name="Baardegem", parent=aalst, type=PlaceTypes.village) yield be_city('9320', name="Erembodegem", parent=aalst, type=PlaceTypes.village) yield be_city('9310', name="Herdersem", parent=aalst, type=PlaceTypes.village) yield be_city('9308', name="Hofstade", parent=aalst, type=PlaceTypes.village) yield be_city('9310', name="Meldert", parent=aalst, type=PlaceTypes.village) yield be_city('9320', name="Nieuwerkerken", parent=aalst, type=PlaceTypes.village) yield be_city('9310', name="Moorsel", parent=aalst, type=PlaceTypes.village) yield be_province("Westflandern", "Flandre de l'Ouest", "West-Vlaanderen") yield be_city('1000', "Brüssel", "Bruxelles", "Brussel", "Brussels") yield be_city('7000', "Bergen", "Mons", "Bergen", "Mons") yield be_city('8400', "Ostende", "Ostende", "Oostende", "Ostende") yield be_city('5000', "Namür", "Namur", "Namen", "Namur") harjumaa = make_city('EE', 'Harju', type=PlaceTypes.county) yield harjumaa parnumaa = make_city('EE', 'Pärnu', type=PlaceTypes.county) yield parnumaa raplamaa = make_city('EE', 'Rapla', type=PlaceTypes.county) yield raplamaa yield make_city('EE', 'Vigala', type=PlaceTypes.municipality, parent=raplamaa) yield make_city('EE', 'Rapla', type=PlaceTypes.town, parent=raplamaa) tallinn = make_city('EE', 'Tallinn', type=PlaceTypes.town, parent=harjumaa) yield tallinn yield make_city('EE', 'Kesklinn', type=PlaceTypes.township, parent=tallinn) yield make_city('EE', 'Põhja-Tallinn', type=PlaceTypes.township, parent=tallinn) yield make_city('EE', 'Pärnu', type=PlaceTypes.town, parent=parnumaa) yield make_city('EE', 'Tartu', type=PlaceTypes.town) yield make_city('EE', 'Narva', type=PlaceTypes.town) yield make_city('EE', 'Ääsmäe', type=PlaceTypes.town, parent=harjumaa) #~ yield make_city(u'Aachen','DE') yield Place(country=DE, type=PlaceTypes.city, **dd.babel_values('name', de='Aachen', fr='Aix-la-Chapelle', nl="Aken", en="Aachen", et="Aachen")) yield Place(country=DE, type=PlaceTypes.city, **dd.babel_values('name', de='Köln', fr='Cologne', nl="Keulen", en="Cologne", et="Köln")) yield make_city('DE', 'Berlin') yield make_city('DE', 'Hamburg') yield Place(country=DE, type=PlaceTypes.city, **dd.babel_values('name', de='München', fr='Munich', en="Munich", et="München")) yield Place(country=DE, type=PlaceTypes.city, **dd.babel_values('name', de='Monschau', fr='Montjoie', en="Monschau", et="Monschau")) yield make_city('NL', 'Maastricht') yield make_city('NL', 'Amsterdam') yield make_city('NL', 'Den Haag') yield make_city('NL', 'Rotterdam') yield make_city('NL', 'Utrecht') yield make_city('NL', 'Breda') yield Place(country=FR, type=PlaceTypes.city, **dd.babel_values('name', de='Paris', fr='Paris', en="Paris", et="Pariis", nl="Parijs")) yield Place(country=FR, type=PlaceTypes.city, **dd.babel_values('name', de='Nizza', fr='Nice', en="Nice", et="Nizza")) yield make_city('FR', 'Metz') yield make_city('FR', 'Strasbourg') yield make_city('FR', 'Nancy') yield make_city('FR', 'Marseille')
def Account(ref, type, fr, de, en, et, **kw): kw.update(dd.babel_values('name', de=de, fr=fr, en=en, et=et)) return accounts.Account(group=current_group, ref=ref, type=accounts.AccountTypes.get_by_name(type), **kw)
def P(en, de, fr, cat): return Product( category=cat, **dd.babel_values('name', en=en, de=de, fr=fr))
def objects(): productcat = Instantiator('products.ProductCat').build product = Instantiator('products.Product', "sales_price cat").build furniture = productcat(id=1, product_type=ProductTypes.default, **dd.babel_values('name', en="Furniture", et="Mööbel", de="Möbel", fr="Meubles")) yield furniture # print "foo", furniture.id, furniture hosting = productcat(id=2, product_type=ProductTypes.default, **dd.babel_values('name', en="Website Hosting", et="Veebimajutus", de="Website-Hosting", fr="Hébergement de sites Internet")) yield hosting other = productcat(id=3, **dd.str2kw('name', _("Other"))) yield other kw = dd.babel_values('name', en="Wooden table", et=u"Laud puidust", de="Tisch aus Holz", fr=u"Table en bois") kw.update( dd.babel_values( 'description', en="""\ This table is made of pure wood. It has **four legs**. Designed to fit perfectly with **up to 6 wooden chairs**. Product of the year 2008.""", et="""\ See laud on tehtud ehtsast puust. Sellel on **neli jalga**. Disainitud sobida kokku **kuni 6 puidust tooliga**. Product of the year 2008.""", de="""\ Dieser Tisch ist aus echtem Holz. Er hat **vier Beine**. Passt perfekt zusammen mit **bis zu 6 Stühlen aus Holz**. Produkt des Jahres 2008.""", fr="""\ Cette table est en bois authentique. Elle a **quatre jambes**. Conçue pour mettre jusqu'à **6 chaises en bois**. Produit de l'année 2008.""", )) yield product("199.99", 1, **kw) yield product( "99.99", 1, **dd.babel_values('name', en="Wooden chair", et="Tool puidust", de="Stuhl aus Holz", fr="Chaise en bois")) yield product( "129.99", 1, **dd.babel_values('name', en="Metal table", et="Laud metallist", de="Tisch aus Metall", fr="Table en métal")) yield product( "79.99", 1, **dd.babel_values('name', en="Metal chair", et="Tool metallist", de="Stuhl aus Metall", fr="Chaise en métal")) hosting = product( "3.99", 2, **dd.babel_values('name', en="Website hosting 1MB/month", et="Majutus 1MB/s", de="Website-Hosting 1MB/Monat", fr="Hébergement 1MB/mois")) yield hosting yield product( "30.00", 2, **dd.babel_values('name', en="IT consultation & maintenance", et=u"IKT konsultatsioonid & hooldustööd", de=u"EDV Konsultierung & Unterhaltsarbeiten", fr=u"ICT Consultation & maintenance")) yield product( "35.00", 2, **dd.babel_values( 'name', en="Server software installation, configuration and administration", et= "Serveritarkvara installeerimine, seadistamine ja administreerimine", de="Server software installation, configuration and administration", fr="Server software installation, configuration and administration" )) yield product( "40.00", 2, **dd.babel_values('name', en="Programming", et="Programmeerimistööd", de="Programmierung", fr="Programmation")) yield product( "25.00", 2, **dd.babel_values( 'name', en="Image processing and website content maintenance", et="Pilditöötlus ja kodulehtede sisuhaldustööd", de="Bildbearbeitung und Unterhalt Website", fr="Traitement d'images et maintenance site existant")) yield product("29.90", 3, **dd.str2kw('name', _("Book"), vat_class="reduced")) yield product("1.40", 3, **dd.str2kw('name', _("Stamp"), vat_class="exempt"))
def objects(): IncomeConfirmation = rt.modules.aids.IncomeConfirmation RefundConfirmation = rt.modules.aids.RefundConfirmation SimpleConfirmation = rt.modules.aids.SimpleConfirmation ConfirmationTypes = rt.modules.aids.ConfirmationTypes aidType = Instantiator( 'aids.AidType', confirmation_type=ConfirmationTypes.get_for_model( IncomeConfirmation)).build kw = dd.babelkw( 'name', de="Eingliederungseinkommen", en="Eingliederungseinkommen", fr="Revenu d'intégration") kw.update(short_name="EiEi") kw.update(is_integ_duty=True) kw.update(body_template='integ_income.body.html') kw.update(dd.str2kw('excerpt_title', _("Attestation"))) yield aidType(**kw) kw = dd.babelkw( 'name', de="Ausländerbeihilfe", en="Ausländerbeihilfe", fr="Aide aux immigrants") kw.update(body_template='foreigner_income.body.html') kw.update(is_integ_duty=True) kw.update(dd.str2kw('excerpt_title', _("Attestation"))) yield aidType(**kw) kw = dd.babelkw( 'name', de="Feste Beihilfe", en="Feste Beihilfe", fr="Revenu fixe") kw.update(body_template='fixed_income.body.html') kw.update(dd.str2kw('excerpt_title', _("Attestation"))) yield aidType(**kw) aidType = Instantiator( 'aids.AidType', "name", confirmation_type=ConfirmationTypes.get_for_model( SimpleConfirmation)).build kw = dd.babelkw( 'name', de="Erstattung", en="Erstattung", fr="Remboursement") kw.update(body_template='certificate.body.html') kw.update(dd.str2kw('excerpt_title', _("Attestation"))) yield aidType(**kw) kw = dd.babelkw( 'name', de="Übernahmeschein", en="Übernahmeschein", fr="Übernahmeschein") kw.update(body_template='certificate.body.html') kw.update(dd.str2kw('excerpt_title', _("Attestation"))) yield aidType(**kw) aidType = Instantiator( 'aids.AidType', "name", confirmation_type=ConfirmationTypes.get_for_model( RefundConfirmation)).build kw = dd.babelkw( 'name', de="Übernahme von Arzt- und/oder Medikamentenkosten", en="Medical costs", fr="Remboursement de frais médicaux") kw.update(short_name="AMK") fkw = dd.str2kw('name', _("Pharmacy")) # Apotheke cct_pharmacy = rt.modules.pcsw.ClientContactType.objects.get(**fkw) kw.update(pharmacy_type=cct_pharmacy) kw.update(body_template='medical_refund.body.html') kw.update(dd.str2kw('excerpt_title', _("Attestation"))) yield aidType(**kw) kw = dd.babelkw( 'name', de="Dringende Medizinische Hilfe", nl="Dringende medische Hulp", en="Urgent Medical Care", fr="Aide Médicale Urgente") kw.update(short_name="DMH") kw.update(is_urgent=True) kw.update(body_template='urgent_medical_care.body.html') kw.update(dd.str2kw('excerpt_title', _("Attestation"))) yield aidType(**kw) aidType = Instantiator( 'aids.AidType', "name", confirmation_type=ConfirmationTypes.get_for_model( SimpleConfirmation)).build kw = dd.babelkw( 'name', de="Möbellager", en="Furniture", fr="Mobilier") kw.update(body_template='furniture.body.html') kw.update(dd.str2kw('excerpt_title', _("Attestation"))) yield aidType(**kw) kw = dd.babelkw( 'name', de="Heizkosten", en="Heating costs", fr="Frais de chauffage") kw.update(body_template='heating_refund.body.html') kw.update(dd.str2kw('excerpt_title', _("Attestation"))) yield aidType(**kw) croix_rouge = rt.modules.contacts.Company(name="Belgisches Rotes Kreuz") yield croix_rouge kw = dd.babelkw( 'name', de="Lebensmittelbank", en="Food bank", fr="Banque alimentaire") kw.update(confirmed_by_primary_coach=False) kw.update(company=croix_rouge) kw.update(body_template='food_bank.body.html') kw.update(dd.str2kw('excerpt_title', _("Attestation"))) yield aidType(**kw) kw = dd.babelkw( 'name', de="Kleiderkammer", en="Clothes bank", fr="Banque aux vêtements") kw.update(body_template='clothing_bank.body.html') kw.update(company=croix_rouge) kw.update(dd.str2kw('excerpt_title', _("Clothing costs transfer"))) yield aidType(**kw) ## Categories Category = dd.resolve_model('aids.Category') yield Category(**babel_values( 'name', en="Living together", de="Zusammenlebend", fr="Cohabitant")) yield Category(**babel_values( 'name', en="Living alone", de="Alleinstehend", fr="Persone isolée")) yield Category(**babel_values( 'name', en="Person with family at charge", de="Person mit Familienlasten", fr="Personne qui cohabite avec une famille à sa charge")) Decider = dd.resolve_model('boards.Board') yield Decider(**dd.str2kw( 'name', _("Social Board (SB)"))) # "Sozialhilferat (SHR)" yield Decider(**dd.str2kw( 'name', _("Social Commission (SC)"))) # Sozialhilfeausschuss (SAS) yield Decider(**dd.str2kw( 'name', _("Permanent Board (PB)"))) # Ständiges Präsidium (SP) ContentType = rt.modules.contenttypes.ContentType ExcerptType = rt.modules.excerpts.ExcerptType ConfirmationTypes = rt.modules.aids.ConfirmationTypes for ct in ConfirmationTypes.items(): kw = dict( body_template='certificate.body.html', template='Default.odt', primary=True, # print_directly=False, content_type=ContentType.objects.get_for_model(ct.model)) kw.update(dd.str2kw('name', ct.model._meta.verbose_name)) yield ExcerptType.update_for_model(ct.model, **kw)
def tickets_objects(): # was previously in tickets User = rt.models.users.User Company = rt.models.contacts.Company Topic = rt.models.topics.Topic TT = rt.models.tickets.TicketType Ticket = rt.models.tickets.Ticket # Competence = rt.models.tickets.Competence Interest = rt.models.topics.Interest Milestone = dd.plugins.tickets.milestone_model # Milestone = rt.models.deploy.Milestone if Milestone: Deployment = rt.models.deploy.Deployment WishTypes = rt.models.deploy.WishTypes Project = rt.models.tickets.Project # Site = rt.models.tickets.Site Site = dd.plugins.tickets.site_model Link = rt.models.tickets.Link LinkTypes = rt.models.tickets.LinkTypes # EntryType = rt.models.blogs.EntryType # Entry = rt.models.blogs.Entry # Tagging = rt.models.blogs.Tagging # Line = rt.models.courses.Line # List = rt.models.lists.List cons = rt.models.users.UserTypes.consultant dev = rt.models.users.UserTypes.developer yield create_user("marc", rt.models.users.UserTypes.user) yield create_user("mathieu", rt.models.users.UserTypes.user) yield create_user("luc", dev) yield create_user("jean", rt.models.users.UserTypes.senior) USERS = Cycler(User.objects.all()) WORKERS = Cycler(User.objects.filter( username__in='luc jean'.split())) END_USERS = Cycler(User.objects.filter(user_type='')) yield named(TT, _("Bugfix")) yield named(TT, _("Enhancement")) yield named(TT, _("Upgrade")) # sprint = named(Line, _("Sprint")) # yield sprint TYPES = Cycler(TT.objects.all()) yield Topic(name="Lino Core", ref="linõ") yield Topic(name="Lino Welfare", ref="welfäre") yield Topic(name="Lino Cosi", ref="così") yield Topic(name="Lino Voga", ref="faggio") # ref differs from name TOPICS = Cycler(Topic.objects.all()) for name in "Bus.co farm.co share.co".split(): obj = Company(name=name) yield obj yield Site(name=name + ".com", partner=obj) COMPANIES = Cycler(Company.objects.all()) yield Company(name="in3x") for u in Company.objects.exclude(name="in3x"): for i in range(3): yield Interest(owner=u, topic=TOPICS.pop()) roletype = rt.models.contacts.RoleType yield roletype(**dd.babel_values('name', en="Manager", fr='Gérant', de="Geschäftsführer", et="Tegevjuht")) yield roletype(**dd.babel_values('name', en="Director", fr='Directeur', de="Direktor", et="Direktor")) yield roletype(**dd.babel_values('name', en="Secretary", fr='Secrétaire', de="Sekretär", et="Sekretär")) yield roletype(**dd.babel_values('name', en="IT Manager", fr='Gérant informatique', de="EDV-Manager", et="IT manager")) yield roletype(**dd.babel_values('name', en="President", fr='Président', de="Präsident", et="President")) # RTYPES = Cycler(ReportingTypes.objects()) prj1 = Project( name="Framewörk", ref="linö", private=False, company=COMPANIES.pop(), # reporting_type=RTYPES.pop(), start_date=i2d(20090101)) yield prj1 yield Project( name="Téam", ref="téam", start_date=i2d(20100101), # reporting_type=RTYPES.pop(), company=COMPANIES.pop(), parent=prj1, private=True) prj2 = Project( name="Documentatión", ref="docs", private=False, # reporting_type=RTYPES.pop(), company=COMPANIES.pop(), start_date=i2d(20090101), parent=prj1) yield prj2 yield Project( name="Research", ref="research", private=False, company=COMPANIES.pop(), start_date=i2d(19980101), parent=prj2) yield Project( name="Shop", ref="shop", private=False, # reporting_type=RTYPES.pop(), company=COMPANIES.pop(), start_date=i2d(20120201), end_date=i2d(20120630)) PROJECTS = Cycler(Project.objects.all()) # for u in User.objects.all(): # yield Competence(user=u, project=PROJECTS.pop()) # yield Competence(user=u, project=PROJECTS.pop()) SITES = Cycler(Site.objects.exclude(name="pypi")) # LISTS = Cycler(List.objects.all()) if Milestone: for i in range(7): site = SITES.pop() d = dd.today(i*2-20) kw = dict( user=WORKERS.pop(), start_date=d, # line=sprint, # project=PROJECTS.pop(), # expected=d, reached=d, # expected=d, reached=d, name="{}@{}".format(d.strftime("%Y%m%d"), site), # list=LISTS.pop() ) kw[Milestone.site_field_name] = site yield Milestone(**kw) # yield Milestone(site=SITES.pop(), expected=dd.today()) # yield Milestone(project=PROJECTS.pop(), expected=dd.today()) SITES = Cycler(Site.objects.all()) TicketStates = rt.models.tickets.TicketStates TSTATES = Cycler(TicketStates.objects()) Vote = rt.models.votes.Vote VoteStates = rt.models.votes.VoteStates VSTATES = Cycler(VoteStates.objects()) num = [0] def ticket(summary, **kwargs): num[0] += 1 u = WORKERS.pop() kwargs.update( ticket_type=TYPES.pop(), summary=summary, user=u, state=TSTATES.pop(), topic=TOPICS.pop()) if num[0] % 2: kwargs.update(site=SITES.pop()) if num[0] % 4: kwargs.update(private=True) if num[0] % 5: kwargs.update(end_user=END_USERS.pop()) if False: kwargs.update(project=PROJECTS.pop()) obj = Ticket(**kwargs) yield obj if obj.state.active: yield Vote( votable=obj, user=WORKERS.pop(), state=VSTATES.pop()) yield ticket( "Föö fails to bar when baz", project=PROJECTS.pop()) yield ticket("Bar is not always baz", project=PROJECTS.pop()) yield ticket("Baz sucks") yield ticket("Foo and bar don't baz", project=PROJECTS.pop()) # a ticket without project: yield ticket("Cannot create Foo", description="""<p>When I try to create a <b>Foo</b>, then I get a <b>Bar</b> instead of a Foo.</p>""") yield ticket("Sell bar in baz", project=PROJECTS.pop()) yield ticket("No Foo after deleting Bar", project=PROJECTS.pop()) yield ticket("Is there any Bar in Foo?", project=PROJECTS.pop()) yield ticket("Foo never matches Bar", project=PROJECTS.pop()) yield ticket("Where can I find a Foo when bazing Bazes?", project=PROJECTS.pop()) yield ticket("Class-based Foos and Bars?", project=PROJECTS.pop()) yield ticket("Foo cannot bar", project=PROJECTS.pop()) # Example of memo markup: yield ticket("Bar cannot foo", project=PROJECTS.pop(), description="""<p>Linking to [ticket 1] and to [url http://luc.lino-framework.org/blog/2015/0923.html blog].</p> """) yield ticket("Bar cannot baz", project=PROJECTS.pop()) yield ticket("Bars have no foo", project=PROJECTS.pop()) yield ticket("How to get bar from foo", project=PROJECTS.pop()) n = Ticket.objects.count() for i in range(100): yield ticket("Ticket {}".format(i+n+1), project=PROJECTS.pop()) if Milestone: WTYPES = Cycler(WishTypes.objects()) MILESTONES = Cycler(Milestone.objects.all()) for t in Ticket.objects.all(): t.set_author_votes() if t.id % 4: yield Deployment( milestone=MILESTONES.pop(), ticket=t, wish_type=WTYPES.pop()) yield Link( type=LinkTypes.requires, parent=Ticket.objects.get(pk=1), child=Ticket.objects.get(pk=2))
def objects(): global COUNT COUNT += 1 dblogger.info("Started contacts demo fixture %d", COUNT) #~ yield addresstype(**dd.babel_values('name',en="Default",fr=u'Gérant',de=u"Geschäftsführer",et=u"Manager")) yield role(**dd.babel_values('name', en="Manager", fr=u'Gérant', de=u"Geschäftsführer", et=u"Manager")) yield role(**dd.babel_values('name', en="Director", fr=u'Directeur', de=u"Direktor", et=u"Direktor")) yield role(**dd.babel_values('name', en="Secretary", fr=u'Sécrétaire', de=u"Sekretär", et=u"Sekretär")) yield role(**dd.babel_values('name', en="IT Manager", fr=u'Gérant informatique', de=u"EDV-Manager", et=u"IT manager")) yield company(u"Rumma & Ko OÜ", 'EE', '10115', 'Tallinn', u'Tartu mnt', '71') yield company(u'Bäckerei Ausdemwald', 'BE', '4700', 'Eupen', u'Vervierser Straße', '45') yield company(u'Bäckerei Mießen', 'BE', '4700', 'Eupen', u'Gospert', '103') yield company(u'Bäckerei Schmitz', 'BE', '4700', 'Eupen', u'Aachener Straße', '53') yield company(u'Garage Mergelsberg', 'BE', '4720', 'Kelmis', u'Kasinostraße', '13') yield company(u'Donderweer BV', 'NL', '4816 AR', 'Breda', 'Edisonstraat', '12') yield company(u'Van Achter NV', 'NL', '4836 LG', 'Breda', 'Hazeldonk', '2') yield company(u'Hans Flott & Co', 'DE', '22453', 'Hamburg', u'Niendorfer Weg', '532') yield company(u'Bernd Brechts Bücherladen', 'DE', '80333', u'München', u'Brienner Straße', '18') yield company(u'Reinhards Baumschule', 'DE', '12487 ', u'Berlin', u'Segelfliegerdamm', '123') yield company(u'Moulin Rouge', 'FR', '75018', 'Paris', u'Boulevard de Clichy', '82') yield company(u'Auto École Verte', 'FR', '54000 ', 'Nancy', u'rue de Mon Désert', '12') #~ yield person(u'Luc', u'Saffre', gender=Gender.male) yield person(u'Andreas', u'Arens', 'BE', '4700', 'Eupen', gender=dd.Genders.male) yield person(u'Annette', u'Arens', 'BE', '4700', 'Eupen', gender=dd.Genders.female) yield person(u'Hans', u'Altenberg', 'BE', '4700', 'Eupen', gender=dd.Genders.male) yield person(u'Alfons', u'Ausdemwald', 'BE', '4700', 'Eupen', gender=dd.Genders.male) yield person(u'Laurent', u'Bastiaensen', 'BE', '4700', 'Eupen', gender=dd.Genders.male) yield person(u'Charlotte', u'Collard', 'BE', '4700', 'Eupen', gender=dd.Genders.female) yield person(u'Ulrike', u'Charlier', 'BE', '4700', 'Eupen', gender=dd.Genders.female) yield person(u'Marc', u'Chantraine', 'BE', '4700', 'Eupen', gender=dd.Genders.male) yield person(u'Daniel', u'Dericum', 'BE', '4700', 'Eupen', gender=dd.Genders.male) yield person(u'Dorothée', u'Demeulenaere', 'BE', '4700', 'Eupen', gender=dd.Genders.female) yield person(u'Berta', u'Ernst', 'BE', '4700', 'Eupen', gender=dd.Genders.female) yield person(u'Bernd', u'Evertz', 'BE', '4700', 'Eupen', gender=dd.Genders.male) yield person(u'Eberhart', u'Evers', 'BE', '4700', 'Eupen', gender=Gender.male) yield person(u'Daniel', u'Emonts', 'BE', '4700', 'Eupen', gender=Gender.male) yield person(u'Edgar', u'Engels', 'BE', '4700', 'Eupen', gender=Gender.male) yield person(u'Luc', u'Faymonville', 'BE', '4700', 'Eupen', gender=Gender.male) yield person(u'Gérard', u'Gernegroß', 'BE', '4700', 'Eupen', gender=Gender.male) yield person(u'Werner', u'Groteclaes', 'BE', '4700', 'Eupen', gender=Gender.male) yield person(u'Grete', u'Hilgers', 'BE', '4700', 'Eupen', gender=Gender.female) yield person(u'Hans', u'Hilgers', 'BE', '4700', 'Eupen', gender=Gender.male) yield person(u'Irene', u'Ingels', 'BE', '4700', 'Eupen', gender=Gender.female) yield person(u'Jérémy', u'Jansen', 'BE', '4700', 'Eupen', gender=Gender.male) yield person(u'Jean-Pierre', u'Jacob', 'BE', '4700', 'Eupen', gender=Gender.male) yield person(u'Herbert', u'Johnen', 'BE', '4700', 'Eupen', gender=Gender.male) yield person(u'Johannes', u'Jonas', 'BE', '4700', 'Eupen', gender=Gender.male) yield person(u'Jan', u'Jousten', 'BE', '4700', 'Eupen', gender=Gender.male) yield person(u'Karl', u'Kaivers', 'BE', '4700', 'Eupen', gender=Gender.male) yield person(u'Guido', u'Lambertz', 'BE', '4700', 'Eupen', gender=Gender.male) yield person(u'Luc', u'Laschet', 'BE', '4700', 'Eupen', gender=Gender.male) yield person(u'Line', u'Lazarus', 'BE', '4700', 'Eupen', gender=Gender.female) yield person(u'Josefine', u'Leffin', 'BE', '4700', 'Eupen', gender=Gender.female) yield person(u'Marc', u'Malmendier', 'BE', '4700', 'Eupen', gender=Gender.male) yield person(u'Leo', u'Meessen', 'BE', '4700', 'Eupen', gender=Gender.male) yield person(u'Franz', u'Mießen', 'BE', '4700', 'Eupen', gender=Gender.male) yield person(u'Marie-Louise', u'Meier', 'BE', '4700', 'Eupen', gender=Gender.female) yield person(u'Erich', u'Emonts', 'BE', '4730', 'Raeren', gender=Gender.male) yield person(u'Erwin', u'Emontspool', 'BE', '4730', 'Raeren', gender=Gender.male) yield person(u'Erna', u'Emonts-Gast', 'BE', '4730', 'Raeren', gender=Gender.female) yield person(u'Alfons', u'Radermacher', 'BE', '4730', 'Raeren', gender=Gender.male) yield person(u'Berta', u'Radermacher', 'BE', '4730', 'Raeren', gender=Gender.female) yield person(u'Christian', u'Radermacher', 'BE', '4730', 'Raeren', gender=Gender.male) yield person(u'Daniela', u'Radermacher', 'BE', '4730', 'Raeren', gender=Gender.female) yield person(u'Edgard', u'Radermacher', 'BE', '4730', 'Raeren', gender=Gender.male) yield person(u'Fritz', u'Radermacher', 'BE', '4730', 'Raeren', gender=Gender.male) yield person(u'Guido', u'Radermacher', 'BE', '4730', 'Raeren', gender=Gender.male) yield person(u'Hans', u'Radermacher', 'BE', '4730', 'Raeren', gender=Gender.male) yield person(u'Hedi', u'Radermacher', 'BE', '4730', 'Raeren', gender=Gender.female) yield person(u'Inge', u'Radermacher', 'BE', '4730', 'Raeren', gender=Gender.female) yield person(u'Jean', u'Radermacher', 'BE', '4730', 'Raeren', gender=Gender.male) # special challenges for alphabetic ordering yield person(u'Elio', u'di Rupo') yield person(u'Leonardo', u'da Vinci') yield person(u'Herman', u'van Veen') yield person(u'Rein', u'Õunapuu') yield person(u'Otto', u'Östges') yield person(u'Erna', u'Ärgerlich') yield person(u'Bernard', u'Bodard', title='Dr.') yield person(u'Jean', u'Dupont') yield person(u'Mark', u'Martelaer') yield person(u'Rik', u'Radermecker') yield person(u'Marie-Louise', u'Vandenmeulenbos') yield person(u'Emil', u'Eierschal') yield person(u'Lisa', u'Lahm') yield person(u'Bernd', u'Brecht') yield person(u'Karl', u'Keller') yield person(u'Robin', u'Dubois') yield person(u'Denis', u'Denon') yield person(u'Jérôme', u'Jeanémart') s = u"""\ Aachener Straße Akazienweg Alter Malmedyer Weg Am Bahndamm Am Berg Am Waisenbüschchen Auenweg Auf dem Spitzberg Auf'm Rain August-Thonnar-Str. Bahnhofsgasse Bahnhofstraße Bellmerin Bennetsborn Bergkapellstraße Bergstraße Binsterweg Brabantstraße Buchenweg Edelstraße Euregiostraße Favrunpark Feldstraße Fränzel Gewerbestraße Gospert Gülcherstraße Haagenstraße Haasberg Haasstraße Habsburgerweg Heidberg Heidgasse Heidhöhe Herbesthaler Straße Hisselsgasse Hochstraße Hook Hostert Hufengasse Hugo-Zimmermann-Str. Hütte Hütterprivatweg Im Peschgen In den Siepen Industriestraße Johannesstraße Judenstraße Kaperberg Kaplan-Arnolds-Str. Karl-Weiß-Str. Kehrweg Kirchgasse Kirchstraße Klinkeshöfchen Kügelgasse Langesthal Lascheterweg Limburgerweg Lindenweg Lothringerweg Malmedyer Straße Maria-Theresia-Straße Marktplatz Monschauer Straße Mühlenweg Neustraße Nikolausfeld Nispert Noereth Obere Ibern Obere Rottergasse Oestraße Olengraben Panorama Paveestraße Peter-Becker-Str. Rosenweg Rot-Kreuz-Str. Rotenberg Rotenbergplatz Schilsweg Schlüsselhof Schnellewindgasse Schönefeld Schorberg Schulstraße Selterschlag Simarstraße Steinroth Stendrich Stockbergerweg Stockem Theodor-Mooren-Str. Untere Ibern Vervierser Straße Vossengasse Voulfeld Werthplatz Weserstraße """ streets_of_eupen = [line.strip() for line in s.splitlines() if len(line.strip()) > 0] if settings.SITE.abstract_address: nr = 1 #~ CITIES = Cycler(City.objects.all()) eupen = City.objects.get(name="Eupen") STREETS = Cycler(streets_of_eupen) for p in Person.objects.filter(city=eupen): p.street = STREETS.pop() p.street_no = str(nr) p.save() nr += 1 else: nr = 1 for street in streets_of_eupen: for i in range(3): yield address('BE', '4700', 'Eupen', street, str(nr)) nr += 1 ADDRESSES = Cycler(Address.objects.all()) for p in Person.objects.all(): p.address = ADDRESSES.pop() p.save() PERSONS = Cycler(contacts.Person.objects.all()) COMPANIES = Cycler(contacts.Company.objects.all()) ROLES = Cycler(contacts.Role.objects.all()) for i in range(100): com = COMPANIES.pop() yield contact(com, PERSONS.pop(), role=ROLES.pop()) yield contact(com, PERSONS.pop(), role=ROLES.pop()) rumma = contacts.Company.objects.get(name=u"Rumma & Ko OÜ") def user(first_name, last_name, **kw): p = Person(first_name=first_name, last_name=last_name) p.save() return User(person=p, company=rumma, **kw) #~ yield user("Alice","Imedemaal",is_superuser=True) yield user("Alice", "Imedemaal", user_type=UserTypes.admin) yield user("Bert", "Sesamestreet") yield user("Charles", "Braun") dblogger.info("Done contacts demo fixture")
def objects(): #~ yield companyType('Firma','Firma') #~ yield companyType('asbl','asbl') #~ yield companyType('A.S.B.L.','A.S.B.L.') #~ yield companyType('sprl','sprl') #~ yield companyType('GmbH','GmbH') #~ yield companyType('AG','AG') #~ yield companyType('S.A.','S.A.') #~ yield companyType('S.C.','S.C.') #~ yield companyType('V.o.G.','V.o.G.') #~ yield companyType('G.o.E.','G.o.E.') #~ yield companyType('A.S.B.L.','Association sans but lucratif') #~ yield companyType('Maison','Maison') #~ yield companyType('Fachklinik','Fachklinik') #~ yield companyType("Centre d'Accueil d'Urgence","Centre d'Accueil d'Urgence") #~ yield companyType(**babel_values('name', #~ en=u"Public Limited Company", #~ nl=u'NV (Naamloze Vennootschap)', #~ fr=u'SA (Société Anonyme)', #~ de=u"AG (Aktiengesellschaft)")) for ct in COMPANY_TYPES: yield companyType(**ct) yield roletype(**babel_values('name', en="Manager", fr='Gérant', de="Geschäftsführer", et="Tegevjuht")) yield roletype(**babel_values( 'name', en="Director", fr='Directeur', de="Direktor", et="Direktor")) yield roletype(**babel_values( 'name', en="Secretary", fr='Secrétaire', de="Sekretär", et="Sekretär")) yield roletype(**babel_values('name', en="IT Manager", fr='Gérant informatique', de="EDV-Manager", et="IT manager")) yield roletype(**babel_values( 'name', en="President", fr='Président', de="Präsident", et="President")) if settings.SITE.is_installed('contenttypes'): from django.contrib.contenttypes.models import ContentType I = Instantiator('gfks.HelpText', 'content_type field help_text').build Person = resolve_model("contacts.Person") t = ContentType.objects.get_for_model(Person) #~ yield I(t,'birth_date',u"""\ #~ Unkomplette Geburtsdaten sind erlaubt, z.B. #~ <ul> #~ <li>00.00.1980 : irgendwann in 1980</li> #~ <li>00.07.1980 : im Juli 1980</li> #~ <li>23.07.0000 : Geburtstag am 23. Juli, Alter unbekannt</li> #~ </ul> #~ """) Partner = resolve_model('contacts.Partner') t = ContentType.objects.get_for_model(Partner) yield I( t, 'language', u"""\ Die Sprache, in der Dokumente ausgestellt werden sollen. """)
def objects(): #~ dblogger.info("Installing countries few_cities fixture") countries = dd.resolve_app('countries') #~ Place = resolve_model('countries.Place') Place = countries.Place Country = countries.Country PlaceTypes = countries.PlaceTypes city = Instantiator(Place, 'name country').build def make_city(country_id, name=None, **kw): if False: # AFTER17: kw.setdefault('type', PlaceTypes.city.pk) if kw.get('type', False) and isinstance(kw.get('type', False), PlaceType): kw['type'] = kw['type'].pk else: kw.setdefault('type', PlaceTypes.city) flt = rt.lookup_filter('name', name, country__isocode=country_id, **kw) try: return Place.objects.get(flt) # return Place.objects.exclude(type__in=[ # PlaceTypes.county, PlaceTypes.province]).get(flt) except MultipleObjectsReturned: #~ qs = Place.objects.exclude(type=PlaceTypes.county).filter(country__isocode=country_id,name=name) raise Exception("Oops, there are multiple cities for %r", name) except Place.DoesNotExist: obj = city(name, country_id, **kw) obj.full_clean() obj.save() return obj BE = Country.objects.get(pk='BE') DE = Country.objects.get(pk='DE') FR = Country.objects.get(pk='FR') eupen = make_city('BE', 'Eupen', zip_code='4700') yield eupen yield make_city('BE', 'Nispert', type=PlaceTypes.township, parent=eupen) reuland = make_city('BE', 'Burg-Reuland ', zip_code='4790') yield make_city('BE', 'Ouren', type=PlaceTypes.township, parent=reuland) yield Place(country=BE, zip_code='4720', type=PlaceTypes.city, **dd.babel_values('name', de='Kelmis', fr='La Calamine', en="Kelmis", et="Kelmis")) yield make_city('BE', 'Kettenis', zip_code='4701', type=PlaceTypes.village) yield make_city('BE', 'Raeren', zip_code='4730', type=PlaceTypes.village) yield make_city('BE', 'Angleur', zip_code='4031') yield make_city('BE', 'Ans', zip_code='4430') yield make_city('BE', 'Ottignies', zip_code='1340') yield make_city('BE', 'Thieusies', zip_code='7061') yield make_city('BE', 'Cuesmes', zip_code='7033') yield make_city('BE', 'La Reid', zip_code='4910') yield make_city('BE', 'Blégny ', zip_code='4670') yield make_city('BE', 'Trembleur ', zip_code='4670') yield make_city('BE', 'Mortier ', zip_code='4670') yield make_city('BE', 'Cerfontaine', zip_code='5630') yield make_city('BE', 'Burdinne', zip_code='4210') def be_province(de, fr, nl): if False: # AFTER17: p = Place(country=BE, type=PlaceTypes.province.pk, **dd.babel_values('name', de=de, fr=fr, nl=nl, en=fr, et=fr)) else: p = Place(country=BE, type=PlaceTypes.province, **dd.babel_values('name', de=de, fr=fr, nl=nl, en=fr, et=fr)) return p def be_city(zip_code, de=None, fr=None, nl=None, en=None, **kw): kw.update(dd.babel_values('name', de=de, fr=fr, nl=nl, en=en, et=en)) if False: # AFTER17: kw.setdefault('type', PlaceTypes.city.pk) if kw.get('type', False) and isinstance(kw.get('type', False), PlaceType): kw['type'] = kw['type'].pk else: kw.setdefault('type', PlaceTypes.city) return Place(country=BE, zip_code=zip_code, **kw) yield be_province("Antwerpen", "Anvers", "Antwerpen") yield be_province("Luxemburg", "Luxembourg", "Luxemburg") yield be_province("Namür", "Namur", "Namen") prov = be_province("Limburg", "Limbourg", "Limburg") yield prov yield make_city('BE', 'Aalst-bij-Sint-Truiden', zip_code='3800', parent=prov, type=PlaceTypes.village) prov = be_province("Lüttich", "Liège", "Luik") yield prov yield be_city('4000', "Lüttich", "Liège", "Luik", "Liège", parent=prov) yield be_city('4750', "Bütgenbach", "Butgenbach", "Butgenbach", "Butgenbach", parent=prov) yield be_city('4760', "Büllingen", "Bullange", "Büllingen", "Büllingen", parent=prov) yield be_city('4780', "Sankt Vith", "Saint-Vith", "Sankt Vith", "Sankt Vith", parent=prov) yield be_city('4780', "Recht", "Recht", "Recht", "Recht", parent=prov) yield be_city('4837', "Baelen", "Baelen", "Baelen", "Baelen", parent=prov) yield be_province("Hennegau", "Hainaut", "Henegouwen") yield be_province("Wallonisch-Brabant", "Brabant wallon", "Waals-Brabant") yield be_province("Flämisch-Brabant", "Brabant flamant", "Vlaams-Brabant") prov = be_province("Ostflandern", "Flandre de l'Est", "Oost-Vlaanderen") yield prov aalst = be_city('9300', "Aalst", "Alost", "Aalst", "Aalst", parent=prov) yield aalst yield be_city('9308', name="Gijzegem", parent=aalst, type=PlaceTypes.village) yield be_city('9310', name="Baardegem", parent=aalst, type=PlaceTypes.village) yield be_city('9320', name="Erembodegem", parent=aalst, type=PlaceTypes.village) yield be_city('9310', name="Herdersem", parent=aalst, type=PlaceTypes.village) yield be_city('9308', name="Hofstade", parent=aalst, type=PlaceTypes.village) yield be_city('9310', name="Meldert", parent=aalst, type=PlaceTypes.village) yield be_city('9320', name="Nieuwerkerken", parent=aalst, type=PlaceTypes.village) yield be_city('9310', name="Moorsel", parent=aalst, type=PlaceTypes.village) yield be_province("Westflandern", "Flandre de l'Ouest", "West-Vlaanderen") yield be_city('1000', "Brüssel", "Bruxelles", "Brussel", "Brussels") yield be_city('7000', "Bergen", "Mons", "Bergen", "Mons") yield be_city('8400', "Ostende", "Ostende", "Oostende", "Ostende") yield be_city('5000', "Namür", "Namur", "Namen", "Namur") harjumaa = make_city('EE', 'Harju', type=PlaceTypes.county) yield harjumaa parnumaa = make_city('EE', 'Pärnu', type=PlaceTypes.county) yield parnumaa raplamaa = make_city('EE', 'Rapla', type=PlaceTypes.county) yield raplamaa yield make_city('EE', 'Vigala', type=PlaceTypes.municipality, parent=raplamaa) yield make_city('EE', 'Rapla', type=PlaceTypes.town, parent=raplamaa) tallinn = make_city('EE', 'Tallinn', type=PlaceTypes.town, parent=harjumaa) yield tallinn yield make_city('EE', 'Kesklinn', type=PlaceTypes.township, parent=tallinn) yield make_city('EE', 'Põhja-Tallinn', type=PlaceTypes.township, parent=tallinn) yield make_city('EE', 'Pärnu', type=PlaceTypes.town, parent=parnumaa) yield make_city('EE', 'Tartu', type=PlaceTypes.town) yield make_city('EE', 'Narva', type=PlaceTypes.town) yield make_city('EE', 'Ääsmäe', type=PlaceTypes.town, parent=harjumaa) #~ yield make_city(u'Aachen','DE') yield Place(country=DE, type=PlaceTypes.city, **dd.babel_values('name', de='Aachen', fr='Aix-la-Chapelle', nl="Aken", en="Aachen", et="Aachen")) yield Place(country=DE, type=PlaceTypes.city, **dd.babel_values('name', de='Köln', fr='Cologne', nl="Keulen", en="Cologne", et="Köln")) yield make_city('DE', 'Berlin') yield make_city('DE', 'Hamburg') yield Place(country=DE, type=PlaceTypes.city, **dd.babel_values('name', de='München', fr='Munich', en="Munich", et="München")) yield Place(country=DE, type=PlaceTypes.city, **dd.babel_values('name', de='Monschau', fr='Montjoie', en="Monschau", et="Monschau")) yield make_city('NL', 'Maastricht') yield make_city('NL', 'Amsterdam') yield make_city('NL', 'Den Haag') yield make_city('NL', 'Rotterdam') yield make_city('NL', 'Utrecht') yield make_city('NL', 'Breda') yield Place(country=FR, type=PlaceTypes.city, **dd.babel_values('name', de='Paris', fr='Paris', en="Paris", et="Pariis", nl="Parijs")) yield Place(country=FR, type=PlaceTypes.city, **dd.babel_values('name', de='Nizza', fr='Nice', en="Nice", et="Nizza")) yield make_city('FR', 'Metz') yield make_city('FR', 'Strasbourg') yield make_city('FR', 'Nancy') yield make_city('FR', 'Marseille')
def book(ref, en, abbr_en, de, abbr_de, et, abbr_et, **kw): kw.update(dd.babel_values('name', en=en, de=de, et=et)) kw.update(dd.babel_values('abbr', en=abbr_en, de=abbr_de, et=abbr_et)) return Book(ref=ref, **kw)
def objects(): AccountTypes = rt.modules.accounts.AccountTypes TableLayouts = rt.modules.debts.TableLayouts # c = accounts.Chart(name="debts.default") # yield c # c = rt.modules.accounts.AccountCharts.debts group = Instantiator('debts.Group').build g = group( ref="10", account_type=AccountTypes.incomes, entries_layout=TableLayouts.get_by_value('11'), **dd.babel_values( 'name', de=u"Monatliche Einkünfte", fr=u"Revenus mensuels", en=u"Monthly incomes")) yield g account = Instantiator('debts.Account', group=g).build yield account( ref="1010", required_for_person=True, **dd.babel_values( 'name', de=u"Gehälter", fr=u"Salaires", en=u"Salaries")) yield account( ref="1020", required_for_person=True, **dd.babel_values( 'name', de=u"Renten", fr=u"Pension", en=u"Pension")) yield account( ref="1030", required_for_person=True, **dd.babel_values( 'name', de=u"Integrationszulage", fr=u"Allocation d'intégration", en=u"Integration aid")) yield account( ref="1040", required_for_person=True, **dd.babel_values( 'name', de=u"Ersatzeinkünfte", fr=u"Ersatzeinkünfte", en=u"Ersatzeinkünfte")) yield account( ref="1050", required_for_person=True, **dd.babel_values( 'name', de=u"Alimente", fr=u"Aliments", en=u"Aliments")) yield account(ref="1060", required_for_person=True, **dd.babel_values( 'name', de=u"Essen-Schecks", fr=u"Chèques-repas", en=u"Chèques-repas")) yield account(ref="1090", required_for_person=True, **dd.babel_values( 'name', de=u"Andere", fr=u"Andere", en=u"Andere" )) g = group( ref="20", account_type=AccountTypes.incomes, entries_layout=TableLayouts.get_by_value('30'), **dd.babel_values( 'name', de=u"Jährliche Einkünfte", fr=u"Revenus annuels", en=u"Yearly incomes")) yield g account = Instantiator('debts.Account', group=g, periods=12).build yield account(ref="2010", required_for_person=True, **dd.babel_values( 'name', de=u"Urlaubsgeld", fr=u"Congé payé", en=u"Paid holiday")) yield account(ref="2020", required_for_person=True, **dd.babel_values( 'name', de=u"Jahresendzulage", fr=u"Prime de fin d'année", en=u"Year-end prime")) yield account(ref="2030", required_for_person=True, **dd.babel_values( 'name', de=u"Gewerkschaftsprämie", fr=u"Gewerkschaftsprämie", en=u"Gewerkschaftsprämie")) g = group( ref="11", account_type=AccountTypes.expenses, entries_layout=TableLayouts.get_by_value('10'), **dd.babel_values('name', de=u"Monatliche Ausgaben", fr=u"Dépenses mensuelles", en=u"Monthly expenses")) yield g account = Instantiator('debts.Account', group=g).build yield account( ref="3010", required_for_household=True, **dd.babel_values('name', de=u"Miete", fr=u"Loyer", en=u"Rent" )) yield account( ref="3011", required_for_household=True, **dd.babel_values('name', de=u"Wasser", fr=u"Eau", en=u"Water" )) yield account( ref="3012", required_for_household=True, **dd.babel_values('name', de=u"Strom", fr=u"Electricité", en=u"Electricity" )) yield account( ref="3020", required_for_household=True, **dd.babel_values('name', de=u"Festnetz-Telefon und Internet", fr=u"Téléphone fixe et Internet", en=u"Telephone & Internet" )) yield account( ref="3021", required_for_household=True, **dd.babel_values('name', de=u"Handy", fr=u"GSM", en=u"Cell phone" )) yield account( ref="3030", required_for_household=True, **dd.babel_values('name', de=u"Fahrtkosten", fr=u"Frais de transport", en=u"Transport costs" )) yield account( ref="3031", required_for_household=True, **dd.babel_values('name', de=u"TEC Busabonnement", fr=u"Abonnement bus", en=u"Public transport" )) yield account( ref="3032", required_for_household=True, **dd.babel_values('name', de=u"Benzin", fr=u"Essence", en=u"Fuel" )) yield account( ref="3033", required_for_household=True, **dd.babel_values('name', de=u"Unterhalt Auto", fr=u"Maintenance voiture", en=u"Car maintenance" )) yield account( ref="3040", required_for_household=True, **dd.babel_values('name', de=u"Schulkosten", fr=u"École", en=u"School" )) yield account( ref="3041", required_for_household=True, **dd.babel_values('name', de=u"Tagesmutter & Kleinkindbetreuung", fr=u"Garde enfant", en=u"Babysitting" )) yield account( ref="3050", required_for_household=True, **dd.babel_values('name', de=u"Gesundheit", fr=u"Santé", en=u"Health" )) yield account( ref="3051", required_for_household=True, **dd.babel_values('name', de=u"Kleidung", fr=u"Vêtements", en=u"Clothes" )) yield account( ref="3052", required_for_household=True, **dd.babel_values('name', de=u"Ernährung", fr=u"Alimentation", en=u"Food" )) yield account( ref="3053", required_for_household=True, **dd.babel_values('name', de=u"Hygiene", fr=u"Hygiène", en=u"Hygiene" )) yield account( ref="3060", required_for_household=True, **dd.babel_values('name', de=u"Krankenkassenbeiträge", fr=u"Mutuelle", en=u"Health insurance" )) yield account( ref="3061", required_for_household=True, **dd.babel_values('name', de=u"Gewerkschaftsbeiträge", fr=u"Cotisations syndicat", en=u"Labour fees" )) yield account( ref="3062", required_for_household=True, **dd.babel_values('name', de=u"Unterhaltszahlungen", fr=u"Unterhaltszahlungen", en=u"Unterhaltszahlungen" )) yield account( ref="3070", required_for_household=True, **dd.babel_values('name', de=u"Tabak", fr=u"Tabac", en=u"Tobacco" )) yield account( ref="3071", required_for_household=True, **dd.babel_values('name', de=u"Freizeit & Unterhaltung", fr=u"Loisirs", en=u"Spare time" )) yield account( ref="3072", required_for_household=True, **dd.babel_values('name', de=u"Haustiere", fr=u"Animaux domestiques", en=u"Pets" )) yield account( ref="3063", required_for_household=True, **dd.babel_values('name', de=u"Pensionssparen", fr=u"Épargne pension", en=u"Retirement savings" )) yield account( ref="3090", required_for_household=True, **dd.babel_values('name', de=u"Sonstige", fr=u"Autres", en=u"Other" )) g = group( ref="40", account_type=AccountTypes.expenses, entries_layout=TableLayouts.get_by_value('10'), **dd.babel_values( 'name', de=u"Steuern", fr=u"Taxes", en=u"Taxes")) yield g account = Instantiator('debts.Account', group=g, periods=12).build yield account( ref="4010", required_for_household=True, **dd.babel_values('name', de=u"Gemeindesteuer", fr=u"Taxe communale", en=u"Municipal tax" )) yield account( ref="4020", required_for_household=True, **dd.babel_values('name', de=u"Kanalisationssteuer", fr=u"Kanalisationssteuer", en=u"Kanalisationssteuer" )) yield account( ref="4030", required_for_household=True, **dd.babel_values('name', de=u"Müllsteuer", fr=u"Taxe déchets", en=u"Waste tax" )) yield account( ref="4040", required_for_household=True, **dd.babel_values('name', de=u"Autosteuer", fr=u"Taxe circulation", en=u"Autosteuer" )) yield account( ref="4050", required_for_household=True, **dd.babel_values('name', de=u"Immobiliensteuer", fr=u"Taxe immobilière", en=u"Immobiliensteuer" )) yield account( ref="4090", required_for_household=True, **dd.babel_values('name', de=u"Andere", fr=u"Autres", en=u"Other" )) g = group( ref="50", account_type=AccountTypes.expenses, entries_layout=TableLayouts.get_by_value('10'), **dd.babel_values( 'name', de=u"Versicherungen", fr=u"Assurances", en=u"Insurances")) yield g account = Instantiator('debts.Account', group=g, periods=12).build yield account( ref="5010", required_for_household=True, **dd.babel_values('name', de=u"Feuer", fr=u"Incendie", en=u"Fire" )) yield account( ref="5020", required_for_household=True, **dd.babel_values('name', de=u"Familienhaftpflicht", fr=u"Responsabilité famille", en=u"Familienhaftpflicht" )) yield account( ref="5030", required_for_household=True, **dd.babel_values('name', de=u"Auto", fr=u"Voiture", en=u"Car insurance" )) yield account( ref="5040", required_for_household=True, **dd.babel_values('name', de=u"Lebensversicherung", fr=u"Assurance vie", en=u"Life insurance" )) yield account( ref="5090", required_for_household=True, **dd.babel_values('name', de=u"Andere Versicherungen", fr=u"Autres assurances", en=u"Other insurances" )) g = group( ref="60", account_type=AccountTypes.assets, entries_layout=TableLayouts.get_by_value('30'), **dd.babel_values( 'name', de=u"Aktiva, Vermögen, Kapital", fr=u"Actifs", en=u"Assets")) yield g account = Instantiator('debts.Account', group=g).build yield account(ref="6010", **dd.babel_values('name', de=u"Haus", fr=u"Maison", en=u"House" )) yield account(ref="6020", **dd.babel_values('name', de=u"Auto", fr=u"Voiture", en=u"Car" )) g = group( ref="70", account_type=AccountTypes.liabilities, entries_layout=TableLayouts.get_by_value('20'), **dd.babel_values( 'name', de="Schulden, Zahlungsrückstände, Kredite", fr="Dettes, paiements en retard et crédits", en="Debts, outsanding payments and credits")) yield g account = Instantiator('debts.Account', group=g).build yield account(ref="7010", **dd.babel_values( 'name', de="Kredite", fr="Crédits", en="Loans")) yield account(ref="7020", **dd.babel_values( 'name', de="Schulden", fr="Dettes", en="Debts")) yield account(ref="7040", **dd.babel_values( 'name', de="Zahlungsrückstände", fr="Factures à payer", en="Invoices to pay")) g = group( ref="71", account_type=AccountTypes.liabilities, entries_layout=TableLayouts.get_by_value('40'), **dd.babel_values( 'name', de="Gerichtsvollzieher und Inkasso", fr="Huissiers et agents d'encaissement", en="Bailiffs and cash collectors")) yield g account = Instantiator('debts.Account', group=g).build yield account(ref="7100", **dd.babel_values( 'name', de="Gerichtsvollzieher", fr="Huissier", en="Bailiff")) yield account(ref="7110", **dd.babel_values( 'name', de="Inkasso-Unternehmen", fr="Agent d'encaissement", en="Cash agency"))
def objects(): """ Education levels in Belgium: http://www.guide-enseignement.be/infos_pages/diplomes.html Certificat d'études de base (CEB) Certificat d'enseignement secondaire du deuxième degré (C.E.S.D.D.) Certificat d'études de sixième année de l'enseignement secondaire professionnel (C.E.6.P.) Certificat de qualification (C.Q.) Certificat d'enseignement secondaire supérieur (C.E.S.S.) Certificat relatif aux connaissances de gestion de base Brevet d’enseignement secondaire complémentaire – section "soins infirmiers(E.P.S.C.)" """ eduLevel = Instantiator('cv.EducationLevel').build yield eduLevel(**dd.babel_values('name', de="Primär", fr="Primaire", en="Primary")) yield eduLevel(**dd.babel_values('name', de="Sekundär", fr="Secondaire", en="Secondary")) yield eduLevel(**dd.babel_values('name', de="Hochschule", fr="Supérieur", en="Higher")) yield eduLevel(**dd.babel_values('name', de="Bachelor", fr="Bachelor", en="Bachelor")) yield eduLevel(**dd.babel_values('name', de="Master", fr="Master", en="Master")) studyType = Instantiator('cv.StudyType').build yield studyType(**dd.babel_values('name', de=u"Schule", fr=u"École", en=u"School", )) yield studyType(**dd.babel_values('name', de=u"Sonderschule", fr=u"École spéciale", en=u"Special school", )) yield studyType(**dd.babel_values('name', de=u"Ausbildung", fr=u"Formation", en=u"Training", )) yield studyType(**dd.babel_values('name', de=u"Lehre", fr=u"Apprentissage", en=u"Apprenticeship", )) yield studyType(**dd.babel_values('name', de=u"Hochschule", fr=u"École supérieure", en=u"Highschool", )) yield studyType(**dd.babel_values('name', de=u"Universität", fr=u"Université", en=u"University", )) yield studyType(**dd.babel_values('name', de=u"Teilzeitunterricht", fr=u"Cours à temps partiel", en=u"Part-time study", )) yield studyType(**dd.babel_values('name', de=u"Fernkurs", fr=u"Cours à distance", en=u"Remote study", )) M = Instantiator('cv.StudyType', is_training=True, is_study=False).build yield M(**dd.str2kw('name', _("Prequalifying"))) yield M(**dd.str2kw('name', _("Qualifying"))) yield M(**dd.str2kw('name', _("Alpha"))) M = Instantiator('cv.Duration').build yield M(**dd.str2kw('name', _("Unlimited duration"))) yield M(**dd.str2kw('name', _("Limited duration"))) yield M(**dd.str2kw('name', _("Clearly defined job"))) yield M(**dd.str2kw('name', _("Replacement"))) yield M(**dd.str2kw('name', _("Interim"))) """ Contrat de travail à durée indéterminée - Arbeidsovereenkomst voor onbepaalde tijd Contrat de travail à durée déterminée - Arbeidsovereenkomst voor bepaalde tijd Contrat pour un travail nettement défini - Arbeidsovereenkomst voor een duidelijk omschreven werk Contrat de remplacement - Vervangingsovereenkomst Contrat d’intérim Convention de premier emploi Contrat de travail à temps partiel """ status = Instantiator('cv.Status').build yield status(**dd.str2kw('name', _("Worker"))) yield status(**dd.str2kw('name', _("Employee"))) yield status(**dd.str2kw('name', _("Freelancer"))) yield status(**dd.str2kw('name', _("Voluntary"))) yield status(**dd.str2kw('name', _("Student"))) yield status(**dd.str2kw('name', _("Laboratory"))) # fr=Stage, # de=Praktikum yield status(**dd.str2kw('name', _("Interim"))) regime = Instantiator('cv.Regime').build yield regime(**dd.str2kw('name', _("Full-time"))) yield regime(**dd.str2kw('name', _("Part-time"))) yield regime(**dd.str2kw('name', _("Other")))
def objects(): global COUNT COUNT += 1 dblogger.info("Started contacts demo fixture %d", COUNT) #~ yield addresstype(**dd.babel_values('name',en="Default",fr=u'Gérant',de=u"Geschäftsführer",et=u"Manager")) yield role(**dd.babel_values('name', en="Manager", fr=u'Gérant', de=u"Geschäftsführer", et=u"Manager")) yield role(**dd.babel_values( 'name', en="Director", fr=u'Directeur', de=u"Direktor", et=u"Direktor")) yield role(**dd.babel_values('name', en="Secretary", fr=u'Sécrétaire', de=u"Sekretär", et=u"Sekretär")) yield role(**dd.babel_values('name', en="IT Manager", fr=u'Gérant informatique', de=u"EDV-Manager", et=u"IT manager")) yield company(u"Rumma & Ko OÜ", 'EE', '10115', 'Tallinn', u'Tartu mnt', '71') yield company(u'Bäckerei Ausdemwald', 'BE', '4700', 'Eupen', u'Vervierser Straße', '45') yield company(u'Bäckerei Mießen', 'BE', '4700', 'Eupen', u'Gospert', '103') yield company(u'Bäckerei Schmitz', 'BE', '4700', 'Eupen', u'Aachener Straße', '53') yield company(u'Garage Mergelsberg', 'BE', '4720', 'Kelmis', u'Kasinostraße', '13') yield company(u'Donderweer BV', 'NL', '4816 AR', 'Breda', 'Edisonstraat', '12') yield company(u'Van Achter NV', 'NL', '4836 LG', 'Breda', 'Hazeldonk', '2') yield company(u'Hans Flott & Co', 'DE', '22453', 'Hamburg', u'Niendorfer Weg', '532') yield company(u'Bernd Brechts Bücherladen', 'DE', '80333', u'München', u'Brienner Straße', '18') yield company(u'Reinhards Baumschule', 'DE', '12487 ', u'Berlin', u'Segelfliegerdamm', '123') yield company(u'Moulin Rouge', 'FR', '75018', 'Paris', u'Boulevard de Clichy', '82') yield company(u'Auto École Verte', 'FR', '54000 ', 'Nancy', u'rue de Mon Désert', '12') #~ yield person(u'Luc', u'Saffre', gender=Gender.male) yield person(u'Andreas', u'Arens', 'BE', '4700', 'Eupen', gender=dd.Genders.male) yield person(u'Annette', u'Arens', 'BE', '4700', 'Eupen', gender=dd.Genders.female) yield person(u'Hans', u'Altenberg', 'BE', '4700', 'Eupen', gender=dd.Genders.male) yield person(u'Alfons', u'Ausdemwald', 'BE', '4700', 'Eupen', gender=dd.Genders.male) yield person(u'Laurent', u'Bastiaensen', 'BE', '4700', 'Eupen', gender=dd.Genders.male) yield person(u'Charlotte', u'Collard', 'BE', '4700', 'Eupen', gender=dd.Genders.female) yield person(u'Ulrike', u'Charlier', 'BE', '4700', 'Eupen', gender=dd.Genders.female) yield person(u'Marc', u'Chantraine', 'BE', '4700', 'Eupen', gender=dd.Genders.male) yield person(u'Daniel', u'Dericum', 'BE', '4700', 'Eupen', gender=dd.Genders.male) yield person(u'Dorothée', u'Demeulenaere', 'BE', '4700', 'Eupen', gender=dd.Genders.female) yield person(u'Berta', u'Ernst', 'BE', '4700', 'Eupen', gender=dd.Genders.female) yield person(u'Bernd', u'Evertz', 'BE', '4700', 'Eupen', gender=dd.Genders.male) yield person(u'Eberhart', u'Evers', 'BE', '4700', 'Eupen', gender=Gender.male) yield person(u'Daniel', u'Emonts', 'BE', '4700', 'Eupen', gender=Gender.male) yield person(u'Edgar', u'Engels', 'BE', '4700', 'Eupen', gender=Gender.male) yield person(u'Luc', u'Faymonville', 'BE', '4700', 'Eupen', gender=Gender.male) yield person(u'Gérard', u'Gernegroß', 'BE', '4700', 'Eupen', gender=Gender.male) yield person(u'Werner', u'Groteclaes', 'BE', '4700', 'Eupen', gender=Gender.male) yield person(u'Grete', u'Hilgers', 'BE', '4700', 'Eupen', gender=Gender.female) yield person(u'Hans', u'Hilgers', 'BE', '4700', 'Eupen', gender=Gender.male) yield person(u'Irene', u'Ingels', 'BE', '4700', 'Eupen', gender=Gender.female) yield person(u'Jérémy', u'Jansen', 'BE', '4700', 'Eupen', gender=Gender.male) yield person(u'Jean-Pierre', u'Jacob', 'BE', '4700', 'Eupen', gender=Gender.male) yield person(u'Herbert', u'Johnen', 'BE', '4700', 'Eupen', gender=Gender.male) yield person(u'Johannes', u'Jonas', 'BE', '4700', 'Eupen', gender=Gender.male) yield person(u'Jan', u'Jousten', 'BE', '4700', 'Eupen', gender=Gender.male) yield person(u'Karl', u'Kaivers', 'BE', '4700', 'Eupen', gender=Gender.male) yield person(u'Guido', u'Lambertz', 'BE', '4700', 'Eupen', gender=Gender.male) yield person(u'Luc', u'Laschet', 'BE', '4700', 'Eupen', gender=Gender.male) yield person(u'Line', u'Lazarus', 'BE', '4700', 'Eupen', gender=Gender.female) yield person(u'Josefine', u'Leffin', 'BE', '4700', 'Eupen', gender=Gender.female) yield person(u'Marc', u'Malmendier', 'BE', '4700', 'Eupen', gender=Gender.male) yield person(u'Leo', u'Meessen', 'BE', '4700', 'Eupen', gender=Gender.male) yield person(u'Franz', u'Mießen', 'BE', '4700', 'Eupen', gender=Gender.male) yield person(u'Marie-Louise', u'Meier', 'BE', '4700', 'Eupen', gender=Gender.female) yield person(u'Erich', u'Emonts', 'BE', '4730', 'Raeren', gender=Gender.male) yield person(u'Erwin', u'Emontspool', 'BE', '4730', 'Raeren', gender=Gender.male) yield person(u'Erna', u'Emonts-Gast', 'BE', '4730', 'Raeren', gender=Gender.female) yield person(u'Alfons', u'Radermacher', 'BE', '4730', 'Raeren', gender=Gender.male) yield person(u'Berta', u'Radermacher', 'BE', '4730', 'Raeren', gender=Gender.female) yield person(u'Christian', u'Radermacher', 'BE', '4730', 'Raeren', gender=Gender.male) yield person(u'Daniela', u'Radermacher', 'BE', '4730', 'Raeren', gender=Gender.female) yield person(u'Edgard', u'Radermacher', 'BE', '4730', 'Raeren', gender=Gender.male) yield person(u'Fritz', u'Radermacher', 'BE', '4730', 'Raeren', gender=Gender.male) yield person(u'Guido', u'Radermacher', 'BE', '4730', 'Raeren', gender=Gender.male) yield person(u'Hans', u'Radermacher', 'BE', '4730', 'Raeren', gender=Gender.male) yield person(u'Hedi', u'Radermacher', 'BE', '4730', 'Raeren', gender=Gender.female) yield person(u'Inge', u'Radermacher', 'BE', '4730', 'Raeren', gender=Gender.female) yield person(u'Jean', u'Radermacher', 'BE', '4730', 'Raeren', gender=Gender.male) # special challenges for alphabetic ordering yield person(u'Elio', u'di Rupo') yield person(u'Leonardo', u'da Vinci') yield person(u'Herman', u'van Veen') yield person(u'Rein', u'Õunapuu') yield person(u'Otto', u'Östges') yield person(u'Erna', u'Ärgerlich') yield person(u'Bernard', u'Bodard', title='Dr.') yield person(u'Jean', u'Dupont') yield person(u'Mark', u'Martelaer') yield person(u'Rik', u'Radermecker') yield person(u'Marie-Louise', u'Vandenmeulenbos') yield person(u'Emil', u'Eierschal') yield person(u'Lisa', u'Lahm') yield person(u'Bernd', u'Brecht') yield person(u'Karl', u'Keller') yield person(u'Robin', u'Dubois') yield person(u'Denis', u'Denon') yield person(u'Jérôme', u'Jeanémart') s = u"""\ Aachener Straße Akazienweg Alter Malmedyer Weg Am Bahndamm Am Berg Am Waisenbüschchen Auenweg Auf dem Spitzberg Auf'm Rain August-Thonnar-Str. Bahnhofsgasse Bahnhofstraße Bellmerin Bennetsborn Bergkapellstraße Bergstraße Binsterweg Brabantstraße Buchenweg Edelstraße Euregiostraße Favrunpark Feldstraße Fränzel Gewerbestraße Gospert Gülcherstraße Haagenstraße Haasberg Haasstraße Habsburgerweg Heidberg Heidgasse Heidhöhe Herbesthaler Straße Hisselsgasse Hochstraße Hook Hostert Hufengasse Hugo-Zimmermann-Str. Hütte Hütterprivatweg Im Peschgen In den Siepen Industriestraße Johannesstraße Judenstraße Kaperberg Kaplan-Arnolds-Str. Karl-Weiß-Str. Kehrweg Kirchgasse Kirchstraße Klinkeshöfchen Kügelgasse Langesthal Lascheterweg Limburgerweg Lindenweg Lothringerweg Malmedyer Straße Maria-Theresia-Straße Marktplatz Monschauer Straße Mühlenweg Neustraße Nikolausfeld Nispert Noereth Obere Ibern Obere Rottergasse Oestraße Olengraben Panorama Paveestraße Peter-Becker-Str. Rosenweg Rot-Kreuz-Str. Rotenberg Rotenbergplatz Schilsweg Schlüsselhof Schnellewindgasse Schönefeld Schorberg Schulstraße Selterschlag Simarstraße Steinroth Stendrich Stockbergerweg Stockem Theodor-Mooren-Str. Untere Ibern Vervierser Straße Vossengasse Voulfeld Werthplatz Weserstraße """ streets_of_eupen = [ line.strip() for line in s.splitlines() if len(line.strip()) > 0 ] if settings.SITE.abstract_address: nr = 1 #~ CITIES = Cycler(City.objects.all()) eupen = City.objects.get(name="Eupen") STREETS = Cycler(streets_of_eupen) for p in Person.objects.filter(city=eupen): p.street = STREETS.pop() p.street_no = str(nr) p.save() nr += 1 else: nr = 1 for street in streets_of_eupen: for i in range(3): yield address('BE', '4700', 'Eupen', street, str(nr)) nr += 1 ADDRESSES = Cycler(Address.objects.all()) for p in Person.objects.all(): p.address = ADDRESSES.pop() p.save() PERSONS = Cycler(contacts.Person.objects.all()) COMPANIES = Cycler(contacts.Company.objects.all()) ROLES = Cycler(contacts.Role.objects.all()) for i in range(100): com = COMPANIES.pop() yield contact(com, PERSONS.pop(), role=ROLES.pop()) yield contact(com, PERSONS.pop(), role=ROLES.pop()) rumma = contacts.Company.objects.get(name=u"Rumma & Ko OÜ") def user(first_name, last_name, **kw): p = Person(first_name=first_name, last_name=last_name) p.save() return User(person=p, company=rumma, **kw) #~ yield user("Alice","Imedemaal",is_superuser=True) yield user("Alice", "Imedemaal", user_type=UserTypes.admin) yield user("Bert", "Sesamestreet") yield user("Charles", "Braun") dblogger.info("Done contacts demo fixture")
def tickets_objects(): # was previously in tickets User = rt.models.users.User Company = rt.models.contacts.Company Topic = rt.models.topics.Topic TT = rt.models.tickets.TicketType Ticket = rt.models.tickets.Ticket # Competence = rt.models.tickets.Competence Interest = rt.models.topics.Interest Milestone = dd.plugins.tickets.milestone_model # Milestone = rt.models.deploy.Milestone if Milestone: Deployment = rt.models.deploy.Deployment WishTypes = rt.models.deploy.WishTypes Project = rt.models.tickets.Project # Site = rt.models.tickets.Site Site = dd.plugins.tickets.site_model Link = rt.models.tickets.Link LinkTypes = rt.models.tickets.LinkTypes # EntryType = rt.models.blogs.EntryType # Entry = rt.models.blogs.Entry # Tagging = rt.models.blogs.Tagging # Line = rt.models.courses.Line # List = rt.models.lists.List cons = rt.models.users.UserTypes.consultant dev = rt.models.users.UserTypes.developer yield create_user("marc", rt.models.users.UserTypes.user) yield create_user("mathieu", rt.models.users.UserTypes.user) yield create_user("luc", dev) yield create_user("jean", rt.models.users.UserTypes.senior) USERS = Cycler(User.objects.all()) WORKERS = Cycler(User.objects.filter(username__in='luc jean'.split())) END_USERS = Cycler(User.objects.filter(user_type='')) yield named(TT, _("Bugfix")) yield named(TT, _("Enhancement")) yield named(TT, _("Upgrade")) # sprint = named(Line, _("Sprint")) # yield sprint TYPES = Cycler(TT.objects.all()) yield Topic(name="Lino Core", ref="linõ") yield Topic(name="Lino Welfare", ref="welfäre") yield Topic(name="Lino Cosi", ref="così") yield Topic(name="Lino Voga", ref="faggio") # ref differs from name TOPICS = Cycler(Topic.objects.all()) for name in "Bus.co farm.co share.co".split(): obj = Company(name=name) yield obj yield Site(name=name + ".com", partner=obj) COMPANIES = Cycler(Company.objects.all()) yield Company(name="in3x") for u in Company.objects.exclude(name="in3x"): for i in range(3): yield Interest(owner=u, topic=TOPICS.pop()) roletype = rt.models.contacts.RoleType yield roletype(**dd.babel_values('name', en="Manager", fr='Gérant', de="Geschäftsführer", et="Tegevjuht")) yield roletype(**dd.babel_values( 'name', en="Director", fr='Directeur', de="Direktor", et="Direktor")) yield roletype(**dd.babel_values( 'name', en="Secretary", fr='Secrétaire', de="Sekretär", et="Sekretär")) yield roletype(**dd.babel_values('name', en="IT Manager", fr='Gérant informatique', de="EDV-Manager", et="IT manager")) yield roletype(**dd.babel_values( 'name', en="President", fr='Président', de="Präsident", et="President")) # RTYPES = Cycler(ReportingTypes.objects()) prj1 = Project( name="Framewörk", ref="linö", private=False, company=COMPANIES.pop(), # reporting_type=RTYPES.pop(), start_date=i2d(20090101)) yield prj1 yield Project( name="Téam", ref="téam", start_date=i2d(20100101), # reporting_type=RTYPES.pop(), company=COMPANIES.pop(), parent=prj1, private=True) prj2 = Project( name="Documentatión", ref="docs", private=False, # reporting_type=RTYPES.pop(), company=COMPANIES.pop(), start_date=i2d(20090101), parent=prj1) yield prj2 yield Project(name="Research", ref="research", private=False, company=COMPANIES.pop(), start_date=i2d(19980101), parent=prj2) yield Project( name="Shop", ref="shop", private=False, # reporting_type=RTYPES.pop(), company=COMPANIES.pop(), start_date=i2d(20120201), end_date=i2d(20120630)) PROJECTS = Cycler(Project.objects.all()) # for u in User.objects.all(): # yield Competence(user=u, project=PROJECTS.pop()) # yield Competence(user=u, project=PROJECTS.pop()) SITES = Cycler(Site.objects.exclude(name="pypi")) # LISTS = Cycler(List.objects.all()) if Milestone: for i in range(7): site = SITES.pop() d = dd.today(i * 2 - 20) kw = dict( user=WORKERS.pop(), start_date=d, # line=sprint, # project=PROJECTS.pop(), # expected=d, reached=d, # expected=d, reached=d, name="{}@{}".format(d.strftime("%Y%m%d"), site), # list=LISTS.pop() ) kw[Milestone.site_field_name] = site yield Milestone(**kw) # yield Milestone(site=SITES.pop(), expected=dd.today()) # yield Milestone(project=PROJECTS.pop(), expected=dd.today()) SITES = Cycler(Site.objects.all()) TicketStates = rt.models.tickets.TicketStates TSTATES = Cycler(TicketStates.objects()) Vote = rt.models.votes.Vote VoteStates = rt.models.votes.VoteStates VSTATES = Cycler(VoteStates.objects()) num = [0] def ticket(summary, **kwargs): num[0] += 1 u = WORKERS.pop() kwargs.update(ticket_type=TYPES.pop(), summary=summary, user=u, state=TSTATES.pop(), topic=TOPICS.pop()) if num[0] % 2: kwargs.update(site=SITES.pop()) if num[0] % 4: kwargs.update(private=True) if num[0] % 5: kwargs.update(end_user=END_USERS.pop()) if False: kwargs.update(project=PROJECTS.pop()) obj = Ticket(**kwargs) yield obj if obj.state.active: yield Vote(votable=obj, user=WORKERS.pop(), state=VSTATES.pop()) yield ticket("Föö fails to bar when baz", project=PROJECTS.pop()) yield ticket("Bar is not always baz", project=PROJECTS.pop()) yield ticket("Baz sucks") yield ticket("Foo and bar don't baz", project=PROJECTS.pop()) # a ticket without project: yield ticket("Cannot create Foo", description="""<p>When I try to create a <b>Foo</b>, then I get a <b>Bar</b> instead of a Foo.</p>""") yield ticket("Sell bar in baz", project=PROJECTS.pop()) yield ticket("No Foo after deleting Bar", project=PROJECTS.pop()) yield ticket("Is there any Bar in Foo?", project=PROJECTS.pop()) yield ticket("Foo never matches Bar", project=PROJECTS.pop()) yield ticket("Where can I find a Foo when bazing Bazes?", project=PROJECTS.pop()) yield ticket("Class-based Foos and Bars?", project=PROJECTS.pop()) yield ticket("Foo cannot bar", project=PROJECTS.pop()) # Example of memo markup: yield ticket("Bar cannot foo", project=PROJECTS.pop(), description="""<p>Linking to [ticket 1] and to [url http://luc.lino-framework.org/blog/2015/0923.html blog].</p> """) yield ticket("Bar cannot baz", project=PROJECTS.pop()) yield ticket("Bars have no foo", project=PROJECTS.pop()) yield ticket("How to get bar from foo", project=PROJECTS.pop()) n = Ticket.objects.count() for i in range(100): yield ticket("Ticket {}".format(i + n + 1), project=PROJECTS.pop()) if Milestone: WTYPES = Cycler(WishTypes.objects()) MILESTONES = Cycler(Milestone.objects.all()) for t in Ticket.objects.all(): t.set_author_votes() if t.id % 4: yield Deployment(milestone=MILESTONES.pop(), ticket=t, wish_type=WTYPES.pop()) yield Link(type=LinkTypes.requires, parent=Ticket.objects.get(pk=1), child=Ticket.objects.get(pk=2))
def objects(): add = Instantiator('cal.Priority', 'ref').build yield add( '1', **dd.babel_values('name', en=u"very urgent", de=u"sehr dringend", fr=u"très urgent", et=u"väga kiire")) yield add( '3', **dd.babel_values('name', en=u"urgent", de=u"dringend", fr=u"urgent", et="kiire")) yield add( '5', **dd.babel_values('name', en=u"normal", de=u"normal", fr=u"normal", et="keskmine")) yield add( '9', **dd.babel_values('name', en=u"not urgent", de=u"nicht dringend", fr=u"pas urgent", et="mitte kiire")) calendar = Instantiator('cal.Calendar').build general = calendar(**dd.str2kw('name', _("General"))) # de="Allgemein", # fr="Général", yield general settings.SITE.site_config.site_calendar = general yield settings.SITE.site_config event_type = Instantiator('cal.EventType').build holidays = event_type(is_appointment=False, all_rooms=True, **dd.str2kw('name', _("Holidays"))) yield holidays yield event_type(**dd.str2kw('name', _("Meeting"))) RecurrentEvent = dd.resolve_model('cal.RecurrentEvent') add = Instantiator(RecurrentEvent, event_type=holidays).build def holiday(month, day, en, de, fr, et=None): if et is None: et = en return add(every_unit=cal.Recurrencies.yearly, monday=True, tuesday=True, wednesday=True, thursday=True, friday=True, saturday=True, sunday=True, every=1, start_date=datetime.date(year=cal.DEMO_START_YEAR, month=month, day=day), **dd.babelkw('name', en=en, de=de, fr=fr, et=et)) yield holiday(1, 1, "New Year's Day", "Neujahr", "Jour de l'an", "Uusaasta") yield holiday(5, 1, "International Workers' Day", "Tag der Arbeit", "Premier Mai", "kevadpüha") yield holiday(7, 21, "National Day", "Nationalfeiertag", "Fête nationale", "Belgia riigipüha") yield holiday(8, 15, "Assumption of Mary", "Mariä Himmelfahrt", "Assomption de Marie") yield holiday(10, 31, "All Souls' Day", "Allerseelen", "Commémoration des fidèles défunts") yield holiday(11, 1, "All Saints' Day", "Allerheiligen", "Toussaint") yield holiday(11, 11, "Armistice with Germany", "Waffenstillstand", "Armistice") yield holiday(12, 25, "Christmas", "Weihnachten", "Noël", "Esimene Jõulupüha") summer = holiday(07, 01, "Summer holidays", "Sommerferien", "Vacances d'été", "Suvevaheaeg") summer.end_date = summer.start_date.replace(month=8, day=31) yield summer ar = settings.SITE.login() for obj in RecurrentEvent.objects.all(): if not obj.update_reminders(ar): raise Exception("Oops, %s generated no events" % obj)
def objects(): productcat = Instantiator('products.ProductCat').build product = Instantiator('products.Product', "sales_price cat").build furniture = productcat( id=1, **dd.babel_values( 'name', en="Furniture", et="Mööbel", de="Möbel", fr="Meubles")) yield furniture # print "foo", furniture.id, furniture hosting = productcat( id=2, **dd.babel_values( 'name', en="Website Hosting", et="Veebimajutus", de="Website-Hosting", fr="Hébergement de sites Internet")) yield hosting kw = dd.babel_values('name', en="Wooden table", et=u"Laud puidust", de="Tisch aus Holz", fr=u"Table en bois") kw.update(dd.babel_values( 'description', en="""\ This table is made of pure wood. It has **four legs**. Designed to fit perfectly with **up to 6 wooden chairs**. Product of the year 2008.""", et="""\ See laud on tehtud ehtsast puust. Sellel on **neli jalga**. Disainitud sobida kokku **kuni 6 puidust tooliga**. Product of the year 2008.""", de="""\ Dieser Tisch ist aus echtem Holz. Er hat **vier Beine**. Passt perfekt zusammen mit **bis zu 6 Stühlen aus Holz**. Produkt des Jahres 2008.""", fr="""\ Cette table est en bois authentique. Elle a **quatre jambes**. Conçue pour mettre jusqu'à **6 chaises en bois**. Produit de l'année 2008.""", )) yield product("199.99", 1, **kw) yield product("99.99", 1, **dd.babel_values('name', en="Wooden chair", et="Tool puidust", de="Stuhl aus Holz", fr="Chaise en bois")) yield product("129.99", 1, **dd.babel_values('name', en="Metal table", et="Laud metallist", de="Tisch aus Metall", fr="Table en métal")) yield product("79.99", 1, **dd.babel_values('name', en="Metal chair", et="Tool metallist", de="Stuhl aus Metall", fr="Chaise en métal")) hosting = product("3.99", 2, **dd.babel_values('name', en="Website hosting 1MB/month", et="Majutus 1MB/s", de="Website-Hosting 1MB/Monat", fr="Hébergement 1MB/mois")) yield hosting yield product("30.00", 2, **dd.babel_values('name', en="IT consultation & maintenance", et=u"IKT konsultatsioonid & hooldustööd", de=u"EDV Konsultierung & Unterhaltsarbeiten", fr=u"ICT Consultation & maintenance")) yield product("35.00", 2, **dd.babel_values( 'name', en="Server software installation, configuration and administration", et="Serveritarkvara installeerimine, seadistamine ja administreerimine", de="Server software installation, configuration and administration", fr="Server software installation, configuration and administration")) yield product("40.00", 2, **dd.babel_values( 'name', en="Programming", et="Programmeerimistööd", de="Programmierung", fr="Programmation")) yield product("25.00", 2, **dd.babel_values( 'name', en="Image processing and website content maintenance", et="Pilditöötlus ja kodulehtede sisuhaldustööd", de="Bildbearbeitung und Unterhalt Website", fr="Traitement d'images et maintenance site existant"))
def objects(): cal = rt.models.cal PlannerColumns = cal.PlannerColumns add = Instantiator('cal.Priority', 'ref').build yield add('1', **dd.babel_values('name', en=u"very urgent", de=u"sehr dringend", fr=u"très urgent", et=u"väga kiire")) yield add('3', **dd.babel_values('name', en=u"urgent", de=u"dringend", fr=u"urgent", et="kiire")) yield add('5', **dd.babel_values('name', en=u"normal", de=u"normal", fr=u"normal", et="keskmine")) yield add('9', **dd.babel_values('name', en=u"not urgent", de=u"nicht dringend", fr=u"pas urgent", et="mitte kiire")) calendar = Instantiator('cal.Calendar').build general = calendar(**dd.str2kw('name', _("General"))) yield general # settings.SITE.site_config.site_calendar = general d = dd.demo_date() if d.month > 4: d = d.replace(month=4, day=1) else: d = d.replace(month=4, day=1, year=d.year-1) settings.SITE.site_config.update( site_calendar=general, hide_events_before=d) # yield settings.SITE.site_config event_type = Instantiator('cal.EventType').build holidays = event_type( planner_column=PlannerColumns.external, is_appointment=False, all_rooms=True, **dd.str2kw('name', _("Holidays"))) yield holidays meeting = event_type( planner_column=PlannerColumns.external, **dd.str2kw('name', _("Meeting"))) yield meeting yield event_type( planner_column=PlannerColumns.internal, transparent=True, **dd.str2kw('name', _("Internal"))) RecurrentEvent = rt.models.cal.RecurrentEvent add = Instantiator(RecurrentEvent, event_type=holidays).build def holiday(month, day, en, de, fr, et=None): if et is None: et = en return add( every_unit=Recurrencies.yearly, monday=True, tuesday=True, wednesday=True, thursday=True, friday=True, saturday=True, sunday=True, every=1, start_date=datetime.date( year=cal.DEMO_START_YEAR, month=month, day=day), **dd.babelkw('name', en=en, de=de, fr=fr, et=et)) yield holiday(1, 1, "New Year's Day", "Neujahr", "Jour de l'an", "Uusaasta") yield holiday(5, 1, "International Workers' Day", "Tag der Arbeit", "Premier Mai", "kevadpüha") yield holiday(7, 21, "National Day", "Nationalfeiertag", "Fête nationale", "Belgia riigipüha") yield holiday(8, 15, "Assumption of Mary", "Mariä Himmelfahrt", "Assomption de Marie") yield holiday(10, 31, "All Souls' Day", "Allerseelen", "Commémoration des fidèles défunts") yield holiday(11, 1, "All Saints' Day", "Allerheiligen", "Toussaint") yield holiday(11, 11, "Armistice with Germany", "Waffenstillstand", "Armistice") yield holiday(12, 25, "Christmas", "Weihnachten", "Noël", "Esimene Jõulupüha") easter1 = easter(cal.DEMO_START_YEAR) def relative_holiday(offset, name): return add( every_unit=Recurrencies.easter, every=1, start_date=easter1+relativedelta(days=offset), **dd.str2kw('name', name)) yield relative_holiday(0, _("Easter sunday")) yield relative_holiday(1, _("Easter monday")) yield relative_holiday(39, _("Ascension of Jesus")) yield relative_holiday(50, _("Pentecost")) yield relative_holiday(-2, _("Good Friday")) yield relative_holiday(-46, _("Ash Wednesday")) yield relative_holiday(-48, _("Rosenmontag")) ar = settings.SITE.login() for obj in RecurrentEvent.objects.all(): if not obj.update_reminders(ar): raise Exception("Oops, %s generated no events" % obj) # event policies kw = dict() for wd in WORKDAYS: kw[wd.name] = True kw.update(event_type=meeting) exam_policy = Instantiator( 'cal.EventPolicy', 'every', every_unit=DurationUnits.months, **kw).build yield exam_policy( 1, start_time="9:00", **dd.str2kw('name', _("Every month"))) yield exam_policy( 2, start_time="9:00", **dd.str2kw('name', _("Every 2 months"))) yield exam_policy( 3, **dd.str2kw('name', _("Every 3 months"))) exam_policy = Instantiator( 'cal.EventPolicy', 'every', every_unit=DurationUnits.weeks, **kw).build yield exam_policy( 2, start_time="9:00", **dd.str2kw('name', _("Every 2 weeks"))) exam_policy = Instantiator( 'cal.EventPolicy', 'every', every_unit=DurationUnits.days, **kw).build yield exam_policy( 10, max_events=1, start_time="9:00", **dd.str2kw('name', _("Once after 10 days"))) exam_policy = Instantiator('cal.EventPolicy').build yield exam_policy(**dd.str2kw('name', _("Other"))) DPR = rt.models.cal.DailyPlannerRow yield DPR(end_time="12:00", **dd.str2kw('designation', _("AM"))) yield DPR(start_time="12:00", **dd.str2kw('designation', _("PM"))) yield DPR(**dd.str2kw('designation', _("All day")))