Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7075785
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 28, 20262026-05-28T06:13:08+00:00 2026-05-28T06:13:08+00:00

My models.py : class Projects(models.Model): projectName =models.CharField(max_length = 100,unique=True,db_index=True) projectManager = models.ForeignKey(‘Users’) class Users(models.Model):

  • 0

My models.py :

class Projects(models.Model):
    projectName =models.CharField(max_length = 100,unique=True,db_index=True)
    projectManager = models.ForeignKey('Users')

class Users(models.Model):
    name = models.CharField(max_length = 100,unique=True)
    designation = models.CharField(max_length =100 )
    team = ListField(models.CharField(max_length =100),null=True)

Now I am trying creating a Projects class object with this code in shell:

user_object = Users.objects.get(name="abc")

p = Projects(projectName="xyz",projectManager = user_object)
p.save()

On p.save() it gives me error:

Traceback (most recent call last):
File "<console>", line 1, in <module>
File "/home/aprainfo/env/lib/python2.5/site-packages/Django-1.3.1-py2.5.egg/django/db/models/base.py", line 460, in save
    self.save_base(using=using, force_insert=force_insert, force_update=force_update)
File "/home/aprainfo/env/lib/python2.5/site-packages/Django-1.3.1-py2.5.egg/django/db/models/base.py", line 543, in save_base
    for f in meta.local_fields if not isinstance(f, AutoField)]
File "/home/aprainfo/env/lib/python2.5/site-packages/Django-1.3.1-py2.5.egg/django/db/models/fields/subclassing.py", line 28, in inner
    return func(*args, **kwargs)
File "/home/aprainfo/env/lib/python2.5/site-packages/Django-1.3.1-py2.5.egg/django/db/models/fields/related.py", line 876, in get_db_prep_save
    connection=connection)
File "/home/aprainfo/env/lib/python2.5/site-packages/Django-1.3.1-py2.5.egg/django/db/models/fields/subclassing.py", line 28, in inner
    return func(*args, **kwargs)
File "/home/aprainfo/env/lib/python2.5/site-packages/Django-1.3.1-py2.5.egg/django/db/models/fields/subclassing.py", line 28, in inner
    return func(*args, **kwargs)
File "/home/aprainfo/env/lib/python2.5/site-packages/Django-1.3.1-py2.5.egg/django/db/models/fields/__init__.py", line 276, in get_db_prep_save
    return self.get_db_prep_value(value, connection=connection, prepared=False)
File "/home/aprainfo/env/lib/python2.5/site-packages/Django-1.3.1-py2.5.egg/django/db/models/fields/subclassing.py", line 53, in inner
    return func(*args, **kwargs)
File "/home/aprainfo/env/lib/python2.5/site-packages/Django-1.3.1-py2.5.egg/django/db/models/fields/subclassing.py", line 53, in inner
    return func(*args, **kwargs)
File "/home/aprainfo/env/lib/python2.5/site-packages/Django-1.3.1-py2.5.egg/django/db/models/fields/__init__.py", line 271, in get_db_prep_value
    value = self.get_prep_value(value)
File "/home/aprainfo/env/lib/python2.5/site-packages/Django-1.3.1-py2.5.egg/django/db/models/fields/__init__.py", line 479, in get_prep_value
    return int(value) ValueError: invalid literal for int() with base 10: '4f1116115fcff377b2000001'

I dont know why its trying to convert string into int in last line.I dont know how to get rid of this error?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-28T06:13:09+00:00Added an answer on May 28, 2026 at 6:13 am

    Your problem is most likely with the installation of django non-rel and mongodb-engine. Standard django expects all ids to be integers whereas the suite of packages that make up django non-rel change that to allow the string-based id that mongodb uses.

    I would suggest reinstalling your set up following the order defined on http://django-mongodb.org/topics/setup.html

    I had this same issue and it was a matter of the installation possibly using the standard django instead of the non-rel one.

    My pip requirements.txt has these entries:

    git+git://github.com/django-nonrel/mongodb-engine.git@master
    git+git://github.com/django-nonrel/django-nonrel.git@master
    git+git://github.com/django-nonrel/django-permission-backend-nonrel.git@master
    

    And then I would be able to do: pip install -U -r requirements.txt

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have these models: class Projects(models.Model): projectName =models.CharField(max_length = 100,unique=True,db_index=True) projectManager = EmbeddedModelField('Users') class
Given the following model: class Project(models.Model): project_name = models.CharField(max_length=255) abstract = models.TextField(blank=True, null=True) full_description
Given a class: from django.db import models class Person(models.Model): name = models.CharField(max_length=20) Is it
This is my models.py from django.db import models class School(models.Model): school = models.CharField(max_length=300) def
I have the models: class Project(models.Model): title = models.CharField(max_length=75) description = models.CharField(max_length=250) ... class
I have a Project model similar to: class Project(models.Model): ... lead_analyst=models.ForeignKey(User, related_name='lead_analyst') ... I
class Project(models.Model): categories = models.ManyToManyField(Category) class Category(models.Model): name = models.CharField() now, i make some
/mysite/project4 class notes(models.Model): created_by = models.ForeignKey(User) detail = models.ForeignKey(Details) Details and User are in
Example models: class Parent(models.Model): name = models.CharField() def __unicode__(self): return self.name class Child(models.Model): parent
I have a model: class Cost(models.Model): project = models.ForeignKey(Project) cost = models.FloatField() date =

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.