This is django's question! ^^

Asked 2 years ago, Updated 2 years ago, 39 views

I want to make the data of the long-range model have each page in the template.

For example,

If there is a Korean movie model released in 2015 as below (data is crawled and stored)

class Movielist(models.Model):
    movie_title = models.CharField(max_length=100)
    .... The rest of the fields...

I'd like to create an individual page of movies stored in the above field

What method should I use?

There are simple ways If you know that much, please ^

^

django python

2022-09-21 18:40

1 Answers

If you type the title of the movie in url, you can create a function to show the information of the movie.

Accept the title of the movie by doing url patterns as below

urlpatterns = [
    # ...
    url(r'^movies/(?P<movie>.+)/$', views.movies)
    #...
]

From views.py

defareas(request, movie): #Receive the request as a parameter for which movie.
    # Bring the movie to the title and draw it on a proper template.

How about this? Please refer to the lecture below.


2022-09-21 18:40

If you have any answers or tips


© 2024 OneMinuteCode. All rights reserved.