Ticket #526: manipulator_test.2.diff

File manipulator_test.2.diff, 1.6 KB (added by nesh <nesh [at] studioquattro [dot] co [dot] yu>, 18 years ago)

some errors fixed

  • store/django/tests/modeltests/manipulators/models.py

     
    2121    def __str__(self):
    2222        return self.name
    2323
     24
     25class Message(models.Model):
     26    message = models.TextField()
     27    class Meta:
     28        pass
     29    class Admin:
     30        pass
     31
     32class Translation(models.Model):
     33    message = models.ForeignKey(Message, edit_inline=models.TABULAR)
     34    language = models.CharField(maxlength=10)
     35    translation = models.TextField(core=True)
     36   
     37    class Meta:
     38        unique_together = (('language', 'message',),)
     39    class Admin:
     40        pass
     41
     42class Message2(models.Model):
     43    message = models.TextField()
     44    class Meta:
     45        pass
     46    class Admin:
     47        pass
     48   
     49class Registry(models.Model):
     50    """ this model breaks Message """
     51    message = models.ForeignKey(Message2, edit_inline=True)
     52    obj = models.CharField(maxlength=255, core=True)
     53    field = models.CharField(maxlength=255)
     54   
     55    class Meta:
     56        unique_together = (('field', 'obj'),)
     57    class Admin:
     58        pass
     59
     60
    2461API_TESTS = """
    2562>>> from django.utils.datastructures import MultiValueDict
    2663
     
    88125<Album: Ultimate Ella>
    89126>>> a2.release_date
    90127datetime.date(2005, 2, 13)
     128
     129# Exception when using unique_together in edit_inline model -- ticket #526
     130>>> t = Message2.AddManipulator()
     131
     132# another problem, unique_together order is important, this fails when first field is not FK
     133>>> t = Message.AddManipulator()
    91134"""
Back to Top