I'm generating a CSV file from a database but I want to unify some records in only one row.
The original CSV look like this:
| Model | Name | Configurations_variatons | 
|---|---|---|
| MODEL-1 | Lipstick Grand Rouge Mate | cod=23432, color=23432-150 | 
| MODEL-1 | Lipstick Grand Rouge Mate | cod=23770, color=23770-151 | 
And I want to show with only one row per model but unifying the Configurations_variatons column:
| Model | Name | Configurations_variatons | 
|---|---|---|
| MODEL-1 | Lipstick Grand Rouge Mate | cod=23432, color=23432-150 - cod=23770, color=23770-151 | 
The code to generate the cvs file:
def cvs_file_generator(request):
    # Get all data from UserDetail Databse Table
    products = Products.objects.all()
    # Create the HttpResponse object with the appropriate CSV header.
    response = HttpResponse(content_type='text/csv')
    response['Content-Disposition'] = 'attachment; filename="csv_database_write.csv"'
    writer = csv.writer(response)
    writer.writerow(['Model', 'Name', 'Configurations_variatons'])
    for product in products:
        writer.writerow([product.model, product.name, product.configurations_variatons])
    return response
 
     
    