In your Django website you have models. These models represent tables in your database. So, what would you do if you wanted to record new model data into your DB? How would you get user input? Of course, using forms.
As you already know when a request comes to your Django site, it first looks for the url patterns of your site and once a patter is matched related view function is called passing some arguments to that function. But
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