[Python] Vehicle records for auto parts application

Discussão em 'Python' iniciado por Stack, Maio 19, 2025.

  1. Stack

    Stack Membro Participativo

    I'm trying to figure out how to create a vehicle filter for an auto parts application for a client. They want their customers to be able to filter by Year, Make, Model, Trim and Engine.

    We're using DRF so our thoughts were:

    Create a Django vehicles app with Year, Make, Model, Trim and Engine model classes, that each contain an _id field and the respective fields.

    Create records that consists of an _id per Year, Make, Model, Trim and Engine. Then use those records to create a filter that the customers can use to select their vehicle.

    So for example:

    in vehicles app:

    # models.py

    class Year(models.Model):
    year_id = models.UUIDField(...)
    year = models.SmallIntergerField(...)

    class Make(models.Model):
    make_id = models.UUIDField(...)
    make = models.CharField(max_length=75)

    ...


    use django-filter to create a filter that use all the above class Models to filter down the customer's vehicle.

    Are we on the right track, is our mental model correct?

    Continue reading...

Compartilhe esta Página