[image: Capture.PNG]



*I have used 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 developers  (Contributions to Django itself)" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-developers+unsubscr...@googlegroups.com.
To post to this group, send email to django-developers@googlegroups.com.
Visit this group at https://groups.google.com/group/django-developers.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-developers/3d809e27-2b27-4688-9993-c7c0729e7f79%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to