Example #1
0
 def save(self, *args, **kwargs):
     content_type = self.cleaned_data['content_type']
     field = ObjectService.get_only_field(content_type.model_class())
     instance = super(ProceedingMetaForm, self).save(commit=False)
     instance.field = field.name
     return super(ProceedingMetaForm, self).save(*args, **kwargs)
Example #2
0
 def test_get_only_fields(self):
     field = ObjectService.get_only_field(TestModel)
     self.assertEqual('my_field', field.name)
Example #3
0
 def save(self, *args, **kwargs):
     content_type = self.cleaned_data['content_type']
     field = ObjectService.get_only_field(content_type.model_class())
     instance = super(ProceedingMetaForm, self).save(commit=False)
     instance.field = field.name
     return super(ProceedingMetaForm, self).save(*args, **kwargs)
 def test_get_only_fields(self):
     field = ObjectService.get_only_field(TestModel)
     self.assertEqual('my_field', field.name)