Ticket #13864: 13864.tests.patch

File 13864.tests.patch, 1.3 KB (added by Gregor Müllegger, 14 years ago)

First tests that fail for the inherited model that is no proxy and has no custom fields specified.

  • tests/modeltests/force_insert_update/models.py

    === modified file 'tests/modeltests/force_insert_update/models.py'
     
    33automatic behaviour).
    44"""
    55from django.db import models, transaction, IntegrityError
     6from django.test import TestCase
    67
    78class Counter(models.Model):
    8     name = models.CharField(max_length = 10)
     9    name = models.CharField(max_length=10)
    910    value = models.IntegerField()
    1011
     12class ProxyCounter(Counter):
     13    class Meta:
     14        proxy = True
     15
     16class SubCounter(Counter):
     17    pass
     18
    1119class WithCustomPK(models.Model):
    1220    name = models.IntegerField(primary_key=True)
    1321    value = models.IntegerField()
    1422
     23class InheritanceTests(TestCase):
     24    def test_force_update_on_proxy_model(self):
     25        a = ProxyCounter(name="count", value=1)
     26        a.save()
     27        a.save(force_update=True)
     28
     29    def test_force_update_on_inherited_model_without_fields(self):
     30        '''
     31        Issue 13864: force_update fails on subclassed models, if they don't
     32        specify custom fields.
     33        '''
     34        a = SubCounter(name="count", value=1)
     35        a.save()
     36        a.save(force_update=True)
     37
    1538__test__ = {"API_TESTS": """
    1639>>> c = Counter.objects.create(name="one", value=1)
    1740
Back to Top