Eduardo Zepeda's latests posts
Full text search and searches with Django and Postgres
- django
- databases
<p>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 ecommerc...
Read more
How do permissions and its groups work in Django?
- django
<p>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 robu...
Read more
Don't make this mistake using arrays in Python
- python
<p>The other day I was solving a kata in <a class="markdown-link" href="http://www.codewars.com/r/qsX8Ww" rel="noopener nofollow" target="_blank">codewars</a>, one of the steps of the problem needed a two-dimensional array, in more mundane words: an array of arrays...
Read more
How to upload multiple images in Django
- django
<p>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 in Django Framework?</p><h2 id="django-installation">Django installation</h2><p>First we install Django using pipenv. We will also...
Read more
Why should you use Django Framework?
- django
- opinion
<p>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...
Read more
Throttling on Nginx
- software architecture
- linux
<div class="google-ads-container-8672022193"> <ins class="adsbygoogle" style="display:block; text-align:center;" data-ad-layout="in-article" data-ad-format="fluid" data-ad-client="ca-pub-4250730649804995" data-ad-slot="86720...
Read more
How to make a switch in Python?
- python
<p>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 implem...
Read more
5 cool React libraries you should know about
- react
<p>After several weeks posting about Django I wrote a short post about React, about libraries, because man does not live by Python alone. These are some of the libraries that I consider most useful in React. For obvious reasons are excluded React-router, Redux and others too well...
Read more
What is Django Generic Foreignkey for?
- django
- databases
<p>You want to use Django to relate one model to another using a foreign key, but the model you want to relate is a different one for each database entry. Django offers a solution to your problem, a Django generic foreign key called genericForeignKey and the ContentType model, wh...
Read more
What does the ContentType application do in Django?
- django
- databases
<p>Did you know that Django keeps track of each of the models you create for your project in a model called <em>ContentType</em>? Read on to learn about it.</p><p>Sorry for taking so long to write! I've been busy moving the frontend of my blog to Frontity, a React fram...
Read more
If you have not yet decided to use Django and are investigating its features check out my post on the advantages and disadvantages of the Django web development framework .
","datePublished":"Sat, 17 Apr 2021 00:00:00 +0000","dateModified":"Sat, 17 Apr 2021 00:00:00 +0000","author":{"@type":"Person","name":"Eduardo Zepeda"},"mainEntityOfPage":{"@type":"WebPage","@id":"https://coffeebytes.dev/en/django/how-do-permissions-and-its-groups-work-in-django/"}},{"@type":"BlogPosting","headline":"Don't make this mistake using arrays in Python","description":"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.
arr = [0]*5
#[0, 0, 0, 0, 0]
If you have no idea what I’m talking about, I have an excellent resource that can help you a lot: “Inmersion en Python”, totally free and in Spanish
","datePublished":"Wed, 07 Apr 2021 00:00:00 +0000","dateModified":"Wed, 07 Apr 2021 00:00:00 +0000","author":{"@type":"Person","name":"Eduardo Zepeda"},"mainEntityOfPage":{"@type":"WebPage","@id":"https://coffeebytes.dev/en/python/dont-make-this-mistake-using-arrays-in-python/"}},{"@type":"BlogPosting","headline":"How to upload multiple images in Django","description":"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 in Django Framework?
Django installation
First we install Django using pipenv. We will also install Pillow since we will be dealing with images.
pip install django Pillow
Next we will create a new project and enter the newly created folder.
","datePublished":"Tue, 30 Mar 2021 00:00:00 +0000","dateModified":"Tue, 30 Mar 2021 00:00:00 +0000","author":{"@type":"Person","name":"Eduardo Zepeda"},"mainEntityOfPage":{"@type":"WebPage","@id":"https://coffeebytes.dev/en/django/how-to-upload-multiple-images-in-django/"}},{"@type":"BlogPosting","headline":"Why should you use Django Framework?","description":"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 order not to lose objectivity, I will talk about the advantages as well as the disadvantages; you know that no solution is perfect.
","datePublished":"Wed, 24 Mar 2021 00:00:00 +0000","dateModified":"Wed, 24 Mar 2021 00:00:00 +0000","author":{"@type":"Person","name":"Eduardo Zepeda"},"mainEntityOfPage":{"@type":"WebPage","@id":"https://coffeebytes.dev/en/django/why-should-you-use-django-framework/"}},{"@type":"BlogPosting","headline":"Throttling on Nginx","description":"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 looking to optimize the performance of an application using Nginx I have a post where I give you some recommendations to improve nginx performance
","datePublished":"Sat, 13 Mar 2021 00:00:00 +0000","dateModified":"Sat, 13 Mar 2021 00:00:00 +0000","author":{"@type":"Person","name":"Eduardo Zepeda"},"mainEntityOfPage":{"@type":"WebPage","@id":"https://coffeebytes.dev/en/software-architecture/throttling-on-nginx/"}},{"@type":"BlogPosting","headline":"How to make a switch in Python?","description":"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 implemented and many developers resorted to certain tricks to imitate it.
I remind you that if you don’t know anything about Python I have a post where I talk about the book “Inmersion en Python” ; one of the best free books to learn Python from scratch.
","datePublished":"Sat, 06 Mar 2021 00:00:00 +0000","dateModified":"Sat, 06 Mar 2021 00:00:00 +0000","author":{"@type":"Person","name":"Eduardo Zepeda"},"mainEntityOfPage":{"@type":"WebPage","@id":"https://coffeebytes.dev/en/python/how-to-make-a-switch-in-python/"}},{"@type":"BlogPosting","headline":"5 cool React libraries you should know about","description":"After several weeks posting about Django I wrote a short post about React, about libraries, because man does not live by Python alone. These are some of the libraries that I consider most useful in React. For obvious reasons are excluded React-router, Redux and others too well known. As well as some React Frameworks such as Gatsby, Nextjs, Frontity and others.
If you want to learn React but don’t know Javascript read my post, where I talk about one of the best books to start with Javascript .
","datePublished":"Tue, 02 Mar 2021 00:00:00 +0000","dateModified":"Tue, 02 Mar 2021 00:00:00 +0000","author":{"@type":"Person","name":"Eduardo Zepeda"},"mainEntityOfPage":{"@type":"WebPage","@id":"https://coffeebytes.dev/en/react/5-cool-react-libraries-you-should-know-about/"}},{"@type":"BlogPosting","headline":"What is Django Generic Foreignkey for?","description":"You want to use Django to relate one model to another using a foreign key, but the model you want to relate is a different one for each database entry. Django offers a solution to your problem, a Django generic foreign key called genericForeignKey and the ContentType model, which I talked about earlier.
The genericForeignkey field type is able to link to different types of models, allowing us to relate any other model to ours. Remember in the previous post I talked about ContentType? Well, now we will give it a practical application. If you want to review the previous post, visit my post where I talk about ContentType in Django
","datePublished":"Mon, 22 Feb 2021 00:00:00 +0000","dateModified":"Mon, 22 Feb 2021 00:00:00 +0000","author":{"@type":"Person","name":"Eduardo Zepeda"},"mainEntityOfPage":{"@type":"WebPage","@id":"https://coffeebytes.dev/en/django/what-is-django-generic-foreignkey-for/"}},{"@type":"BlogPosting","headline":"What does the ContentType application do in Django?","description":"Did you know that Django keeps track of each of the models you create for your project in a model called ContentType? Read on to learn about it.
Sorry for taking so long to write! I’ve been busy moving the frontend of my blog to Frontity, a React framework for Wordpress, and also moving to a new apartment. Maybe I’ll talk a bit about Frontity in a future post. For now let’s get on with it.
","datePublished":"Tue, 16 Feb 2021 00:00:00 +0000","dateModified":"Tue, 16 Feb 2021 00:00:00 +0000","author":{"@type":"Person","name":"Eduardo Zepeda"},"mainEntityOfPage":{"@type":"WebPage","@id":"https://coffeebytes.dev/en/django/what-does-the-contenttype-application-do-in-django/"}}]}