hello please first chak the value which you wants to insert you django server didn't get the foreign key which you had diffiend so this is the value error according to me
On Mon 8 Jul, 2019, 1:21 AM Aayush Bhattarai, <bhattaraiaayus...@gmail.com> wrote: > [image: Capture.PNG] > > > *I have used a function-based View to get data from post Request. I need > to get many data that also include a primary key field too. I need to push > data into two models. While doing so, I encountered an error.* > > #accounts models.py > from django.db import models > class User(models.Model): > user_id = models.PositiveIntegerField(blank=True) > > name = models.CharField(max_length=200) > phone = models.CharField(max_length=200) > email = models.EmailField(max_length=254) > > #app models.py > from accounts.models import User #from accounts models.py > class job(models.Model): > user = models.ForeignKey(User, on_delete=models.DO_NOTHING) > ...... > > #views.py > data = job(.....,map_link=map_link,user_id=user_id) > data.save() > info=User(name=name,email=email,phone=phone,user_id=user_id) > info.save() > > *Error Message: http://dpaste.com/03Z0EPB <http://dpaste.com/03Z0EPB>* > > -- > 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/9f083194-4a44-4f09-94d2-5479fed45ab5%40googlegroups.com > <https://groups.google.com/d/msgid/django-users/9f083194-4a44-4f09-94d2-5479fed45ab5%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+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/CAFYH2d6Z%2BMf9t_Y2rW%3D8koreBymDy7cfSUMrJznJN_%3DRFsA8_A%40mail.gmail.com. For more options, visit https://groups.google.com/d/optout.