Yes, provided the migrations out put in the second mail
On Sat, 22 Sep 2018, 17:11 Matthew Pava, <Matthew.Pava@iss.com> wrote:
--Did you try running your migrations?
On Sat, Sep 22, 2018 at 5:07 AM -0500, "Srinivas Gadi" <srini.g03@gmail.com> wrote:
Adding more and complete details:I am facing below error while creating a new model class.the error pops up only at this line "user = models.OneToOneField(User)""E1120:No value for argument 'on_delete' in constructor call"
section/models.py
from django.db import models from django.contrib.auth.models import User class userProfile(models.Model): user = models.OneToOneField(User)
admin.py
from django.contrib import admin from section.models import userProfile admin.site.register(userProfile)
If I add below entry with "on_delete=models.CASCADE"
user = models.OneToOneField(User,on_delete=models.CASCADE)
the error got subsided but the new class "userProfile" is not appearing in admin page, under Users tab.
Also, run migrations:
C:\Users\srini\djangoProjects\college>python manage.py makemigrations No changes detected C:\Users\srini\djangoProjects\college>python manage.py migrate Operations to perform: Apply all migrations: admin, auth, contenttypes, sessions Running migrations: No migrations to apply.
Could someone please guide me how to fix this?
On Sat, Sep 22, 2018 at 2:40 PM Srinivas Gadi <srini.g03@gmail.com> wrote:
HI All,
I am facing below error while creating a new model class.the error pop up only at this line "user = models.OneToOneField(User)""E1120:No value for argument 'on_delete' in constructor call"
from django.db import modelsfrom django.contrib.auth.models import User
class userProfile(models.Model):user = models.OneToOneField(User)
--If I add "user = models.OneToOneField(User,on_delete=models.CASCADE)" the error got subsided but the new class "userProfile" is not appearing in admin page, under Users tab.
Could some one please guide me how to fix this ?
Srinivas .G
9966559383
--
Srinivas .G--
9966559383
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+unsubscribe@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/CAPC7spgQAR0e28KtZG4Ljt%3Dk4Su39qipvZJaRy4%3DCJbD6CTMCA%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+unsubscribe@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/D9BEB906A6B607A4.5302fd9d-847e-4878-88de-82caf2f9c69b%40mail.outlook.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+unsubscribe@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/CAPC7spiyJ5_kCtVfwpui2TALrQw-fpM7O40QucTryeX5qst7Og%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.
No comments:
Post a Comment