Other methods on class based views in Django

Viewed 118

I currently have a class based view with get(), post() and delete() methods for the following URL: /property/<str:property_uuid> This works fine and is great.

However, I now want URLs such as /property/<str:property_uuid>/publish and /property/<str:property_uuid>/publish to make my API easier to use. These will be GET methods.

I was hoping to have corresponding publish() and unpublish() functions and put these within my class. However, I'm not sure how to do this or if this is even posible with class based views? Would I have to go back to function based views with all my functions defined in a "property.py" file for ease of reference and then include this in my urls.py file?

0 Answers
Related