From the course: Securing Django Applications

Unlock the full course today

Join today to access over 22,600 courses taught by industry experts or purchase this course individually.

Packaging user data for download

Packaging user data for download - Django Tutorial

From the course: Securing Django Applications

Start my 1-month free trial

Packaging user data for download

- [Instructor] Data privacy regulations such as GDPR in the European Union and CCPA in the State of California make it more important than ever to give users a way to download all of the data that they have put into your web app. So we're going to give them the ability to download a csv file. So let's start by writing a unit test. So we're going to make a request to get the csv file for this particular user. And of course, the response status code should be a 200 and we're going to get the content from the response. And we want to make sure the csv file has a particular format. The first line will be data for user at local host. The second line will have a section heading comments. There are no comments made by the user, but there are bookings. So in this section we print out all the field names and then the data related to that user action. And this is a custom date format and then the booking name. Now there's another section…

Contents