title: How to prevent auto field to update when Sql Server raise error?
body: <p>I have this primary key : transaction_number</p>
  
  <p>It auto increment when I insert a model with a valid token.</p>
  
  <p>Whenever I try to insert two models with the same token, I use the exception <code>IntegrityError</code> to ignore.</p>
  
  <p>The problem is, if the current index from transaction_number is 5 and I try to insert something like 20 models with the same token, django will raise IntegrityError but the index will be 25.</p>
  
  <p>How I can stop the index to update?</p>
  
  <p>Thanks everyone</p>
  
  <p>Model : </p>
  
  <pre><code>class Transaction(models.Model):
      transaction_number = models.AutoField(primary_key = True)
      token = models.CharField(max_length=32, unique = True)
      login = models.ForeignKey(Account, related_name = 'transactions', db_column = 'login', to_field = 'login')
      price = models.CharField(max_length = 7)
      description = models.CharField(max_length = 25)
      status = models.CharField(max_length = 25)
      date = models.DateTimeField(auto_now_add=True)
  
      class Meta:
          db_table = 'Transactions'
  </code></pre>
  
  <p>Table :</p>
  
  <pre><code>CREATE TABLE [dbo].[Transactions](
      [transaction_number] [int] IDENTITY(1,1) NOT NULL,
      [token] [varchar](32) NOT NULL,
      [login] [varchar](10) NOT NULL,
      [price] [varchar](7) NOT NULL,
      [description] [varchar](25) NOT NULL,
      [status] [varchar](25) NOT NULL,
      [date] [datetime] NOT NULL,
   CONSTRAINT [PK_Transactions_1] PRIMARY KEY CLUSTERED 
  (
      [transaction_number] ASC
  )WITH (PAD_INDEX  = OFF, STATISTICS_NORECOMPUTE  = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS  = ON, ALLOW_PAGE_LOCKS  = ON) ON [PRIMARY]
  ) ON [PRIMARY]
  </code></pre>