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.
Book.objects.get(title__exact='guide to the galaxy')
Here I have used
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
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
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
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
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
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
One of the beauties of Django framework is that it comes with an admin site. It is great to have this implemented for you so that you don’t have to spend time on it yourself. Using this admin site you
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
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: