bsassoli / milan_culture_map

An interactive website mapping cultural venues in Milan, Italy.
https://milan-culture-map.vercel.app
MIT License
0 stars 1 forks source link

Class Based Views #7

Open thmsrmbld opened 3 years ago

thmsrmbld commented 3 years ago

You've used function based views (which are fine, and will work!) but this makes your life more difficult than it needs to be. FBVs are good when you need lots of specific control / granular control - CBVs will allow you to just extend a Class and override its built in functions - Django has a lot of them and they will do a lot of work for you that you don't need to do.

I highly recommend using the stuff Django comes packaged with - it will save you a lot of time :)

Recommend:

Also v good:

Note - this will marginally change the way your URLs are declared, but not by much.

Again the way you have done this so far will work, but for future projects - worth investigating. :)

bsassoli commented 3 years ago

Yes, I now realise I should refactor or anyway in the future transition to CBV (I only discovered about them 2 days ago, so it was too late).