0

I want pass much models in ListView.

In fact, I want pass User model and Food model...

my LIST VIEW

class home(ListView):
    model=User 
    template_name="site/home.html"
    context_object_name="myusers"                               
    paginate_by = 5

my DETAIL VIEW

class boardUser(DetailView):
    model = User
    context_object_name = "user"
    template_name = "site/boarduser.html"

my URL

url(r'^home$', home.as_view(), name="home"),    
url(r'^boarduser/(?P<pk>\d+)',boardUser.as_view(), name="board-user"),

my TEMPLATE

{% for user in les_utilisateurs %}    
    <a href="{% url 'board-user' user.id %}"> {{ user.username }} </a>    
{% endfor %}

But I just pass User model, I don't pass Food model...

4

0

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.