Загрузка excel в django и отображение на 4 разных веб-страницах

Я хочу загрузить файл excel, содержащий 4 столбца, и отобразить каждый столбец на отдельной странице.

views.py

def upload(request):
    if "GET" == request.method:
        return render(request, 'myapp/upload.html', {})
    else:   
        excel_file = 'WBSdetails.xlsx'
        pd.read_excel(excel_file, sheet_name = 'ItemDetails')
        return render(request, 'myapp/structuremaster.html')

def structure(request):
    structures=ConVehicleMaster.objects.all()
    context={
        'structures':structures
    }
    return render(request, 'myapp/structuremaster.html', context)

models.py

class Excel(models.Model):
    structure = models.CharField(("Structure"), max_length=150)
    segment = models.CharField(("Segment"), max_length=150)
    subsegment = models.CharField(("SubSegment"), max_length=150)
    element = models.CharField(("Element"), max_length=150)

structuremaster.html

<tbody>
  {% for row in WBSdetails %}
     {% for cell in row %}
         <tr>
           <td>{{ cell.structure }}</td>                          
         </tr>
     {% endfor %}
  {% endfor %}
</tbody>

Я новичок в django и имею очень слабое представление. Любая помощь будет оценена по достоинству.

Вернуться на верх