Notice: This page requires JavaScript to function properly.
Please enable JavaScript in your browser settings or update your browser.
Aprenda Challenge: Zoo Market Table | Models
Django: First Dive

book
Challenge: Zoo Market Table

Note

  • The existing fields you can see in the Django documentation .

  • The presented code for the task is part of the framework and cannot work separately, so errors will be received when you try to Run Code . Use the Submit Task button to solve this task.

Tarefa

Swipe to start coding

Create the following Animal table in the database using the Django ORM:

ER model of this table:

Ignore the records in the table. You only need to make the table structure.

Solução

from django.db import models


class Animal(models.Model):
name = models.CharField(max_length=40)
kind = models.CharField(max_length=20)
age = models.IntegerField()
price = models.FloatField()

Tudo estava claro?

Como podemos melhorá-lo?

Obrigado pelo seu feedback!

Seção 3. Capítulo 3
from django.db import models


class ___(models.___):
___ = models.___(max_length=___)
___ = ___.CharField(___=20)
___ = models.___()
___ = models.___()

Pergunte à IA

expand
ChatGPT

Pergunte o que quiser ou experimente uma das perguntas sugeridas para iniciar nosso bate-papo

some-alt