#29951: Django Test Model objects creation does not get created in the right
table
(Postgres)
---------------------------------------------+------------------------
Reporter: jchao09 | Owner: nobody
Type: Bug | Status: new
Component: Testing framework | Version: 2.1
Severity: Normal | Keywords: test
Triage Stage: Unreviewed | Has patch: 0
Needs documentation: 0 | Needs tests: 0
Patch needs improvement: 0 | Easy pickings: 0
UI/UX: 0 |
---------------------------------------------+------------------------
I have a model that looks like
{{{
class PeopleBio(models.Model):
person_id = models.TextField()
bio = models.TextField()
class Meta:
managed = True # it's actually based on setting IS_TESTING,
which is set to True in this case
db_table = '"ppl"."ppl_bio"'
}}}
When running test, I insert the object
{{{
PeopleBio.objects.create(person_id="person1", bio='test')
}}}
when using `cursor.fetchall()` on `ppl.ppl_bio`, it returns nothing. I
used pdb to double check, and the test table indeed doesn't have anything
in it. The Model's `db_table` is indeed `ppl.ppl_bio`, and when doing
`PeopleBio.objects.all()`, it does return something.
All leads me to believe that the Model does not point to the right
Postgres table when running test.
--
Ticket URL: <https://code.djangoproject.com/ticket/29951>
Django <https://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 unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
To post to this group, send email to [email protected].
To view this discussion on the web visit
https://groups.google.com/d/msgid/django-updates/050.8e9ceb04844d30059188de99f121ba2b%40djangoproject.com.
For more options, visit https://groups.google.com/d/optout.