I ran into this also in my initial run through the tutorial trying what
it suggested against my database. I ignored it at the time because I
wasn't really interested in administering things that way, and I
figured I had done something wrong. But this thread made me look at it
again. This is what I tried:
class Clues(models.Model):
ID = models.AutoField(primary_key=True)
EntryID = models.ForeignKey(Entries, db_column = 'Entry ID')
PuzzleID = models.ForeignKey(Puzzles, db_column = 'Puzzle ID',
edit_inline=models.STACKED, num_in_admin=3)
Clue = models.CharField(maxlength=150, core=True)
Num = models.IntegerField(null=True, blank=True)
Dir = models.CharField(maxlength=1)
class Meta:
ordering = ['Dir', 'Num']
db_table = verbose_name_plural = 'Clues'
def __str__(self):
return self.EntryID.Entry + ': ' + self.Clue
As soon as I put that edit_inline= parameter on the PuzzleID field any
attempt to change a Puzzle in admin would result in the server pegging
the cpu at 100% and slowly chomping up memory. (It happened to be time
to break for dinner when I first hit this so I just let it run and came
back about half an hour later to find it was at approx 1G virtual
memory size, the broswer still saying Loading....)
I went back and tried it again today (more confident that there isn't
anything essentially broken in my models) and got the same result.
Just for grins I tried commenting out the other ForeignKey field
(EntryID) and the problem went away. So at least for my example it's
got something to do with having a 2nd ForeignKey in the model. It's
not immediately obvious to this neophyte why that causes a problem but
I figured I'd post it here in case it could shed some light for others.
Cheers,
Karen
一首诗 wrote:
> ^C dose not help me.
>
> I think it's because django is multithreaded.
>
> But after I have inserted a lot of print in the codes, I found where
> the program stopped.
>
> django.db.models.QuerySet.__repr__
>
> called
>
> repr(self._get_data())
>
> And it stopped there. I will trace down to see what happenned tomorrow.
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups
"Django users" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at
http://groups.google.com/group/django-users
-~----------~----~----~----~------~----~------~--~---