Skip to content

adapt raw_query tests for QuerySet.raw_aggregate() #12

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

Closed
wants to merge 1 commit into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 13 additions & 0 deletions tests/raw_query/models.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
from django_mongodb.fields import ObjectIdAutoField
from django_mongodb.managers import MongoManager

from django.db import models

Expand All @@ -8,6 +9,8 @@ class Author(models.Model):
last_name = models.CharField(max_length=255)
dob = models.DateField()

objects = MongoManager()

def __init__(self, *args, **kwargs):
super().__init__(*args, **kwargs)
# Protect against annotations being passed to __init__ --
Expand All @@ -25,25 +28,35 @@ class Book(models.Model):
paperback = models.BooleanField(default=False)
opening_line = models.TextField()

objects = MongoManager()


class BookFkAsPk(models.Model):
book = models.ForeignKey(
Book, models.CASCADE, primary_key=True, db_column="not_the_default"
)

objects = MongoManager()


class Coffee(models.Model):
brand = models.CharField(max_length=255, db_column="name")
price = models.DecimalField(max_digits=10, decimal_places=2, default=0)

objects = MongoManager()


class MixedCaseIDColumn(models.Model):
id = ObjectIdAutoField(primary_key=True, db_column="MiXeD_CaSe_Id")

objects = MongoManager()


class Reviewer(models.Model):
reviewed = models.ManyToManyField(Book)

objects = MongoManager()


class FriendlyAuthor(Author):
pass
Loading
Loading