I have an app that lets people create tickets, and each Account owner using my app can create tickets.
Firstly, should it be unique per account do you think? Or, should it be completely unique?
Like this:
class Ticket(models.Model):
"""
An ticket created by an Account holder.
"""
account = models.OneToOneField('Account')
number = models.CharField(max_length=20, verbose_name='Ticket Number')
class Meta:
unique_together = (('account', 'number'),)
or this, respectively:
class Ticket(models.Model):
"""
An ticket created by an Account holder.
"""
account = models.OneToOneField('Account')
number = models.CharField(unique=True, max_length=20, verbose_name='Ticket Number')
Then, of course I want the order numbers to represent the account, so possibly a sample order number for an account that has the id: "chris" could be "chris-41984" or something like that. Would you create a model method for this, or...?