title: Generate unique ascending numerical id in django model field
body: <pre><code>Class Car(models.Model):
       type = models.CharField('Type', max_length=100)
       code = models.CharField('Code', max_length=10, blank=True, null=True)
  </code></pre>
  
  <p>Considering I want to make a list of cars depending on their types. I have a model and fields like the above code, 
  I want to make the code uniquely increment based on the type of the car. For instance, if an instance of a car was created with type field as 'HD', then the code would be 'HD-0000001'. The next model created with the type HD as well would be HD-0000002, so on, so forth. If another type is given, it will save as 'type' + 'the last saved number + 1'.  </p>
  
  <p>I know I have to do something in the save() function, but I can't figure out how to make it unique based on different types. </p>
  
  <p>Any suggestions will be truly appreciated. 
  Thank you!</p>