You can just create an object of type B as a child in object of type A. That is a relation of some sort.
You can then use a path query to find objects of type B inside the object of type A.
There's also the option of prefilling an Add view with GET values or POST to an Addview somewhere. You'll have to set allow_prefill_from_GET_request on the form somehow.
Or, add some javascript that will check the URL for ?key=value and set it in the browser.
Thanks. Actually, this would be the easies approach, I guess, but in this case I want to add items to the same folder due to some 'automatic numbering of ids'
Set allowed_content_types and filter_content_types on Type A to allow Type B. Also set global_allow=False on Type B.
Now you can add Type B objects only to Type A objects.
That is what I have done, and it works 'good enough'.
I also know how to pass the UID to the new added content, but I dont know how to 'set it'. I dont know if I am supposed to set the value or if I am supposed to set the widget value or something simlar. I was hoping for something like this
def updateFields(self):
#related_to = self.request.get('related_from')
#Changed field to text just to test
self.fields['related_item'] = 'ABC'
super(ActionItemsAddForm, self).updateField
I am not sure if that works with relations, might be wrong, but I think it is difficult to set a 'default' value, and the relationValue is an object that 'links both ways'.