Notice: This page requires JavaScript to function properly.
Please enable JavaScript in your browser settings or update your browser.
学ぶ Overview of Models | Models
/
Django: Build Your First Website (copy) 1769168111164

bookOverview of Models

メニューを表示するにはスワイプしてください

Imagine your program needs to work with a database to store information. Django is a framework that makes this task easy. In Django, there's something called "models".

Models in Django help define what your information looks like and how it's stored in the database. The data types in models act like rules, telling Django how to handle different types of information.

For example, you might have a CharField, indicating you're storing short text like a username. Or a DateField to store a date.

This helps Django automatically create tables in the database and define what kinds of data can be stored. You don't have to manually write SQL queries to create tables or specify data storage rules. The data types in models are like your "rulebook," helping Django understand and efficiently use your database.

Here are some common data types in Django:

  • CharField: Used for short text strings;
  • TextField: Intended for larger text content;
  • IntegerField, FloatField: Used for numeric values;
  • DateField, DateTimeField: For storing dates and date-time values respectively;
  • BooleanField: For storing True/False values.

1. CharField - Used for numeric values

2. BooleanField - For storing True/False values

question mark

CharField - Used for numeric values

正しい答えを選んでください

question mark

BooleanField - For storing True/False values

正しい答えを選んでください

すべて明確でしたか?

どのように改善できますか?

フィードバックありがとうございます!

セクション 3.  2

AIに質問する

expand

AIに質問する

ChatGPT

何でも質問するか、提案された質問の1つを試してチャットを始めてください

セクション 3.  2
some-alt