title: POST 400 Bad Request Django
body: <p>My branch model has 4 primary keys which are unique together: ('branch_short_name', 'partner_short_name', 'tenant', 'contributor'). I would like to be able to create/ POST some objects with similar
  'branch_short_name', 'partner_short_name', 'tenant' but then with a unique 'contributor'.
  When doing that I get a 400 bad request error in postman. I don't know where the problem lies, in the model or in the serializer.</p>
  <p>models.py</p>
  <pre><code>class Branch(models.Model):
  additional_address1 = models.CharField(max_length=255, blank=True, null=True)
  additional_address2 = models.CharField(max_length=255, blank=True, null=True)
  branch_number = models.CharField(max_length=255, blank=True, null=True)
  branch_short_name = models.CharField(primary_key=True, max_length=255)
  building = models.CharField(max_length=255, blank=True, null=True)
  city = models.CharField(max_length=255, blank=True, null=True)
  end_date = models.DateTimeField(blank=True, null=True)
  country_code = models.CharField(max_length=255, blank=True, null=True)
  created = models.DateTimeField(blank=True, null=True)
  display_name = models.CharField(max_length=255, blank=True, null=True)
  display_web = models.BooleanField(blank=True, null=True)
  district = models.CharField(max_length=255, blank=True, null=True)
  file_origin_date = models.DateTimeField(blank=True, null=True)
  filename = models.CharField(max_length=255, blank=True, null=True)
  floor = models.CharField(max_length=255, blank=True, null=True)
  business_name = models.CharField(max_length=255, blank=True, null=True)
  house_number = models.CharField(max_length=255, blank=True, null=True)
  import_file_number = models.BigIntegerField(blank=True, null=True)
  contributor = models.CharField(max_length=255)
  job_id = models.CharField(max_length=255, blank=True, null=True)
  latitude = models.FloatField(blank=True, null=True)
  longitude = models.FloatField(blank=True, null=True)
  start_date = models.DateTimeField(blank=True, null=True)
  branch_hours = models.CharField(max_length=255, blank=True, null=True)
  po_box = models.CharField(max_length=255, blank=True, null=True)
  province = models.CharField(max_length=255, blank=True, null=True)
  region = models.CharField(max_length=255, blank=True, null=True)
  remarks = models.CharField(max_length=255, blank=True, null=True)
  street = models.CharField(max_length=255, blank=True, null=True)
  tenant = models.CharField(max_length=255)
  updated = models.DateTimeField(blank=True, null=True)
  zip_code = models.CharField(max_length=255, blank=True, null=True)
  ranking = models.FloatField()
  branch_type = models.IntegerField(blank=True, null=True)
  branch_contact_text1 = models.CharField(max_length=255, blank=True, null=True)
  branch_contact_text2 = models.CharField(max_length=255, blank=True, null=True)
  phone_number = models.CharField(max_length=255, blank=True, null=True)
  email_address = models.CharField(max_length=255, blank=True, null=True)
  website = models.CharField(max_length=500, blank=True, null=True)
  branch_hours_osm = models.CharField(max_length=400, blank=True, null=True)
  partner_short_name = models.ForeignKey('Partner', models.DO_NOTHING, db_column='partner_short_name')
  features = models.TextField(blank=True, null=True)  # This field type is a guess.
  marketing_attribute_short_names = models.TextField(blank=True, null=True)  # This field type is a guess.
  marketing_attribute_values = models.TextField(blank=True, null=True)  # This field type is a guess.
  
  class Meta:
      managed = False
      db_table = 'branch'
      unique_together = (('branch_short_name', 'partner_short_name', 'tenant', 'contributor'),)
  </code></pre>
  <p>serializers.py</p>
  <pre><code>class BranchSerializer(serializers.ModelSerializer):
      class Meta:
          model = Branch
          fields = '__all__'
  </code></pre>
  <p>views.py</p>
  <pre><code>@api_view(['GET', 'POST', 'DELETE'])
  def branch_list(request):
      # GET list of branchs, POST a new branch, DELETE all branchs
  
      if request.method == 'GET':
          branchlist = Branch.objects.all()[:10]
          branchlist_serializer = BranchSerializer(branchlist, many=True)
          return JsonResponse(branchlist_serializer.data, safe=False)
          # 'safe=False' for objects serialization
  
  
      elif request.method == 'POST':
          branch_data = JSONParser().parse(request)
          branch_serializer = BranchSerializer(data=branch_data)
          if branch_serializer.is_valid():
              branch_serializer.save()
              return JsonResponse(branch_serializer.data, status=status.HTTP_201_CREATED) 
          return JsonResponse(branch_serializer.errors, status=status.HTTP_400_BAD_REQUEST)
  </code></pre>
  <p>urls.py</p>
  <pre><code>urlpatterns = [
      url(r'^api/places$', views.branch_list),
      url(r'^api/placescount$', views.branch_count),
      url(r'^api/latestimport/(?P&lt;contributor&gt;\D+)$', views.latest_import),
      url(r'^api/partners$', views.partner_list),
      url(r'^api/partners/(?P&lt;partner_short_name&gt;[0-9]+)$', views.partner_detail),
      url(r'^api/places/(?P&lt;branch_short_name&gt;[0-9]+)$', views.branch_detail),
      url(r'^api/places/(?P&lt;branch_short_name&gt;[0-9]+)/(?P&lt;contributor&gt;\D+)$' , views.branch_from_contributor),
  ]
  </code></pre>
  <p><a href="https://i.stack.imgur.com/yFyk7.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/yFyk7.png" alt="1" /></a></p>