Read the guideline before starting.
- Download ModHeader
- Use the following command to load prepared data from fixture to test and debug your code:
python manage.py loaddata cinema_service_db_data.json
. - After loading data from fixture you can use following superuser (or create another one by yourself):
- Login:
admin.user
- Password:
1qazcde3
- Login:
- Add ImageField
image
to theMovie
model.- Upload images should be only available with
/upload-image/
endpoint. - Image format of saving must be next:
f"{slugify(movie.title)}-{uuid}{ext}"
- Image field should not be available on POST
api/cinema/movies/
. - Image url should be shown on:
- Movie:
list
anddetail
pages - Movie session: on
list
page withmovie_image
key; ondetail
page insidemovie
->image
.
- Movie:
- Upload images should be only available with
Movie list example:
GET http://127.0.0.1:8000/api/cinema/movies/
[
{
"id": 1,
...
"image": "http://127.0.0.1:8000/media/uploads/movies/liar-93733032-c097-4a38-9b2b-20404e7186e6.jpeg",
...
}
]
Movie session list example:
GET http://127.0.0.1:8000/api/cinema/movie_sessions/
[
{
"id": 1,
...
"movie_image": "http://127.0.0.1:8000/media/uploads/movies/liar-93733032-c097-4a38-9b2b-20404e7186e6.jpeg",
...
}
]
- Replace username field with email field in User model.
- Write custom AuthTokenSerializer, so you can obtain token with email and password