Discussion:
module 'django.db.models' has no attribute 'Foreignkey'
Avitab Ayan Sarmah
2018-11-20 16:57:00 UTC
Permalink
Hi everyone,

I have written a code in models.py inside my project folder. I have
completed my code and whenever i execute "python manage.py makemigrations
first_app", i get an error. The error is mentioned as "AttributeError:
module 'django.db.models' has no attribute 'Foreignkey'".

My code and my anaconda prompt error screenshot is attached below. Please
check my code and give a resolution.
--
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+***@googlegroups.com.
To post to this group, send email to django-***@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/78be7de9-f9c8-4501-a487-ad44e7824de9%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
matteo gassend (LanguageMatt)
2018-11-20 16:58:43 UTC
Permalink
the k in ForeignKey is Capitalized
Post by Avitab Ayan Sarmah
Hi everyone,
I have written a code in models.py inside my project folder. I have completed my code and whenever i execute "python manage.py makemigrations first_app", i get an error. The error is mentioned as "AttributeError: module 'django.db.models' has no attribute 'Foreignkey'".
My code and my anaconda prompt error screenshot is attached below. Please check my code and give a resolution.
--
You received this message because you are subscribed to the Google Groups "Django users" group.
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/78be7de9-f9c8-4501-a487-ad44e7824de9%40googlegroups.com.
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+***@googlegroups.com.
To post to this group, send email to django-***@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/977e3dac-20cc-43f7-8e99-113bcfd1c44d%40Spark.
For more options, visit https://groups.google.com/d/optout.
Avitab Ayan Sarmah
2018-11-20 17:32:22 UTC
Permalink
Hi matteo,

Now it is showing as:

File
"C:\Users\AVITABAYAN\Desktop\django_lectures\first_project\first_app\models.py",
line 11, in webpage
topic = models.ForeignKey(Topic)
TypeError: __init__() missing 1 required positional argument: 'on_delete'

Please check :)
Post by matteo gassend (LanguageMatt)
the k in ForeignKey is Capitalized
Hi everyone,
I have written a code in models.py inside my project folder. I have
completed my code and whenever i execute "python manage.py makemigrations
module 'django.db.models' has no attribute 'Foreignkey'".
My code and my anaconda prompt error screenshot is attached below. Please
check my code and give a resolution.
--
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
<javascript:>.
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/78be7de9-f9c8-4501-a487-ad44e7824de9%40googlegroups.com
<https://groups.google.com/d/msgid/django-users/78be7de9-f9c8-4501-a487-ad44e7824de9%40googlegroups.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+***@googlegroups.com.
To post to this group, send email to django-***@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/eb39fb67-22fe-4551-8603-9eac4cf65c7f%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
matteo gassend (LanguageMatt)
2018-11-20 17:35:25 UTC
Permalink
A ForeignKey requires an “on_delete” argument. This is the function(kinda) that will be called when you decide to delete an instance of said model.

You can see it being used on the Django official tutorial,
https://docs.djangoproject.com/en/dev/intro/tutorial02/#creating-models
Post by Avitab Ayan Sarmah
Hi matteo,
 File "C:\Users\AVITABAYAN\Desktop\django_lectures\first_project\first_app\models.py", line 11, in webpage
    topic = models.ForeignKey(Topic)
TypeError: __init__() missing 1 required positional argument: 'on_delete'
Please check :)
Post by matteo gassend (LanguageMatt)
the k in ForeignKey is Capitalized
Post by Avitab Ayan Sarmah
Hi everyone,
I have written a code in models.py inside my project folder. I have completed my code and whenever i execute "python manage.py makemigrations first_app", i get an error. The error is mentioned as "AttributeError: module 'django.db.models' has no attribute 'Foreignkey'".
My code and my anaconda prompt error screenshot is attached below. Please check my code and give a resolution.
--
You received this message because you are subscribed to the Google Groups "Django users" group.
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/78be7de9-f9c8-4501-a487-ad44e7824de9%40googlegroups.com.
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.
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/eb39fb67-22fe-4551-8603-9eac4cf65c7f%40googlegroups.com.
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+***@googlegroups.com.
To post to this group, send email to django-***@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/8b351f8e-a2ed-4403-900a-8bb47bbc8452%40Spark.
For more options, visit https://groups.google.com/d/optout.
Avitab Ayan Sarmah
2018-11-20 17:37:57 UTC
Permalink
Thanks for your support. I will check and fix it. Thanks

On 20-Nov-2018 11:06 PM, "matteo gassend (LanguageMatt)" <***@gmail.com>
wrote:

