justdjango / getting-started-with-django

A beginners course for Django
MIT License
352 stars 249 forks source link

Updating the lead count for each category #12

Open bassamalasadi opened 3 years ago

bassamalasadi commented 3 years ago

Now all the lead count in category list are updated properly. I'm not sure if it's the best practice, since I didn't save the update number on the database.

Adding Number field to the category model.

Passing the data that we extracted from the "Leads: Views" to the "Category_list" template.

The "leads/views.py" is able to obtain the number of leads that belong to a specific category and pushing through the "context" to the "category_list" template.