I am building my first website with django 1.7, and itβs hard for me to figure out how to pass a variable from one click to a view. My get is also empty.
My template has a table with Facebook account IDs, when I click on it, a list of Facebook pages that are the Admins user should be displayed.
My template:
{% for SocialAccount in accountlist %} <tr> <td><a href="{% url 'INI:fbpages' %}">{{ SocialAccount.uid }}</a></td> <td>{{ SocialAccount.extra_data.first_name }}</td> <td>{{ SocialAccount.extra_data.last_name }}</td> <td>{{ SocialAccount.extra_data.email }}</td> </tr> {% endfor %}
and my opinion:
def fbpages(request, fbuser): djuser = request.user.id context = RequestContext(request) fbuser = 1234634 pagelist = facebook.pages(request, djuser, fbuser) blocks = {'title': 'Facebook Pages', 'pagelist': pagelist} return render(request, "initiative/ListFBPages.html", blocks)
I could make it easy if I put the id in the url, but I don't want to show the page / user id in the url. I feel that there is a simple solution, but I did not understand this.
Thanks for the help.
source share