예제 #1
0
 def setUp(self):
     self.module_name = "m2m_test"
     self.pb = ProtocolBuffer(self.module_name)
     self.m2m = genMsg('ManyToManyTest',
                                     models.ManyToManyTest)
     self.pb.addMessage(self.m2m)
     
     self.django_class_fields = [field for field in 
                            models.ManyToManyTest._meta.local_fields +
                            models.ManyToManyTest._meta.many_to_many]
     self.pb_fields_by_name = dict([(f.name, f) for f in self.m2m.mapped_fields])
     mod_name = pbandj.genMod(self.pb)
     global proto
     proto = __import__(mod_name)
     self.simple1 = models.Simple()
     self.simple1.val = 1234
     self.simple1.save()
     self.simple2 = models.Simple()
     self.simple2.val = 5678
     self.simple2.save()
     self.con = Converter()
예제 #2
0
 def setUp(self):
     self.module_name = "fk_test"
     self.pb = ProtocolBuffer(self.module_name)
     self.fkt = genMsg('ForeignKeyTest',
                                     models.ForeignKeyTest)
     self.pb.addMessage(self.fkt)
     
     self.django_class_fields = [field for field in 
                            models.ForeignKeyTest._meta.local_fields]
     self.pb_fields_by_name = dict([(f.name, f) for f in self.fkt.mapped_fields])
     mod_name = pbandj.genMod(self.pb)
     global proto
     proto = __import__(mod_name)
     self.simple = models.Simple()
     self.simple.val = 1234
     self.simple.save()
     self.con = Converter()
예제 #3
0
 def setUp(self):
     self.module_name = "m2m_through_test_no_recurse"
     self.pb = ProtocolBuffer(self.module_name)
     self.m2m = genMsg('ManyToManyThroughTest',
                                     models.ManyToManyThroughTest, recurse_fk=False)
     self.pb.addMessage(self.m2m)
     
     self.django_class_fields = [field for field in 
                            models.ManyToManyThroughTest._meta.local_fields +
                            models.ManyToManyThroughTest._meta.many_to_many]
     
     self.django_assoc_class_fields = [field for field in 
                            models.M2MAssocTest._meta.local_fields +
                            models.M2MAssocTest._meta.many_to_many]
     
     self.pb_fields_by_name = dict([(f.name, f) for f in self.m2m.mapped_fields])
     self.pb_assoc_fields_by_name = dict([(f.name, f) for f in self.pb_fields_by_name['m2m_test'].pb_type.mapped_fields])
     mod_name = pbandj.genMod(self.pb)
     global proto
     proto = __import__(mod_name)
     self.simple = models.Simple()
     self.simple.val = 1234
     self.simple.save()
     self.con = Converter()