13 Sep, 17

Simple Command Line Shortcuts To Speed Up Your Workflow

These are basic command line commands, but it turns out not everyone knows about them and they're were handy: 

Use a combionation of

Ctrl + A: to move the cursor to the beginning of the line
Ctrl + E: to move the cursor to the end of the line
Ctrl + U ...

Read now
12 Sep, 17

Firing Vue.JS Events into Outer Space or How To Make My Legacy JS Code React on Vue JS Events

Sometimes (or even often) you'll want to emit your Vue app events outside of the scope of the app. For example, it may be useful when you want some legacy jQuery script to be notified about event happened in Vue app.

I found the following pattern to be the easiest solution: it's ...

Read now
09 Aug, 17

Make Django Rest Framework and Axios Work Together Nicely

This is a solution to the problem I encountered while marrying Django Rest Framework powered API and Axios JS HTTP client: Axios issues GET requests with multi-value parameters in a bit different way than Django expects.

When you create your API with Django Rest Framework, it expects multi-value GET parameters ...

Read now
28 Jun, 17

Generate Random Password Using Command-Line

This approach doesn't need any additional libraries to be installed (at least on Mac or Linux), you just open your terminal and type:

1
  1. openssl rand -base64 16 | colrm 17

And you'll get a 16 chars long random password generated by openssl.

Read now
21 Jun, 17

How To Exclude node_modules Directory When Running collectstatic Command in Django

If you use npm or yarn to install frontend packages inside your Django project, you may notice, that when you run python manage.py collectstatic command, it ends up collecting huge amounts of files.

That's because by default, collectstatic grabs all content of static directories inside the project, including thousands of ...

Read now
08 Jun, 17

How To Show Correct List Item Indexes When Using Pagination in Django

In your Django template put something like this:

1
2
3
4
5
  1. <ul>
  2. {% for object in object_list %}
  3. <li>{{ forloop.counter0|add:page_obj.start_index }}. {{ object }}</li>
  4. {% endfor %}
  5. </ul>

Where:

object_list - is a list of objects produced by pagination;

page_obj - is a page ...

Read now
07 Jun, 17

How To Get a List Of All User Permissions Available in Django Based Project

Django comes with a simple permissions system. It provides a way to assign permissions to specific users and groups of users. The system adds "change, remove and add" permissions automatically to every model class. And it's pretty easy to add custom permissions to a model class, like this:

 

  ...

Read now
23 May, 17

Getting path and accessing persistent volumes in Docker for Mac

If you use persistent data volumes in Docker, you might want to access them via command-line. If your docker host is Linux, that's not a problem; you can find Docker volumes by /var/lib/docker/volumes path.

However, that's not the case when you use Docker for Mac. Try to ...

Read now
23 Feb, 17

Make Your Developer's Life Easier By Reducing Number Of Opened Tabs in Pycharm

When coding, I often find myself overwhelmed by a number of opened tabs in my editor. I just seem to have opened every single .py file of a Django project. And it's kinda hard to find a way in this evergrowing of tabs.

Given that, I was really happy to ...

Read now
22 Feb, 17

New in Django 1.11: Template-based widget rendering

There's a very interesting change coming with Django 1.11 - Template-based widget rendering.

To make customizing widgets easier, form widget rendering is now done using the template system. In older versions, widgets were rendered using Python.

You can get more details about it from the form rendering API docs page ...

Read now