Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Stored objects are always returned as (None) #508

Open
nicolaischneider opened this issue Dec 18, 2020 · 0 comments
Open

Stored objects are always returned as (None) #508

nicolaischneider opened this issue Dec 18, 2020 · 0 comments

Comments

@nicolaischneider
Copy link

One line description of the issue

When I store any object in my database and retrieve it again afterwards it's always returned as (None). However, when I check out the actual database using MonoDB Compass I can see all objects the way I saved them.

My Script:
OS = MacOS 11.0.1
Python==3.8.2
Django==3.0.5
djongo==1.3.3
pymongo==3.11.2
MongoDB 4.4 Community Edition

# database setting
DATABASES = {
    'default': {
        'ENGINE': 'djongo',
        'NAME': 'martini',
        'ENFORCE_SCHEMA': False,
        'LOGGING': {
            'version': 1,
            'loggers': {
                'djongo': {
                    'level': 'DEBUG',
                    'propagate': False,                        
                }
            },    
        },
    }
}

# my model
class Transaction(models.Model):
    transaction_type = models.CharField(max_length=10,default="")
    traded_player_id = models.CharField(max_length=10,default="")
    traded_player_name = models.CharField(max_length=30,default="")
    value = models.IntegerField(default=-1)

# storing the model
transaction = Transaction(
    transaction_type="SALE",
    traded_player_id="2839",
    traded_player_name="Grill",
    value=499700
)
transaction.save()

Issue

Checking out the shell in-code or using django's shell I receive the following result:

>>>Transaction.objects.filter()
<QuerySet [<Transaction: Transaction object (None)>, <Transaction: Transaction object (None)>, <Transaction: Transaction object (None)>]>

However when I take a look at the database in MongoDB Compass:
Screenshot 2020-12-18 at 16 19 37

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant