ZouhairNj
ZouhairNj

Reputation: 11

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 !!

Upvotes: 1

Views: 536

Answers (1)

ZouhairNj
ZouhairNj

Reputation: 11

yes i saved the instance

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

but title field still empty

Upvotes: 0

Related Questions