Changes between Initial Version and Version 1 of Ticket #29738, comment 6


Ignore:
Timestamp:
Sep 15, 2018, 3:13:33 PM (6 years ago)
Author:
Can Sarıgöl

Legend:

Unmodified
Added
Removed
Modified
  • Ticket #29738, comment 6

    initial v1  
    33
    44{{{
     5class UnserializablesSerializer(BaseSerializer):
     6    def serialize(self):
     7        from django.utils.deconstruct import deconstructible
     8        deconstructible_value = deconstructible(
     9            self.value.__class__,
     10            path=self.value.__module__ + "." + self.value.__class__.__name__
     11        )
     12        import pdb
     13        pdb.set_trace()
     14        self.value = deconstructible_value(self.value.__init__)
     15        return DeconstructableSerializer(self.value).serialize()
     16
     17
    518def serializer_factory(value):
    619    ...
    720
    821
    9     from django.utils.deconstruct import deconstructible
    10     deconstructible_value = deconstructible(
    11         value.__class__,
    12         path=value.__module__ + "." + value.__class__.__name__
    13     )
    14     value = deconstructible_value(value.__init__)
    15     return DeconstructableSerializer(value)
     22    if hasattr(value, "__module__") and hasattr(value, "__class__"):
     23        return UnserializablesSerializer(value)
    1624
    1725    raise ValueError(...)
Back to Top