简体   繁体   中英

Proxy model django from package

I have a problem in my code

from mailbox import Message
from django.db import models
from django.conf import settings
        

class MyMessage(Message):
    class Meta:
        Proxy = True

    def creattask(self):
        task = Task(title=self.subject)


class Task(models.Model):
    title = models.CharField(max_length=256)

I want to fill title attribute of Task model from subject Message model. for that, I use createtask function.

However, when I go to the admin page I found Task(title) model empty,! any help, please !!

yes i saved the instance

 def save(self, **kwargs):
     # some business rules here
     super(Task, self).save()

but title field still empty

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM