django-treebeard icon indicating copy to clipboard operation
django-treebeard copied to clipboard

I am having IntegrityError issues with a depth field in the MP_Node.

Open damilareonifade opened this issue 2 years ago • 4 comments

whenever I try to save on a table I get the error of depth cannot be null and I don't know why I keep getting this.. This is a schema of the model I am using it with class Courses(MP_Node): course_id = models.UUIDField(default=uuid.uuid4, editable=False) course_name = models.CharField(max_length=250, null=True) course_description = models.TextField(null=True) course_content = models.CharField(max_length=250, null=True) course_admin = models.ForeignKey( "CustomUser", on_delete=models.CASCADE, null=True, blank=True, related_name="course_admin", ) course_price = models.CharField(max_length=250, null=True, blank=True) created_at = models.DateTimeField(auto_now_add=True) updated_at = models.DateTimeField(auto_now=True)

objects = MP_NodeManager()

node_order_by = ["course_name"]

def __str__(self):
    return f"{self.course_name} + {self.course_admin}"

damilareonifade avatar Aug 03 '23 20:08 damilareonifade

I'm also seeing this issue and finding it tricky to figure out why. @damilareonifade did you manage to find a solution?

nickpolet avatar Nov 08 '23 16:11 nickpolet

i am also having the same issue

bickkysahani avatar Dec 27 '23 16:12 bickkysahani

@bickkysahand @nickpolet I am still having this same issue. I had to use django-mptt in my last application. Still worried on what this will give me now

damilareonifade avatar Jan 05 '24 00:01 damilareonifade

Issue still here. Is it possible no one replied for months. Can we expect an answer or just ditch treebeard from custom apps?

Using treebeard 4.7.1, did as stated in the docs but no luck. So please update the docs if we are all misusing it.

aacimov avatar Apr 12 '24 11:04 aacimov