title: How reuse __str__ function in models.py for each class model
body: <p>Hello everyone I start use Django Framework and I have a question.</p>
  
  <p>Django's documentation says, when I create class(model) in the end of class I should write function to return string value for my object, it all look like this:</p>
  
  <pre><code>class NameClass(models.Model):
      field_name_1 = models.SomeTypeField()
      field_name_2 = models.SomeTypeField()
      field_name_3 = models.SomeTypeField()
      ...
      field_name_n =  models.SomeTypeField() 
      def __str__(self):
          return self.field_name_1, ...self.field_name_n 
  </code></pre>
  
  <p>In this case I wrote function for return string value, cause I have a lot of fields in my models and write each of them in <code>__str__</code> function it will be a lot of work. So my function look like this:</p>
  
  <pre><code>def __str__(self):
      fields =''
      for x in self._meta.fields:
          fields = fields + string.split(str(x),".")[2]+' '
      return fields
  </code></pre>
  
  <p>Now question. How can I reuse this function in each class(model) in model.py, without copy paste this function?</p>
  
  <p>For example. I have a lot of classes(mdoels):</p>
  
  <pre><code>class FirstModel(models.Model):
      ...
      def __str__(self):
          ...
  class SecondModel(models.Model):
      ...
      def __str__(self):
          ...
  
  class ThirdModel(models.Model):
      ...
      def __str__(self):
          ... 
  class EtcModel(models.Model):
      ....
      def __str__(self):
  </code></pre>
  
  <p>And I don't want copy paste my function everytime, may exist some way to use it like a global function or another way to solve it.</p>