Answer the question
In order to leave comments, you need to log in
Why is the object not saved to the database when the save() method is called?
I am doing in the application the transfer of rarely used objects to another database table, in order to optimize it. I ran into a strange problem, when the save() method is called, the object is simply not saved in the database. For the transfer, I made the arch() and rearch() methods for the original model and the twin model. It should have worked in theory, but it was difficult in practice. Tell me what am I doing wrong?
Transfer method in this model:
class Project(models.Model):
def arch(self):
arch = PrjArch()
arch.id = self.id
arch.name = self.name
arch.idKontr = self.idKontr
arch.number = self.number
arch.summaPlan = self.summaPlan
arch.idKontrUch = self.idKontrUch
arch.idTip = self.idTip
arch.idStatus = self.idStatus
arch.idIstFin = self.idIstFin
arch.idKv = self.idKv
arch.idTeam = self.idTeam
arch.expirationDate = self.expirationDate
arch.dateDogov = self.dateDogov
arch.dateDogovPost = self.dateDogovPost
arch.dateGK = self.dateGK
arch.datePostLPU = self.datePostLPU
arch.dateVVE = self.dateVVE
arch.utver = self.utver
arch.idSotrInit = self.idSotrInit
arch.description = self.description
arch.save()
class PrjArch(Project):
def rearch(self):
# метод выше
Answer the question
In order to leave comments, you need to log in
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question