1919"""
2020
2121
22+ class StandinMeta :
23+ def __init__ (self , ct : models .Model , abstract = False ):
24+ self .service = ct .service
25+ self .model_name = ct .model
26+ self .app_label = ct .app_label
27+ self .abstract = abstract
28+
29+
2230class RemoteObject :
2331 """Placeholder for objects that live in another project."""
2432
2533 def __init__ (self , content_type : models .Model , object_id : Union [int , str ]):
2634 self .content_type = content_type
2735 self .object_id = object_id
36+ self ._meta = StandinMeta (content_type , abstract = True )
2837
2938 def __repr__ (self ):
3039 return f"<RemoteObject { self .content_type } id={ self .object_id } >"
@@ -48,6 +57,10 @@ def access_ids_qs(cls, actor, codename: str = 'view', content_types=None, cast_f
4857
4958 return remote_obj_id_qs (actor , remote_cls = cls , codename = codename , content_types = content_types , cast_field = cast_field )
5059
60+ @property
61+ def pk (self ):
62+ return self .object_id
63+
5164
5265def get_remote_base_class () -> Type [RemoteObject ]:
5366 """Return the class which represents remote objects.
@@ -120,12 +133,6 @@ def get_remote_standin_class(content_type: models.Model) -> Type:
120133 base = get_remote_base_class ()
121134 name = f"Remote[{ content_type .service } :{ content_type .app_label } .{ content_type .model } ]"
122135
123- class StandinMeta :
124- def __init__ (self , ct : models .Model ):
125- self .service = ct .service
126- self .model_name = ct .model
127- self .app_label = ct .app_label
128-
129136 standin = type (
130137 name ,
131138 (base ,),
0 commit comments