Exemplo n.º 1
0
    def create(self, request):
        
        attrs = self.flatten_dict(request.POST)

        if self.exists(**attrs):
            return rc.DUPLICATE_ENTRY
        else:
            prod = Product(name=attrs['name'], value=attrs['price']) 
            prod.product_spec = ProductSpec.objects.filter(product_spec_id=attrs['product_spec_id'])
            prod.save()
            
            return prod