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 8660947
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 12, 20262026-06-12T16:22:54+00:00 2026-06-12T16:22:54+00:00

I am running a test on my new Django code. I have the following

  • 0

I am running a test on my new Django code. I have the following models:

class Places(models.Model):
    name = models.CharField(max_length=20)
    street = models.CharField(max_length=50)
    number = models.IntegerField()
    confirmed = models.BooleanField()
    notes = models.TextField()

    def __unicode__(self):
        return self.address

    class Meta:
        db_table = "Places" # to prevent the prefixes from being added on

When I do this in the manage.py shell I get the correct response :

from my_app.models import Places

Places.objects.get(name='home').confirmed

>>> True

When this same code is performed in the my app under a unittest (manage.py test myapp) I get the error:

Places matching query does not exist django

When I tried with PDB I found that Django is reading the database as being empty (an empty set) and not as storing any data.

I also tried RAW SQL in the code and that failed as well, but worked in shell.

I checked with the database in sql itself and the data exists. I performed the equivalent SQL code and it returns True as well.

Is this a bug in Django?

  • 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-06-12T16:22:55+00:00Added an answer on June 12, 2026 at 4:22 pm

    Unit tests are always executed against a new empty database. Have you created the data within the setup step of your test, or provided a data fixture?

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

Sidebar

Related Questions

Our team is willing to unit-test a new code written under a running project
I have following code: Capybara.register_driver :selenium do |app| driver = Capybara::Selenium::Driver.new(app, browser: :firefox, profile:
The following is the test code. namespace ConsoleApplication2 { class MyClass {} class Program
We get the following error when running at test: ContextSwitchDeadlock was detected Message: The
I am looking to implement a continuous unit test running system, something I have
I have the following error when running the page below: this.testpublic is not a
I have a quick question about Java synchronization. Please assume the following code: public
I have a quick question about Java synchronization. Please assume the following code: public
I'm running some test to prove a concept and i just wrote this code
I'm attempting to unit test some code using NUnit. I have a method: public

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.