From cad6d1eb4d53714ee20dd0505d6a294061fe7273 Mon Sep 17 00:00:00 2001 From: Hiroshi Miura Date: Sat, 25 Jul 2015 15:20:16 +0900 Subject: [PATCH] proposalbase: gen name when save Signed-off-by: Hiroshi Miura --- symposion/proposals/models.py | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/symposion/proposals/models.py b/symposion/proposals/models.py index 7d602241..b166fd29 100644 --- a/symposion/proposals/models.py +++ b/symposion/proposals/models.py @@ -83,6 +83,8 @@ class ProposalBase(models.Model): kind = models.ForeignKey(ProposalKind) title = models.CharField(max_length=100) + name = models.CharField(max_length=100, editable=False) + description = models.TextField( _("Brief Description"), max_length=400, # @@@ need to enforce 400 in UI @@ -155,8 +157,12 @@ def notification_email_context(self): "kind": self.kind.name, } + def save(self, *args, **kwargs): + self.name = u"%s - %s(%s)" % (self.title, self.speaker.name, self.kind.name) + super(ProposalBase, self).save(*args, **kwargs) + def __unicode__(self): - return u"%s - %s(%s)" % (self.title, self.speaker.name, self.kind.name) + return self.name reversion.register(ProposalBase)