KnowledgeHub
Questions
Tags
Users
Search
Alex Rivera
|
Logout
Edit Question
Title
Body
Let's say I have a class named Hero with a field named "name". Everytime a new Hero object is created, I want to append " is a hero" . Can I use __init__ for that? Or is there a django-specific method I can override for that? class Hero(modes.Model) name = models.CharField(max_length=100) def __init__(self, *args, **kwargs): name += " is a hero" super(Hero, self).__init__(*args, **kwargs)
Tags (comma-separated)
Save Edits
Cancel