A ForeignKey requires an “on_delete” argument. This is the function(kinda)
that will be called when you decide to delete an instance of said model.

You can see it being used on the Django official tutorial,
https://docs.djangoproject.com/en/dev/intro/tutorial02/#creating-models
Il 20 nov 2018, 18:32 +0100, Avitab Ayan Sarmah <***@gmail.com>, ha
scritto:

Hi matteo,

Now it is showing as:

File
"C:\Users\AVITABAYAN\Desktop\django_lectures\first_project\first_app\models.py",
line 11, in webpage
topic = models.ForeignKey(Topic)
TypeError: __init__() missing 1 required positional argument: 'on_delete'

Please check :)

On Tuesday, November 20, 2018 at 10:29:26 PM UTC+5:30, matteo gassend
Post by matteo gassend (LanguageMatt)
the k in ForeignKey is Capitalized
Hi everyone,
I have written a code in models.py inside my project folder. I have
completed my code and whenever i execute "python manage.py makemigrations
module 'django.db.models' has no attribute 'Foreignkey'".
My code and my anaconda prompt error screenshot is attached below. Please
check my code and give a resolution.
--
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
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/78be7de9-f9c8-4501-a487-ad44e7824de9%40googlegroups.com
<https://groups.google.com/d/msgid/django-users/78be7de9-f9c8-4501-a487-ad44e7824de9%40googlegroups.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+***@googlegroups.com.

To post to this group, send email to django-***@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/eb39fb67-22fe-4551-8603-9eac4cf65c7f%40googlegroups.com
<https://groups.google.com/d/msgid/django-users/eb39fb67-22fe-4551-8603-9eac4cf65c7f%40googlegroups.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 a topic in the
Google Groups "Django users" group.
To unsubscribe from this topic, visit
https://groups.google.com/d/topic/django-users/XXBDDSFsqIw/unsubscribe.
To unsubscribe from this group and all its topics, send an email to
django-users+***@googlegroups.com.
To post to this group, send email to django-***@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/8b351f8e-a2ed-4403-900a-8bb47bbc8452%40Spark
<https://groups.google.com/d/msgid/django-users/8b351f8e-a2ed-4403-900a-8bb47bbc8452%40Spark?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+***@googlegroups.com.
To post to this group, send email to django-***@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/CAEx5wm70iveaT30ciZJk_H8_wC_YskgnQUiqJL0pK6fczQVT9w%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.
matteo gassend (LanguageMatt)
2018-11-20 17:38:55 UTC
Permalink
no problem
Post by Avitab Ayan Sarmah
Thanks for your support. I will check and fix it. Thanks
Post by matteo gassend (LanguageMatt)
A ForeignKey requires an “on_delete” argument. This is the function(kinda) that will be called when you decide to delete an instance of said model.
You can see it being used on the Django official tutorial,
https://docs.djangoproject.com/en/dev/intro/tutorial02/#creating-models
Post by Avitab Ayan Sarmah
Hi matteo,
 File "C:\Users\AVITABAYAN\Desktop\django_lectures\first_project\first_app\models.py", line 11, in webpage
    topic = models.ForeignKey(Topic)
TypeError: __init__() missing 1 required positional argument: 'on_delete'
Please check :)
Post by matteo gassend (LanguageMatt)
the k in ForeignKey is Capitalized
Post by Avitab Ayan Sarmah
Hi everyone,
I have written a code in models.py inside my project folder. I have completed my code and whenever i execute "python manage.py makemigrations first_app", i get an error. The error is mentioned as "AttributeError: module 'django.db.models' has no attribute 'Foreignkey'".
My code and my anaconda prompt error screenshot is attached below. Please check my code and give a resolution.
--
You received this message because you are subscribed to the Google Groups "Django users" group.
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/78be7de9-f9c8-4501-a487-ad44e7824de9%40googlegroups.com.
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.
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/eb39fb67-22fe-4551-8603-9eac4cf65c7f%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
--
You received this message because you are subscribed to a topic in the Google Groups "Django users" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/django-users/XXBDDSFsqIw/unsubscribe.
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/8b351f8e-a2ed-4403-900a-8bb47bbc8452%40Spark.
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.
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/CAEx5wm70iveaT30ciZJk_H8_wC_YskgnQUiqJL0pK6fczQVT9w%40mail.gmail.com.
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+***@googlegroups.com.
To post to this group, send email to django-***@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/3d926d6d-9071-49f9-80b3-c90425aad6be%40Spark.
For more options, visit https://groups.google.com/d/optout.
Loading...