Example #1
0
 def fill_data(self):
     '''
     Fills in dummy content that we will use for testing
     2 members, Peter and Hans.
     2 workgroups, Systems and Besteling.
     Peter is the only member in Systems.
     Both are members in Bestel, with Hans leading that one.
     Bestel has a shift ('do stuff') for Peter.
     '''
     m1 = Member(fname=u'Peter', prefix=u'de', lname='Pan')
     m1.mem_email = '*****@*****.**'
     m1.mem_enc_pwd = md5_crypt.hash('notsecret')
     self.DBSession.add(m1)
     m2 = Member(fname=u'Hans', prefix=u'de', lname='Wit')
     m1.mem_email = '*****@*****.**'
     self.DBSession.add(m2)
     wg1 = Workgroup(name=u'Systems', desc=u'IT stuff')
     self.DBSession.add(wg1)
     wg2 = Workgroup(name=u'Besteling', desc=u'Besteling at wholesale')
     self.DBSession.add(wg2)
     self.DBSession.flush()  # flush now to get member and workgroup IDs
     wg1.members.append(m1)
     wg1.leaders.append(m1)
     wg2.members.append(m1)
     wg2.members.append(m2)
     wg2.leaders.append(m2)
     self.DBSession.flush()
     s = Shift(wg2.id, 'do stuff', 2012, 6, member=m1)
     self.DBSession.add(s)
     self.DBSession.flush()
     # reserved transaction types
     for rt in reserved_ttype_names:
         self.DBSession.add(TransactionType(name=rt))
     self.DBSession.flush()
Example #2
0
def addOldNames():
    m1 = Member(fname=u'Peter', prefix=u'de', lname='Pan')
    m1.mem_email = '*****@*****.**'
    m1.mem_enc_pwd = md5crypt('notsecret', 'notsecret')
    DBSession.add(m1)
    m2 = Member(fname=u'Hans', prefix=u'de', lname='Wit')
    m1.mem_email = '*****@*****.**'
    DBSession.add(m2)
    wg1 = Workgroup(name=u'Systems', desc=u'IT stuff')
    DBSession.add(wg1)
    wg2 = Workgroup(name=u'Besteling', desc=u'Besteling at wholesale')
    DBSession.add(wg2)
    DBSession.flush()  # flush now to get member and workgroup IDs
    wg1.members.append(m1)
    wg1.leaders.append(m1)
    wg2.members.append(m1)
    wg2.members.append(m2)
    wg2.leaders.append(m2)
    DBSession.flush()
    s = Shift(wg2.id, 'do stuff', 2012, 6, member=m1)
    DBSession.add(s)
    DBSession.flush()
Example #3
0
def createWGs():
    wgs = []
    wgs.append(
        Workgroup(name=u'Systems2', desc=u'IT stuff', required_members=3))
    wgs.append(
        Workgroup(name=u'Besteling2',
                  desc=u'Besteling at wholesale',
                  required_members=8))
    wgs.append(
        Workgroup(name=u'Cafe', desc=u'Cakes and coffee', required_members=14))
    wgs.append(
        Workgroup(name=u'Finance',
                  desc=u'Making sure money is where it is supposed to be',
                  required_members=8))
    wgs.append(
        Workgroup(name=u'Vers', desc=u'Fresh food!', required_members=14))
    wgs.append(
        Workgroup(name=u'Membership',
                  desc=u'Human resources',
                  required_members=4))
    for wg in wgs:
        DBSession.add(wg)
    DBSession.flush()
    return wgs
Example #4
0
 def __call__(self):
     wg = Workgroup()
     self.possible_members = get_possible_members(DBSession(), wg)
     return dict(wg=wg, msg="You're about to make a new workgroup.")