Viewing posts for the category Django
Posted by:
scoopseven
in
Django
12 years, 12 months ago
Differentiating how to display or access variables/structures/dictionaries in Django templates (as opposed to views) can get frustrating. All I was trying to do was print the query string in a template. That's. It. Why couldn't I just do:
read more
/
0 comments
Posted by:
scoopseven
in
Django
12 years, 12 months ago
You've passed in a tuple to your template and now you're trying to access the separate indexes/items in a loop. Here's the tuple:
read more
/
0 comments
I encountered a scenario where I have a list that I needed to pass over in a form, something like:
read more
/
0 comments
I know, this is an odd name for a post. I'm trying to explain this:
read more
/
0 comments
Dictionaries have no __order__ so when you're need to sort one, you're out of luck, right? Not so! Found
this goodness with instructions on sorting/ordering Python dictionaries by key or value. I needed to sort a dictionary of regions alphabetically to populate a ChoiceField/select/dropdown box.
read more
/
0 comments