updates api query function and model to add primary slug based on instance attributes