views:

34

answers:

1

I have declared my model classes as found in this link....I now want to customize how my add/edit ModelForm for a Vehicle object is rendered in that I want the year, make, model, and manufacturer fields to be rendered separately as opposed to referring to the one common_vehicle field from the Vehicle class. How can this be done?

+2  A: 

Why don't you make Vehicle inherit CommonVehicle? (Depending on why you've got that FK there, of course -- you may really need it, but I'm guessing not)

Instead of:

class Vehicle(models.Model):
    ...
    common_vehicle = models.ForeignKey(CommonVehicle)

Use:

class Vehicle(CommonVehicle):
    ...all your other Vehicle fields here, but not the FK to CommonVehicle
stevejalim