Please sorry am new to django, if u could further explain it to me. Thanks
On Jul 6, 2018 11:39 AM, "Anirudh choudhary" <anirudhchoudary...@gmail.com>
wrote:

> Add on_delete = models.CASCADE
>  EVERY WHERE YOU ARE USING FOREIGN KEY
>
> On Fri, 6 Jul 2018, 4:43 p.m. Umar Kambala, <umarkamb...@gmail.com> wrote:
>
>> please this the error i got when i run python manage.py makemigrations
>>
>>  File "C:\Users\Admin\AppData\Local\Programs\Python\Python36-32\
>> lib\site-packages\django\core\management\__init__.py", line 371, in
>> execute_from_command_line
>>     utility.execute()
>>   File "C:\Users\Admin\AppData\Local\Programs\Python\Python36-32\
>> lib\site-packages\django\core\management\__init__.py", line 347, in
>> execute
>>     django.setup()
>>   File "C:\Users\Admin\AppData\Local\Programs\Python\Python36-32\
>> lib\site-packages\django\__init__.py", line 24, in setup
>>     apps.populate(settings.INSTALLED_APPS)
>>   File "C:\Users\Admin\AppData\Local\Programs\Python\Python36-32\
>> lib\site-packages\django\apps\registry.py", line 112, in populate
>>     app_config.import_models()
>>   File "C:\Users\Admin\AppData\Local\Programs\Python\Python36-32\
>> lib\site-packages\django\apps\config.py", line 198, in import_models
>>     self.models_module = import_module(models_module_name)
>>   File 
>> "C:\Users\Admin\AppData\Local\Programs\Python\Python36-32\lib\importlib\__init__.py",
>> line 126, in import_module
>>     return _bootstrap._gcd_import(name[level:], package, level)
>>   File "<frozen importlib._bootstrap>", line 994, in _gcd_import
>>   File "<frozen importlib._bootstrap>", line 971, in _find_and_load
>>   File "<frozen importlib._bootstrap>", line 955, in
>> _find_and_load_unlocked
>>   File "<frozen importlib._bootstrap>", line 665, in _load_unlocked
>>   File "<frozen importlib._bootstrap_external>", line 678, in exec_module
>>   File "<frozen importlib._bootstrap>", line 219, in
>> _call_with_frames_removed
>>   File "C:\Users\Admin\Desktop\Django Web\myproject\boards\models.py",
>> line 10, in <module>
>>     class Topic (models.Model):
>>   File "C:\Users\Admin\Desktop\Django Web\myproject\boards\models.py",
>> line 13, in Topic
>>     board = models.ForeignKey(Board, related_name='topics')
>> TypeError: __init__() missing 1 required positional argument: 'on_delete'
>>
>>
>> this are the codes
>>
>> from django.db import models
>> from django.contrib.auth.models import User
>>
>>
>> class Board(models.Model):
>>     name = models.CharField(max_length=30, unique=True)
>>     description = models.CharField(max_length=100)
>>
>>
>> class Topic (models.Model):
>>     subject = models.CharField(max_length=255)
>>     last_updated = models.DateTimeField()
>>     board = models.ForeignKey(Board, related_name='topics')
>>     starter = models.ForeignKey(User, related_name='topics')
>>
>>
>> class Post(models.Model):
>>     message = models.TextField(max_length=4000)
>>     topic = models.ForeignKey(Topic, related_name='posts')
>>     created_at = models.DateTimeField(auto_now_add=True)
>>     updated_at = models.DateTimeField(null=True)
>>     created_by = models.ForeignKey(User, related_name='posts')
>>     updated_by = models.ForeignKey(User, null=True, related_name='+')
>>
>>
>> --
>> You received this message because you are subscribed to the Google Groups
>> "Django users" group.
>> To unsubscribe from this group and stop receiving emails from it, send an
>> email to django-users+unsubscr...@googlegroups.com.
>> To post to this group, send email to django-users@googlegroups.com.
>> Visit this group at https://groups.google.com/group/django-users.
>> To view this discussion on the web visit https://groups.google.com/d/
>> msgid/django-users/CAPkbFbaHq8Mgz_ZLnmC1EWQmT7FodSbEaWnd7buTcRR8
>> 5aYTSg%40mail.gmail.com
>> <https://groups.google.com/d/msgid/django-users/CAPkbFbaHq8Mgz_ZLnmC1EWQmT7FodSbEaWnd7buTcRR85aYTSg%40mail.gmail.com?utm_medium=email&utm_source=footer>
>> .
>> For more options, visit https://groups.google.com/d/optout.
>>
> --
> You received this message because you are subscribed to the Google Groups
> "Django users" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to django-users+unsubscr...@googlegroups.com.
> To post to this group, send email to django-users@googlegroups.com.
> Visit this group at https://groups.google.com/group/django-users.
> To view this discussion on the web visit https://groups.google.com/d/
> msgid/django-users/CAL8_rkHSc6Y64G_vNqmyFmTj_Nw0%
> 2BROKrvnED-c%3D3A6WbGJHjA%40mail.gmail.com
> <https://groups.google.com/d/msgid/django-users/CAL8_rkHSc6Y64G_vNqmyFmTj_Nw0%2BROKrvnED-c%3D3A6WbGJHjA%40mail.gmail.com?utm_medium=email&utm_source=footer>
> .
> For more options, visit https://groups.google.com/d/optout.
>

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-users+unsubscr...@googlegroups.com.
To post to this group, send email to django-users@googlegroups.com.
Visit this group at https://groups.google.com/group/django-users.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/CAPkbFbY9KseO4qap7eqcTchKLDNXGs93YJB6FP8g_riBRCQ63g%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to