Month: March 2021

Python Dictionaries – All You Need To Know

Hello geeks, in this python 3 tutorial, you are going to learn A to Z of Python dictionary. We will discuss the followings:

  • What is Python Dictionary?
  • How to create a Dictionary!
  • Add, Delete, Update Elements.
  • Access Elements of a Dictionary.
  • Merging Two Dictionaries
  • Creating Nested Dictionary
  • Adding, Deleting, Updating elements in a Nested Dictionary.
  • Different Methods of Python Dictionary.
  • copy(), fromkeys(), get(), pop(), popitem(), items(), keys(), values()

So, without further ado let’s jump into it.

What is Python Dictionary?

Python dictionary is a data type of python programming language. It stores data by mapping them with a key. Data are stored in “Key-Value” pairs where each “Key” must be unique. Lists, Tuples can also be stored as value in a dictionary.

Read More

Django Queries | Fetch Data From Database | Python Django Tutorial

Hey geek, You have come a long way with us. Till now we were working with django models. We learned how to create models and how to create objects from admin panel. We will discuss how to Create, Update & Delete objects from frontend later. Now we will see how to fetch & filter data from the database.

There are several ways of retrieving data from database. We will execute the following methods:

  • All objects
  • Only One Object
  • A Set of Specific Objects
  • Ordering Objects

Read More

How To Start A Django Project | Python Django Tutorial

Hello Devs, Welcome to the ocean of Web Development with Django. In this blog, we have discussed all the information that you need to know before you start surfing on this ocean. Mainly, we will cover the following topics:

  • What Is Django?
  • Working Architecture of  Django.
  • What is PIP?
  • What is Virtual Environment
  • Creating, Activating & Deactivating Virtual Environment
  • Starting Django project
  • Creating an App
  • Making Migrations
  • Creating a SuperUser
  • The Development Server

What is Django?

Django is an open-source and high-level web application framework written in Python. Django is specially designed by developers with a view to rapid and clean development. A web framework is a package of components that helps developers to develop websites faster and easier without handling low-level details. The framework is named after Django Reinhard, a gypsy jazz guitarist. He was one of the best guitarists of all time.

Read More

Django Class-Based Views | Django Generic Views

Class-based views are basically some pre-defined views that are bundled with django. These are reusable. Django developers felt that they have to write some common views for almost each application. So, they decided to create reusable views which results in Class-Based views. Class-based views (CBV) were introduced in Django 1.7.The reason behind this addition was that using inheritance it would be more customizable than a function-based view.

Read More

Django Models, Python Django Tutorial

We have discussed how to create a Django project and Django app in our first Django tutorial. In this tutorial, we will talk about Django models. We will cover the following topics:

  • Creating a model.
  • Registering Model in django admin site.
  • 'Class Meta' in django models.
  • Creating Objects of Models
  • __str__ Method of django models.
  • get_absolute_url() method of django models.
  • @property in django model.
  • Django Model Fields

Model is a structure for storing data. The model handles everything related to data. Such as: data access, data validation, dealing with data of other models, etc.  It mirrors the fields and behaviors of the data. Generally a model is implemented as a python class which is a subclass of django.db.models.Model. Django gives an automatically-generated database-access API to create a table in our database by each model, and the "attributes" of the table are created by the "fields" of the model class. Models are defined inside an app’s ‘models.py’ file. 

Read More

Page 2 of 2

Powered by WordPress & Theme by Anders Norén