DEV Community

Discussion on: How can I make a list of group data by month-year in rest Framework with json output?

Collapse
 
lord007tn profile image
Raed Bahri

okay the id is a field that django auto add in your model as a primary key you can made you custom primary key look in the documentation.

ah so you need to delete the datetime.now and just return the date forma from you model it should look like this

return instance.date.strftime("%m/%d/%Y")

change the date variable by you varibale name