Sorry if this was asked, but I searched everywhere and cannot find what would make it click in my brain.
If I had such a structure, is it possible to make the relations of the ForeignKey and ManyToMany fields searchable in admin . Therefore, when price information was to be entered, could the vehicle manufacturer, type and name be found instead of searching through thousands of vehicles from the drop-down list?
class Manufacturer(models.Model): manufacturer = models.CharField(max_length=100) class VehicleType(models.Model): vehicle_type = models.CharField(max_length=100) class VehicleInfo(models.Model): manufacturer = models.ForeignKey('Manufacturer') vehicle_type = models.ForeignKey('VehicleType') vehicle_name = models.CharField(max_length=200) class RandomWebsitePriceInfo(models.Model): vehicle_info = models.ManyToManyField('VehicleInfo') website_price = models.FloatField()
What I ideally would like to do is either follow the ratio down on the drop-down boxes, as in the place where I would select the manufacturer, and then in the vehicle type box there would be available vehicles from that manufacturer, and then in vehicle information field, be it all vehicles manufactured by this manufacturer and of that type.
Or just make the car information searchable, so if I put the car model, it will appear.
I looked at raw_input and the search fields, but didn't seem to understand it.
Thanks Brian
source share