1

私は次のモデルを持っています:

class PropertyPhoto(models.Model):
    property = models.ForeignKey('Property')
    photo_show = ProcessedImageField(upload_to=get_web_watermark,
                                  processors=[Watermark()],                                     
                                  options={'quality': 95})

およびカスタム透かしクラス:

class Watermark(object):    

    def process(self, image):
        try:
            this_property = Property.objects.get(pk=*self.property.id*)
        except Property.DoesNotExist:
            print "error"

Watermark クラス内からモデル属性「プロパティ」にアクセスするにはどうすればよいですか?

ありがとうございました

4

1 に答える 1