| web | https://thebiglog.com/ |
|---|---|
| Author |
April 8, 2019 » The Big Log » [Archived Version]
When I first started dabbling with Django and web-development, a good friend with a little more experience advised that I should keep logic away from my templates. "Templates should be dumb". I didn't really understand what that meant until I started suffering the consequences of having logic in my .html files. After 3 years with Django, I now try to keep business-logic away not only from templates, but also from views. In this post I'll gradually go over from the least to the most recommended …
Read MoreApril 8, 2019 » The Big Log » [Archived Version]
When I first started dabbling with Django and web-development, a good friend with a little more experience advised that I should keep logic away from my templates. “Templates should be dumb”. I didn’t really understand what that meant until I started suffering the consequences of having logic in my .html files. After 3 years with Django, I now try to keep business-logic away not only from templates, but also from views. In this post I’ll gradually go over from the least to the most recommended …
Read MoreSept. 9, 2018 » The Big Log » [Archived Version]
Something I learned today which should come handy. The include tag allows rendering a partial template from another: {% include 'foo/bar.html' %} So I was doing this to pass context to the included partial: {% with obj=release %} {% include 'releases_widget.html' %} {% endwith %} And this why it's good to read the docs, because apparently this can be done much better like so: {% include 'releases_widget.html' with obj=release %}
Read MoreSept. 9, 2018 » The Big Log » [Archived Version]
Something I learned today which should come handy. The include tag allows rendering a partial template from another: {% include 'foo/bar.html' %} So I was doing this to pass context to the included partial: {% with obj=release %} {% include 'releases_widget.html' %} {% endwith %} And this why it’s good to read the docs, because apparently this can be done much better like so: {% include 'releases_widget.html' with obj=release %}
Read MoreSept. 5, 2018 » The Big Log » [Archived Version]
I've recently had to download my Django app's database for local inspection. Heroku lets you do that pretty easily with: $ heroku pg:backups:download This gets you a .dump file. Now it's time to create a database clone out of it. Here's the gist. We first create a new database: $ sudo -u USERNAME createdb NEW_DATABASE_NAME Note that USERNAME and NEW_DATABASE_NAME should be replaced with the respective values. The next step to is to restore the downloaded .dump to the database we just created:…
Read MoreSept. 5, 2018 » The Big Log » [Archived Version]
I’ve recently had to download my Django app’s database for local inspection. Heroku lets you do that pretty easily with: $ heroku pg:backups:download This gets you a .dump file. Now it’s time to create a database clone out of it. Here’s the gist. We first create a new database: $ sudo -u USERNAME createdb NEW_DATABASE_NAME Note that USERNAME and NEW_DATABASE_NAME should be replaced with the respective values. The next step to is to restore the downloaded .dump to the database we just created: $…
Read More