Can't pass a variable through my view to the html template Ask Question. Asked 3 days ago. Active 3 days ago. Viewed 17 times. I can't understand why its not working. PD: I probably lack the basic understanding how django starts to process all this. Improve this question. Nytswa Nytswa 13 4 4 bronze badges. New contributor. Add a comment. Active Oldest Votes.
Improve this answer. Willem Van Onsem Willem Van Onsem k 28 28 gold badges silver badges bronze badges. That was it Add a comment.
Active Oldest Votes. Post So you would submit a form with value. You can retrieve your code in your views. Session via cookie Downside of using session is you would have had to pass it to the view or set it earlier. Improve this answer. Thank you Jester. I think I will go with option 1. I was using urls previously and it worked well but I don't want users to manipulate the url to see other user's pages and linked accounts.
I tried to experiment with the permission required decorator but I think my skills are too beginner for that still. Can you expand a bit more on the 2nd method? More specifically, how can I set query parameters if the '?
The 2nd method is passing a variable through the url paramater. For example if you did. In this case request. Good answer. Although I wish you would have been more specific with method 1. I'm looking for elsewhere for instructions on using method 1 but haven't figured it out. View : This variable can be directly accessed in the view as the fbuser command argument def fbpages request, fbuser Abhishek Poojary Abhishek Poojary 7 7 silver badges 8 8 bronze badges.
We also use like this: from django. Rajan Singh Rajan Singh 1. The error is likely some configuration or a small typing mistake resulting in the application not working as expected.
The way I approach debugging is to take every assumption, starting with those that are most likely to result in the error and then validate that assumption. I also just installed the debug toolbar… Never used it before, but it seems pretty nifty. The arguments and keyword argument columns are the args and kwargs passed to the view function.
Since index only takes request , that would match. This implies that the request is being routed to another view rather than the one you expect. The issue is likely with your urls. I have two urls. Perhaps that might be it, or part of it? If I remove that line, the views are no longer displayed.
0コメント