Changes between Initial Version and Version 1 of Ticket #29691


Ignore:
Timestamp:
Aug 20, 2018, 8:46:34 AM (6 years ago)
Author:
James Pic
Comment:

Legend:

Unmodified
Added
Removed
Modified
  • Ticket #29691 – Description

    initial v1  
    1111Can we perhaps add an exception (not Exception!) for child models that override the automatic ptr field that is a OneToOneField, with a ForeignKey ?
    1212
     13An example use case:
     14
     15{{{
     16class Caller(models.Model):
     17    callback = models.CharField()
     18    max_attemps = models.IntegerField(default=1)
     19
     20    def call(self):
     21         call = Call(caller_ptr=self)
     22         try:
     23             call.execute()
     24         except:
     25             if self.max_attempts > Call.objects.filter(caller_ptr=self):
     26                 return self.call()
     27             raise
     28         return call.result
     29
     30class Call(Caller):
     31    result = models.PickleField()
     32
     33    def call(self):
     34         self.result = import_string(self.callback)()
     35         return self.result
     36}}}
     37
     38
    1339Thanks
Back to Top