﻿id	summary	reporter	owner	description	type	status	component	version	severity	resolution	keywords	cc	stage	has_patch	needs_docs	needs_tests	needs_better_patch	easy	ui_ux
3638	loading python fixtures is broken	donlaverty	nobody	"Reproduce:
Use  this fixture:

{{{
#!python
[{""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:
{{{
#!python

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"		closed	Testing framework	dev		invalid	fixture		Accepted	0	0	0	0	0	0
