src/cm/models.py
changeset 130 f257ad33bed5
parent 103 61fd17f9ab78
child 140 87eec0c11516
equal deleted inserted replaced
129:65c9d8baf7d0 130:f257ad33bed5
   262             comment.reply_to = reply_to
   262             comment.reply_to = reply_to
   263         self.update_keys(comment)
   263         self.update_keys(comment)
   264         comment.save(keep_dates=keep_dates)
   264         comment.save(keep_dates=keep_dates)
   265         return comment
   265         return comment
   266     
   266     
       
   267 from cm.models_base import KEY_MAX_SIZE, generate_key
       
   268 
   267 class Comment(PermanentModel, AuthorModel):
   269 class Comment(PermanentModel, AuthorModel):
   268     modified = models.DateTimeField()
   270     modified = models.DateTimeField()
   269     created = models.DateTimeField()
   271     created = models.DateTimeField()
       
   272 
       
   273     # key to identify same comments across versions
       
   274     id_key = models.CharField(max_length=KEY_MAX_SIZE, db_index=True, default=generate_key)
   270 
   275 
   271     text_version = models.ForeignKey("TextVersion")
   276     text_version = models.ForeignKey("TextVersion")
   272 
   277 
   273     # comment_set will be replies
   278     # comment_set will be replies
   274     reply_to = models.ForeignKey("Comment", null=True, blank=True)
   279     reply_to = models.ForeignKey("Comment", null=True, blank=True)