title: You can't execute queries until the end of the 'atomic' block
body: <p>I was creating custom user in django for that i wrote following code in initial migration file but when we hit migrate command it gives TransactionManagementError</p>
  <p>0001_initial.py</p>
  <pre><code>from django.db import migrations
  from api.user.models import CustomUser
  
  class Migration(migrations.Migration):
  def seed_data(apps,schema_editor):
      user = CustomUser(name = &quot;abc&quot;,email = &quot;abc@gmail.com&quot;,is_staff = True,is_superuser = True,
                         phone = &quot;9874561230&quot;,gender = &quot;Male&quot;)
      user.set_password(&quot;12345&quot;)
      user.save()
  
  dependencies = [
  
  ]
  
  operations = [
      migrations.RunPython(seed_data),
  ]
  </code></pre>
  <p>error occcured:</p>
  <pre><code>django.db.transaction.TransactionManagementError: An error occurred in the current transaction. You 
  can't execute queries until the end of the 'atomic' block.
  </code></pre>