Django – How to Make Queries and Retrieve Objects – Part 2

django related_name

Field Lookups Field Lookups are where you actually specify the “where” clause of your SQL query.

Here I have used the __lte lookup to find the books that were published in and before 2010.

Here I have used

Read More Django – How to Make Queries and Retrieve Objects – Part 2

Django – How to Make Queries and Retrieve Objects – Part 1

django related_name

Django provides you with a database abstraction layer (or an API) that lets you perform CRUD operations without writing a single line of SQL. In this post I will talk about how we can retrieve objects using this API. We

Read More Django – How to Make Queries and Retrieve Objects – Part 1

How to – Install a Django Package Inside a Virtual Environment

django-install-package-virtual-env

You have created your Virtual Environment and PyCharm automatically associated it with you default project. Now you want to install packages into this Virtual Environment. Here is how you can do it. First of all, activate your Virtual Environment. To do

Read More How to – Install a Django Package Inside a Virtual Environment

Django – How to Clear All Migrations and Re-migrate

django-clear-migrations

During your website development with Django, you will find yourself changing your models and migrating these changes to your database. Sometimes this will happen too often and you will encounter problems creating/applying your migrations. On some occasions you will feel

Read More Django – How to Clear All Migrations and Re-migrate

How to Determine Which Model Fields to Show in Django Admin Site

python-django

By default, when you open the Django admin site and click a model’s link under your application section (assuming you have created an application and added your models in that application) a page listing the instances of that model will

Read More How to Determine Which Model Fields to Show in Django Admin Site

Django – How to Render Template Variables as HTML

django-template-html-variable

Apparently Django escapes the template variables by default. If you want to query you database, construct an HTML string, assign it to a variable and feed it to your template, your template will render the HTML tags in this string as

Read More Django – How to Render Template Variables as HTML

Creating Superuser for Django Adminsite – PyCharm

django-superuser

When you navigate to Django admin site for the first time, you will see a login screen as below: If you are new to this, you are probably wondering “What is this username, password and where can I find them?”. You

Read More Creating Superuser for Django Adminsite – PyCharm

How to Check the Django Version of PyCharm

django

I have been playing around with Django and Python lately, because I am planning to develop my next project with Django framework. Anyways, I was trying to find out the Django version that my PyCharm installation used (the Django version that

Read More How to Check the Django Version of PyCharm

How to Create a Django Project With PyCharm

Note: This brief post is for PyCharm version 2016.1.4. Creating a new Django project with PyCharm is very easy. Follow the simple steps below to create a Django project with PyCharm. Launch PyCharm. You will see the welcome screen below:

Read More How to Create a Django Project With PyCharm