Skip to content

Commit

Permalink
proposalbase: gen name when save
Browse files Browse the repository at this point in the history
Signed-off-by: Hiroshi Miura <[email protected]>
  • Loading branch information
miurahr committed Sep 14, 2015
1 parent 92ee140 commit 8aa5abb
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion symposion/proposals/models.py
Original file line number Diff line number Diff line change
Expand Up @@ -88,6 +88,8 @@ class ProposalBase(models.Model):
kind = models.ForeignKey(ProposalKind, verbose_name=_("Kind"))

title = models.CharField(max_length=100, verbose_name=_("Title"))
name = models.CharField(max_length=100, editable=False)

description = models.TextField(
_("Brief Description"),
max_length=400, # @@@ need to enforce 400 in UI
Expand Down Expand Up @@ -163,8 +165,12 @@ def notification_email_context(self):
"kind": self.kind.name,
}

def save(self, *args, **kwargs):
self.name = "%s - %s(%s)" % (self.title, self.speaker.name, self.kind.name)
super(ProposalBase, self).save(*args, **kwargs)

def __str__(self):
return "%s - %s(%s)" % (self.title, self.speaker.name, self.kind.name)
return self.name

reversion.register(ProposalBase)

Expand Down

0 comments on commit 8aa5abb

Please sign in to comment.