#13073: Duplicate rows when checking ID
---------------------------------------------------+------------------------
Reporter: jnadro52 | Owner: nobody
Status: reopened | Milestone:
Component: Database layer (models, ORM) | Version: 1.1
Resolution: | Keywords:
Stage: Unreviewed | Has_patch: 0
Needs_docs: 0 | Needs_tests: 0
Needs_better_patch: 0 |
---------------------------------------------------+------------------------
Changes (by jnadro52):
* status: closed => reopened
* resolution: worksforme =>
Comment:
I will try to provide more information to allow you to reproduce this bug.
I'm surprised that I am seeing this behavior and you are not, as it seems
to be very simple case. This is apparent for me in Django 1.1 Final.
Models:
{{{
class Team(models.Model):
name = models.CharField(max_length=255, help_text='Team Name')
class Matchup(models.Model, PlayPickObject):
league = models.ForeignKey('SportBettingApp.League',
help_text='Matchup\'s League')
class TeamVsTeamStatCache(models.Model):
snapshotDate = models.DateTimeField(help_text='The date this cache
is for')
matchup = models.ForeignKey('SportBettingApp.Matchup',
help_text='The matchup object this cache refers to', null=True,
default=None)
team = models.ForeignKey(Team, help_text='Team these stats refer
to', editable=False)
opponent = models.ForeignKey(Team,related_name='opponent',
help_text='The opponent team this team is playing', editable=False)
}}}
Output:
{{{
2> import SportBettingApp.models
3> sMod = SportBettingApp.models
4> tvt = sMod.TeamVsTeamStatCache
5> caches = tvt.objects.filter(matchup=9598)
6> caches[0].id
<6> 2
7> caches[1].id
<7> 2
}}}
As you can see, this is a very simple model structure. If you are curious
about the PlayPickObject that Matchup inherits from, let me know. This is
not a Model class, so it should have no bearing on the ORM features, it
only adds some methods and properties.
I am reopening this, I hope you don't mind, I just don't want it to fall
to the wayside. Thanks.
--
Ticket URL: <http://code.djangoproject.com/ticket/13073#comment:2>
Django <http://code.djangoproject.com/>
The Web framework for perfectionists with deadlines.
--
You received this message because you are subscribed to the Google Groups
"Django updates" 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-updates?hl=en.