File tree Expand file tree Collapse file tree 1 file changed +22
-0
lines changed Expand file tree Collapse file tree 1 file changed +22
-0
lines changed Original file line number Diff line number Diff line change @@ -624,6 +624,28 @@ def _create_references(self):
624624 else :
625625 self ._referenced_by .append (referee )
626626
627+ field_type = referee .type
628+ is_list = field_type [:15 ] == "list:reference "
629+ if is_list :
630+ ref = field_type [15 :].strip ()
631+ else :
632+ ref = field_type [10 :].strip ()
633+
634+ if "." in ref :
635+ _ , throw_it , myfieldname = ref .partition ("." )
636+ if not hasattr (self , "_primarykey" ):
637+ raise SyntaxError (
638+ "keyed tables can only reference other keyed tables (for now)"
639+ )
640+ if myfieldname not in self .fields :
641+ raise SyntaxError (
642+ "invalid field '%s' for referenced table '%s'"
643+ " in table '%s'" % (myfieldname , self .name , referee .table .name )
644+ )
645+ referee .referent = self [myfieldname ]
646+ else :
647+ referee .referent = self ._id
648+
627649 def _filter_fields (self , record , allow_id = False , writable_only = False ):
628650 return dict (
629651 [
You can’t perform that action at this time.
0 commit comments