Opened 18 years ago
Closed 17 years ago
#3638 closed (invalid)
loading python fixtures is broken
Reported by: | donlaverty | Owned by: | nobody |
---|---|---|---|
Component: | Testing framework | Version: | dev |
Severity: | Keywords: | fixture | |
Cc: | Triage Stage: | Accepted | |
Has patch: | no | Needs documentation: | no |
Needs tests: | no | Patch needs improvement: | no |
Easy pickings: | no | UI/UX: | no |
Description (last modified by )
Reproduce:
Use this fixture:
[{"pk": "1", "model": "main.category", "fields": {"link_name": "all", "name": "\/", "parent": null, "description": ""}}, {"pk": "2", "model": "main.category", "fields": {"link_name": "accessoires", "name": "Accessoires", "parent": 1, "description": ""}}, {"pk": "3", "model": "main.category", "fields": {"link_name": "art_and_design", "name": "Art & Design", "parent": 1, "description": ""}}]
with this model:
class Category(models.Model): class Admin: pass class Meta: ordering =['name'] name = models.CharField(maxlength=50) link_name = models.SlugField(unique=True) description = models.TextField(blank=True) parent = models.ForeignKey('self',blank=True,null=True) def tree(self,tree=[]): tree.append( self ) children = self.category_set.all() child_tree = [] for c in children: if c.name != '/': c.tree(child_tree) if not child_tree == []: tree.append(child_tree) return tree def link(self): return str(self)[2:] def __str__(self): if not self.parent : return self.name return str(self.parent) + '/' + self.name
now try to load it via syncdb
(while you are at it you could clarify in the documentation that python fixtures need to carry the extension .python
Change History (5)
comment:1 by , 18 years ago
Component: | Core framework → Unit test system |
---|
comment:2 by , 18 years ago
comment:3 by , 18 years ago
Triage Stage: | Unreviewed → Accepted |
---|
comment:4 by , 18 years ago
Description: | modified (diff) |
---|
comment:5 by , 17 years ago
Resolution: | → invalid |
---|---|
Status: | new → closed |
This bug is invalid. The python serializer is not intended for general consumption. http://www.djangoproject.com/documentation/serialization/#serialization-formats
Note:
See TracTickets
for help on using tickets.
sorry, i ignored the wiki syntax - my ticket is barely readable - so once more:
Reproduce:
Use this fixture:
with this model:
now try to load it via syncdb
(while you are at it you could clarify in the documentation that python fixtures need to carry the extension .python