thanks, do you know how i can create custom leaf nodes when using MPTT or 
treebeard?

My parent nodes should have connector types such as AND/OR but the child 
should not


On Tuesday, February 18, 2020 at 11:30:40 PM UTC-5, Simon Charette wrote:
>
> I suggest you have a look at the "Trees and Graph" section of the
> Django Packages website[0]. I've personally used MPTT and Treebeard
> in the past without too much trouble.
>
> You could also a field able to store composite data structures
> such as JSONField or even a dedicated PostgreSQL type[1] to efficiently 
> store
> such data.
>
> Cheers,
> Simon
>
> [0] https://djangopackages.org/grids/g/trees-and-graphs/
> [1] https://www.postgresql.org/docs/current/sql-createtype.html
>
> Le mardi 18 février 2020 18:13:39 UTC-5, test a écrit :
>>
>> Let's say I have:
>>
>> Calculator #1:
>> Expression: (True AND False) AND (True OR False)
>>
>> This expression should be a child of some calculator. 
>>
>> class Calculator(models.Model):
>> name = ...
>>
>> class Expression(models.Model):
>> parent = models.ForeignKey(Calculator)
>>
>> boolean = AND or OR
>>
>> sub_exp1 = models.ForeignKey(Expression)
>> sub_exp2 = models.ForeignKey(Expression)
>>
>>
>> When I query all the expressions for the Calculator #1, I should get all 
>> the subexpressions.
>>
>> 1 AND 2 5
>> 2 AND 3 4
>> 3 leaf node of True 
>> 4 lead node of False
>> 5 OR 6 7
>> 6 leaf node of True
>> 7 leaf node of False
>>
>> From this, I can quickly apply my parse tree.
>>
>> How would I display the base case/leaf nodes in my model? Also, is there 
>> a better way?
>>
>> Thanks, I would really appreciate any help
>>
>

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-users+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/75510047-05c3-4f66-ade8-f76c4866f249%40googlegroups.com.

Reply via email to