• 复制链接
  • 分享至QQ
  • 分享至QQ空间
  • 分享至微博
  • 微信扫一扫

Backend

This circle is for technical discussion of backend programming.

Members
3

Ricciflows

Invalid Date

未来是不可知的,但又是确定的。我们只是在追逐一个未知而又确定的结果......

智力值

0

金币

0

粉丝

0

  • Home
  • Wiki
  • Circles
  • Shop
  • English
    Trading
  • Circle Home
  • Encyclopedia
  • Questions
  • Posts
  • Help Center
  • About Manitori
  • Issues
  • Privacy Policy
HomeQuestions

Questions in

Ask question

全部

内容 1|
RicciflowsRicciflows
|
10 months ago
|
Question

Django change an existing field to foreign key

I have a Django model that used to look like this:class Car(models.Model): manufacturer_id = models.IntegerField()There is another model called Manufacturer that the id field refers to. However, I realized that it would be useful to use Django's built-in foreign key functionality, so I changed the model to this:class Car(models.Model): manufacturer = models.ForeignKey(Manufacturer)This change appears to work fine immediately, queries work without errors, but when I try to run migrations, ...

python
django
django-migrations
python-3.x
358
1 answer
全部
Django

Django

分享

This circle is for Django programming. Django is a Python web framework.

Created at2024-08-09 22:13
Members0
Parent circle
BackendBackend
⭕

Founder

RicciflowsRicciflows

Master

RicciflowsRicciflows