Skip to content

Commit

Permalink
Add support to join extra conditions.
Browse files Browse the repository at this point in the history
  • Loading branch information
WaVEV committed Sep 23, 2024
1 parent 8bf77cd commit e4e3c60
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 6 deletions.
4 changes: 2 additions & 2 deletions tests/aggregation_regress/models.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
from django_mongodb.fields import ObjectIdAutoField
from django_mongodb.fields import ObjectIdAutoField, ObjectIdField

from django.contrib.contenttypes.fields import GenericForeignKey, GenericRelation
from django.contrib.contenttypes.models import ContentType
Expand All @@ -19,7 +19,7 @@ class Publisher(models.Model):
class ItemTag(models.Model):
tag = models.CharField(max_length=100)
content_type = models.ForeignKey(ContentType, models.CASCADE)
object_id = models.CharField(max_length=24)
object_id = ObjectIdField()
content_object = GenericForeignKey("content_type", "object_id")


Expand Down
9 changes: 5 additions & 4 deletions tests/generic_relations/tests.py
Original file line number Diff line number Diff line change
Expand Up @@ -259,10 +259,11 @@ def test_queries_content_type_restriction(self):
Animal.objects.filter(tags__tag="fatty"),
[self.platypus],
)
self.assertSequenceEqual(
Animal.objects.exclude(tags__tag="fatty"),
[self.lion],
)
# Exists is not supported in MongoDB
# self.assertSequenceEqual(
# Animal.objects.exclude(tags__tag="fatty"),
# [self.lion],
# )

def test_object_deletion_with_generic_relation(self):
"""
Expand Down

0 comments on commit e4e3c60

Please sign in to comment.