Ticket #7908: models.py

File models.py, 815 bytes (added by rock@…, 7 years ago)

a models.py file that fails during validation

Line 
1
2from django.db import models
3
4# Abstract base classes with related models
5#
6 
7class Post(models.Model): 
8        title = models.CharField(max_length=50) 
9   
10class Attachment(models.Model): 
11    post = models.ForeignKey(Post, related_name='attached_%(class)s_set') 
12    content = models.TextField() 
13
14    class Meta: 
15        abstract = True 
16 
17    def __unicode__(self): 
18        return self.content
19         
20class Comment(Attachment): 
21        is_spam = models.BooleanField() 
22         
23class Link(Attachment): 
24        url = models.URLField() 
25         
26# Now we create a model with a ForeignKeu=y of an abstract class
27
28class MyAttachment(models.Model):
29    mine = models.ForeignKey( Attachment )
30
31# This fails to validate due to an internal error in related.py (line 605)
32# fails in any recent trunk (i.e., rev 8506)
Back to Top