django - Count Records in Listing View -


I have these two models:

  class CommonVehicle (models.Model): year = Model Forward Cay (Year) Series = Model Forging (series) engine = model. Forging (engine) body_style = model Forgiveness (body model): objects = VHECK MANAGER () Stock_net = Model CharField (max_length = 6, empty = false) vin = models.CharField (max_length = 17, empty = false) common_vehicle = Model Phoenis (Commonwealth) ....  

What do I need to do to calculate the number of times in the vehicle class CommonVehicle Does it? So far my attempt is giving me a number, which is the total of all records, how do I look at the total appearances for each CommonVehicle

Update 1 I can count in: I was thinking something like this:

 related_count = 0 for vehicles in vehicles: related_ count + = vehicle Offfitter (normal_wheel = vehicle) .count ()  

somecommonvehicle.vehicle_set. Count ()

Comments

Popular posts from this blog

windows - Heroku throws SQLITE3 Read only exception -

lex - Building a lexical Analyzer in Java -

python - rename keys in a dictionary -