def base_create_dep_objs(cls): """ Create all objects that InstrumentGroup need. """ groups = Groups() TestGroups.base_create_dep_objs() groups.from_hash(SAMPLE_GROUP_HASH) groups.save(force_insert=True) inst = Instruments() TestInstruments.base_create_dep_objs() inst.from_hash(SAMPLE_INSTRUMENT_HASH) inst.save(force_insert=True)
def base_create_dep_objs(cls): """ Create all objects that UserGroup need. """ member = Users() TestUsers.base_create_dep_objs() member.from_hash(SAMPLE_USER_HASH) member.save(force_insert=True) groups = Groups() TestGroups.base_create_dep_objs() groups.from_hash(SAMPLE_GROUP_HASH) groups.save(force_insert=True)
def from_hash(self, obj): """Convert the hash into the object.""" super(UserGroup, self).from_hash(obj) if 'person_id' in obj: self.person = Users.get(Users.id == obj['person_id']) if 'group_id' in obj: self.group = Groups.get(Groups.id == obj['group_id'])
def from_hash(self, obj): """Convert the hash into the object.""" super(InstrumentGroup, self).from_hash(obj) if 'instrument_id' in obj: self.instrument = Instruments.get( Instruments.id == obj['instrument_id']) if 'group_id' in obj: self.group = Groups.get(Groups.id == obj['group_id'])
def from_hash(self, obj): """ Converts the hash into the object """ super(UserGroup, self).from_hash(obj) if 'person_id' in obj: self.person = Users.get(Users.id == obj['person_id']) if 'group_id' in obj: self.group = Groups.get(Groups.id == obj['group_id'])
def from_hash(self, obj): """ Converts the hash into the object """ super(InstrumentGroup, self).from_hash(obj) if 'instrument_id' in obj: self.instrument = Instruments.get(Instruments.id == obj['instrument_id']) if 'group_id' in obj: self.group = Groups.get(Groups.id == obj['group_id'])
def where_clause(self, kwargs): """Where clause for the various elements.""" where_clause = super(UserGroup, self).where_clause(kwargs) if 'person_id' in kwargs: user = Users.get(Users.id == kwargs['person_id']) where_clause &= Expression(UserGroup.person, OP.EQ, user) if 'group_id' in kwargs: group = Groups.get(Groups.id == kwargs['group_id']) where_clause &= Expression(UserGroup.group, OP.EQ, group) return where_clause
def where_clause(self, kwargs): """Where clause for the various elements.""" where_clause = super(InstrumentGroup, self).where_clause(kwargs) if 'instrument_id' in kwargs: instrument = Instruments.get( Instruments.id == kwargs['instrument_id']) where_clause &= Expression(InstrumentGroup.instrument, OP.EQ, instrument) if 'group_id' in kwargs: group = Groups.get(Groups.id == kwargs['group_id']) where_clause &= Expression(InstrumentGroup.group, OP.EQ, group) return where_clause
def where_clause(self, kwargs): """ Where clause for the various elements. """ where_clause = super(UserGroup, self).where_clause(kwargs) if 'person_id' in kwargs: user = Users.get(Users.id == kwargs['person_id']) where_clause &= Expression(UserGroup.person, OP.EQ, user) if 'group_id' in kwargs: group = Groups.get(Groups.id == kwargs['group_id']) where_clause &= Expression(UserGroup.group, OP.EQ, group) return where_clause
def where_clause(self, kwargs): """ Where clause for the various elements. """ where_clause = super(InstrumentGroup, self).where_clause(kwargs) if 'instrument_id' in kwargs: instrument = Instruments.get(Instruments.id == kwargs['instrument_id']) where_clause &= Expression(InstrumentGroup.instrument, OP.EQ, instrument) if 'group_id' in kwargs: group = Groups.get(Groups.id == kwargs['group_id']) where_clause &= Expression(InstrumentGroup.group, OP.EQ, group) return where_clause
def base_create_dep_objs(cls): """Create all objects that InstrumentGroup need.""" groups = Groups() TestGroups.base_create_dep_objs() groups.from_hash(SAMPLE_GROUP_HASH) groups.save(force_insert=True) inst = Instruments() TestInstruments.base_create_dep_objs() inst.from_hash(SAMPLE_INSTRUMENT_HASH) inst.save(force_insert=True)
def base_create_dep_objs(cls): """Create all objects that UserGroup need.""" member = Users() TestUsers.base_create_dep_objs() member.from_hash(SAMPLE_USER_HASH) member.save(force_insert=True) groups = Groups() TestGroups.base_create_dep_objs() groups.from_hash(SAMPLE_GROUP_HASH) groups.save(force_insert=True)