I have created a Model as given bellow:
from __future__ import unicode_literals
from django.db import models
class TypesOfVehicle(models.Model):
type = models.CharField(max_length=50)
def __unicode__(self):
return self.type
class vehicleDetails (models.Model):
T = models.ForeignKey(TypesOfVehicle)
NoOfWhl = models.PositiveIntegerField()
year = models.CharField(max_length=4)
ModelName = models.CharField(max_length=254)
VID = models.CharField(max_length=254, verbose_name="VID")
To View the above data I have written down a view as follows:
from django.shortcuts import render
from .models import CountryDiseases, Country
def VData(request):
Count = vehicleDetails.objects.all()
return render(request, 'DATAPLO/MAP.html', {'Count': Count })
and to render the view of i have write down a simple template like this
MAP.html
{% for c in Count %}
{{c.NoOfWhl }} {{ c.year }} {{ c.ModelName }}<br/>
{% endfor %}
My Question is that I'm very novice for Django, After few unsuccessful attempts I am not able to write down a method which can render my data as given bellow.
How can I modified the view and template section so that it could return something like this
Sample Input data:
NoOfwhl year modelName VID Type
4 2014 xyz111 786 SUV
2 2012 445444 789 bk
4 2014 655656 676 car
3 2013 565656 459 tax
4 2010 565656 567 SUV
3 2019 345353 359 tax
3 2013 234224 789 tax
4 2014 L34535 345 SUV
3 2011 456464 789 tax
3 2012 456465 799 tax
4 2033 345353 09u car
2 2014 354354 454 scl
Now lets suppose if some one click on "SUV" it should return all the information associated with "SUV" as given bellow:
urls key as "SUV":
NoOfwhl year modelName VID
4 2014 xyz111 786
4 2010 565656 567
4 2014 L34535 345