Django

Code

Show
Ignore:
Timestamp:
04/28/08 06:51:16 (8 months ago)
Author:
mtredinnick
Message:

Added a test to demonstrate the remaining problem in #7095.

Only fails for MySQL (because they've made some interesting syntax choices).
Refs #7095.

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • django/trunk/tests/regressiontests/queries/models.py

    r7493 r7495  
    117117    class Meta: 
    118118        ordering = ['z'] 
     119 
     120# A model and custom default manager combination. 
     121class CustomManager(models.Manager): 
     122    def get_query_set(self): 
     123        return super(CustomManager, self).get_query_set().filter(public=True, 
     124                tag__name='t1') 
     125 
     126class ManagedModel(models.Model): 
     127    data = models.CharField(max_length=10) 
     128    tag = models.ForeignKey(Tag) 
     129    public = models.BooleanField(default=True) 
     130 
     131    objects = CustomManager() 
     132    normal_manager = models.Manager() 
     133 
     134    def __unicode__(self): 
     135        return self.data 
     136 
    119137 
    120138__test__ = {'API_TESTS':""" 
     
    678696[<Item: four>, <Item: one>, <Item: three>] 
    679697 
     698Bug #7095 
     699Updates that are filtered on the model being updated are somewhat tricky to get 
     700in MySQL. This exercises that case. 
     701>>> mm = ManagedModel.objects.create(data='mm1', tag=t1, public=True) 
     702>>> ManagedModel.objects.update(data='mm') 
     703 
    680704"""} 
    681705