MicroPyramidBlog

Explore a blog dedicated to a wide spectrum of topics including Django, Python, Machine Learning, Salesforce, Angular, React, Flutter, Svelte, LINUX, and Amazon Web Services.

Querying with Django Q Objects

Querying with Django Q objects: Q object encapsulates a SQL expression in a Python object that can be used in database-related operations. Using Q objects we can make complex queries with less and simple code.

Django - Migrating from Function Based Views to Class Based Views

The single most significant advantage in Django class-based views is inheritance. On a large project it's likely that we will have lots of similar views. instead of writing the repeated code we can simply have our views inherit from a base view.

Understanding Checkout Flow in Django Oscar

Explaining Django Oscar checkout flow.

Integration of Linkedin API in Python Django

Using Linkedin integration, we can get the user's verified email id, general information, and work history in less span of time, and a user can also share articles.

These Following steps are needed for Linkedin integration:
1. Creating a LinkedIn app
2. Authenticating the user and getting an access token
3. Get user information, and work history using the access token

How to Create Initial Django Migrations for Existing DB Schema

Django provides the comfort database migrations from its version 1.8, with which we can avoid the usage of third party packages like south. Adding migrations to new apps is straightforward - they come preconfigured to accept migrations, and so just run make migrations once you’ve made some changes. But if your app already has models and database tables, and doesn’t have migrations yet or you got your migrations messed up, you’ll need to convert your app to use migrations.

Django Conditional Expressions in Queries

Reduce database queries in django with Conditional Expressions. By using Conditional Expressions we can use "If...Elif...Else" expressions while querying the database so that we can reduce the number of queries to the database and increase the response time. If we don't use conditional expressions in queries we have to write raw SQL queries or we have to hit/query the database for multiple times. That's the reason Django included Conditional Expressions from version 1.8

Sorl-Thumbnail to Generate Thumbnails in Django

Displaying and Customizing the images in django with sorl-thumbnail.

Using Gitlab API, Integrating Gitlab in Django Project for Authentication and Access

This is a simple way to integrate gitlab authentication in your django apps.

We can get user verified email id, general information, git lab URL and token from Gitlab API.

These Following steps are needed for Gitlab integration:

1. creating git lab app
2. Authenticating user and getting an access token.
3. Get user information, git lab URL using an access token.

Deploying Your Django App on Heroku

Heroku is a platform as a service (PaaS) that enables developers to build and run applications entirely in the cloud.
1. installation
2. Creating and Deploying app.
3. Dependencies Used

How to Create Thumbnail Image in Django Templates Using Sorl-Thumbnail?

Sorl thumbnail is the package that is being widely used to generate thumbnails in Django. It will create a thumbnail of a given size for the given image, which won't work out in the case of responsive designs. Html5's 'srcset' attribute is the solution for this problem to load proper images to the corresponding resolutions, whose thumbnails are generated with sorl thumbnail.