Eduardo Zepeda's latests posts
Managers or custom handlers in Django
- django
A Manager (or handler) is the interface through which query operations or queries from the database are provided to Django models. Yes, I mean that objects that goes after the name of your model; YourModel.objects.all() and Tumodel.objects.filter(). All Django models have at leas...
Read more
Trigrams and advanced searches with Django and Postgres
- django
- databases
- django
What if a user's finger slips on the keyboard and types “parfume” instead of “perfume”. We probably don't want our user to leave the site because he didn't find any “parfume” on our website. Our website should return the resul...
Read more
Full text search and searches with Django and Postgres
- django
Sometimes when we type we make a mistake in a letter, we can repeat it, omit it or change it for another one. That mistake can lead to a series of different results in a web search, or even no results at all. Maybe for a blog it does not represent a threat, but for an ecommerce i...
Read more
Ngrok, your localhost accessible from the internet
- linux and devops
I ran into Ngrok trying to redirect a Mercado Pago payment notification to my localhost, for testing purposes. It worked more or less like this: Mercado Pago gave you a url address to redirect the buyer to make the payment. Once the payment was finished, Mercado Pago would make a...
Read more
How do permissions and its groups work in Django?
- django
When I first learned that Django had a permissions system, many years ago, it seemed rather esoteric, not very useful and easy to replicate, how wrong I was back then. Then I realized that the built-in permissions system was a marvel and saved a lot of code, and was quite robust ...
Read more
Don't make this mistake using arrays in Python
- python
The other day I was solving a kata in codewars , one of the steps of the problem needed a two-dimensional array, in more mundane words: an array of arrays. In Python it is super simple to create a two-dimensional array using the multiplication operator, as if it were numbers.
...
Read more
How to upload multiple images in Django
- django
You probably already know how to upload an image using a Django model, but what if we don't want to upload one but multiple images?Django installation First we install Django using pipenv. We will also install Pillow since we will be dealing with images.pip instal...
Read more
Why should you use Django Framework?
- django
- opinions
Why to use Python Framework like Django in a world where everything is Javascript? Is it really worth learning such framework in an ecosystem that insists on Frameworks written in Javascript? Well, I think so, and here are some of the reasons why you should use Django. And, in or...
Read more
Throttling on Nginx
- software architecture
- linux and devops
Ngnix throttling allows us to limit the number of requests to a certain user. This is useful to prevent excessive requests from a user from keeping the system busy. On the other hand, it is also a way to deter brute force password attempts or even DDOS attacks.If you are loo...
Read more
How to make a switch in Python?
- python
Python 3.10 was announced and it comes with something that many developers were missing from other languages: the switch statement. Yes, that piece of code that evaluates an expression and compares it with multiple cases to decide what to execute. Python did not have it implement...
Read more