Gmail Calendar Documents Reader Web more »
Recently Visited Groups | Help | Sign in
Google Groups Home
need foreign key help quick
There are currently too many topics in this group that display first. To make this topic appear first, remove this option from another topic.
There was an error processing your request. Please try again.
flag
  4 messages - Collapse all  -  Translate all to Translated (View all originals)
The group you are posting to is a Usenet group. Messages posted to this group will make your email address visible to anyone on the Internet.
Your reply message has not been sent.
Your post was successful
 
From:
To:
Cc:
Followup To:
Add Cc | Add Followup-to | Edit Subject
Subject:
Validation:
For verification purposes please type the characters you see in the picture below or the numbers you hear by clicking the accessibility icon. Listen and type the numbers you hear
 
Bobby Roberts  
View profile  
 More options Nov 8, 12:39 pm
From: Bobby Roberts <tchend...@gmail.com>
Date: Sat, 7 Nov 2009 17:39:01 -0800 (PST)
Local: Sun, Nov 8 2009 12:39 pm
Subject: need foreign key help quick
Hi.  I have never used foreign keys.... I need to start and I need
help.  I'm running python2.5 and django1.1.   I have an installation
of Satchmo running fine; however, I need to modify the Product table.
I need to tie fields from the Product module to fields in another
module outside of satchmo.

here's the setup:

I have Satchmo products  installed here:

/django_apps/live/satchmo/products

I have another module installed here

/django_apps/live/elmago

I'm trying to add a dropbox field in products that is related to the
PK field in one of my elmago classes as follows:

    BinderCountry = models.ForeignKey('elmago.CountryOfOrigin',
verbose_name=_('Binder Country'), blank=False, null=False, help_text=_
("Please choose the country of origin for the binder."))

The elmago.CountryOfOrigin class looks like this:

class CountryOfOrigin (models.Model):
        Id = models.AutoField(primary_key=True)
        CountryName = models.CharField (max_length=250, blank=True,
db_index=True)
        DateAdded = models.DateTimeField (auto_now_add=True,
blank=False, db_index=True)

What am i doing wrong?  After restarting apache... i get the following
error:

AttributeError at /admin/product/product/add/

'str' object has no attribute '_default_manager'

Please help quickly!


    Reply    Reply to author    Forward  
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
Bobby Roberts  
View profile  
 More options Nov 9, 12:41 am
From: Bobby Roberts <tchend...@gmail.com>
Date: Sun, 8 Nov 2009 05:41:17 -0800 (PST)
Local: Mon, Nov 9 2009 12:41 am
Subject: Re: need foreign key help quick
anyone out there that can help me?

On Nov 7, 8:39 pm, Bobby Roberts <tchend...@gmail.com> wrote:


    Reply    Reply to author    Forward  
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
Rishabh Manocha  
View profile  
 More options Nov 9, 2:12 am
From: Rishabh Manocha <rmano...@gmail.com>
Date: Sun, 8 Nov 2009 23:12:20 +0800
Local: Mon, Nov 9 2009 2:12 am
Subject: Re: need foreign key help quick

You'll need to give us a more complete Traceback, but perhaps define a
__unicode__ function in CountryOfOrigin...

--

Best,

R


    Reply    Reply to author    Forward  
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
Karen Tracey  
View profile  
 More options Nov 9, 2:33 am
From: Karen Tracey <kmtra...@gmail.com>
Date: Sun, 8 Nov 2009 10:33:42 -0500
Local: Mon, Nov 9 2009 2:33 am
Subject: Re: need foreign key help quick

On Sat, Nov 7, 2009 at 8:39 PM, Bobby Roberts <tchend...@gmail.com> wrote:

> Hi.  I have never used foreign keys.... I need to start and I need
> help.  I'm running python2.5 and django1.1.   I have an installation
> of Satchmo running fine; however, I need to modify the Product table.
> I need to tie fields from the Product module to fields in another
> module outside of satchmo.

> here's the setup:

> [snip]

As Rishabh said, a complete traceback instead of just the error message
would help people help you.  You may be hitting:

http://code.djangoproject.com/ticket/10405

but it's hard to be sure without the traceback.

As an aside, what you are doing sounds a bit dodgy.  If I understand what
you are saying, you are adding a field to the Satchmo-provided Product
model?  After doing that you mention restarting Apache but don't say
anything about getting the change you have made to the model reflected in
the database.  If you have not done anything to get the new field added to
the database table as well, then even if you get past this error you are
going to run into trouble when any code tries to access that model, since in
the database it won't have the field you have added.

Have you tried asking on the Satchmo user's group for guidance on
accomplishing whatever you are looking to do without modifying their
provided models?  In general changing the models provided by an external
project seems like a bad idea.

Karen


    Reply    Reply to author    Forward  
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
End of messages
« Back to Discussions « Newer topic     Older topic »

Create a group - Google Groups - Google Home - Terms of Service - Privacy Policy
©2009 Google