authentik.enterprise.providers.ssf.models
1from datetime import datetime 2from functools import cached_property 3from uuid import uuid4 4 5from cryptography.hazmat.primitives.asymmetric.types import PrivateKeyTypes 6from django.contrib.postgres.fields import ArrayField 7from django.db import models 8from django.templatetags.static import static 9from django.utils.timezone import now 10from django.utils.translation import gettext_lazy as _ 11from jwt import encode 12 13from authentik.core.models import BackchannelProvider, Token 14from authentik.crypto.models import CertificateKeyPair 15from authentik.lib.models import ( 16 CreatedUpdatedModel, 17 ExpiringModel, 18 InternallyManagedMixin, 19 SimpleThroughModel, 20) 21from authentik.lib.utils.time import timedelta_from_string, timedelta_string_validator 22from authentik.providers.oauth2.models import JWTAlgorithms, OAuth2Provider 23from authentik.tasks.models import TasksModel 24 25 26class EventTypes(models.TextChoices): 27 """SSF Event types supported by authentik""" 28 29 CAEP_SESSION_REVOKED = "https://schemas.openid.net/secevent/caep/event-type/session-revoked" 30 """https://openid.net/specs/openid-caep-1_0-final.html#section-3.1""" 31 CAEP_TOKEN_CLAIMS_CHANGE = ( 32 "https://schemas.openid.net/secevent/caep/event-type/token-claims-change" 33 ) 34 """https://openid.net/specs/openid-caep-1_0-final.html#section-3.2""" 35 CAEP_CREDENTIAL_CHANGE = "https://schemas.openid.net/secevent/caep/event-type/credential-change" 36 """https://openid.net/specs/openid-caep-1_0-final.html#section-3.3""" 37 CAEP_ASSURANCE_LEVEL_CHANGE = ( 38 "https://schemas.openid.net/secevent/caep/event-type/assurance-level-change" 39 ) 40 """https://openid.net/specs/openid-caep-1_0-final.html#section-3.4""" 41 CAEP_DEVICE_COMPLIANCE_CHANGE = ( 42 "https://schemas.openid.net/secevent/caep/event-type/device-compliance-change" 43 ) 44 """https://openid.net/specs/openid-caep-1_0-final.html#section-3.5""" 45 CAEP_SESSION_ESTABLISHED = ( 46 "https://schemas.openid.net/secevent/caep/event-type/session-established" 47 ) 48 """https://openid.net/specs/openid-caep-1_0-final.html#section-3.6""" 49 CAEP_SESSION_PRESENTED = "https://schemas.openid.net/secevent/caep/event-type/session-presented" 50 """https://openid.net/specs/openid-caep-1_0-final.html#section-3.7""" 51 CAEP_RISK_LEVEL_CHANGE = "https://schemas.openid.net/secevent/caep/event-type/risk-level-change" 52 """https://openid.net/specs/openid-caep-1_0-final.html#section-3.8""" 53 SET_VERIFICATION = "https://schemas.openid.net/secevent/ssf/event-type/verification" 54 """https://openid.net/specs/openid-sharedsignals-framework-1_0.html#section-8.1.4.1""" 55 56 57class DeliveryMethods(models.TextChoices): 58 """SSF Delivery methods""" 59 60 RISC_PUSH = "https://schemas.openid.net/secevent/risc/delivery-method/push" 61 RISC_POLL = "https://schemas.openid.net/secevent/risc/delivery-method/poll" 62 RFC_PUSH = "urn:ietf:rfc:8935", _("SSF RFC Push") 63 RFC_PULL = "urn:ietf:rfc:8936", _("SSF RFC Pull") 64 65 66class SSFEventStatus(models.TextChoices): 67 """SSF Event status""" 68 69 PENDING_NEW = "pending_new" 70 PENDING_FAILED = "pending_failed" 71 SENT = "sent" 72 73 74class StreamStatus(models.TextChoices): 75 """SSF Stream status""" 76 77 ENABLED = "enabled" 78 PAUSED = "paused" 79 DISABLED = "disabled" 80 DISABLED_DELETED = "disabled_deleted" 81 82 83class SSFProvider(TasksModel, BackchannelProvider): 84 """Shared Signals Framework provider to allow applications to 85 receive user events from authentik.""" 86 87 signing_key = models.ForeignKey( 88 CertificateKeyPair, 89 verbose_name=_("Signing Key"), 90 on_delete=models.CASCADE, 91 help_text=_("Key used to sign the SSF Events."), 92 ) 93 94 push_verify_certificates = models.BooleanField(default=True) 95 96 oidc_auth_providers = models.ManyToManyField( 97 OAuth2Provider, blank=True, default=None, through="SSFProviderOIDCAuthProvider" 98 ) 99 100 token = models.ForeignKey(Token, on_delete=models.CASCADE, null=True, default=None) 101 102 event_retention = models.TextField( 103 default="days=30", 104 validators=[timedelta_string_validator], 105 ) 106 107 @cached_property 108 def jwt_key(self) -> tuple[PrivateKeyTypes, str]: 109 """Get either the configured certificate or the client secret""" 110 key: CertificateKeyPair = self.signing_key 111 private_key = key.private_key 112 return private_key, JWTAlgorithms.from_private_key(private_key) 113 114 @property 115 def service_account_identifier(self) -> str: 116 return f"ak-providers-ssf-{self.pk}" 117 118 @property 119 def serializer(self): 120 from authentik.enterprise.providers.ssf.api.providers import SSFProviderSerializer 121 122 return SSFProviderSerializer 123 124 @property 125 def icon_url(self) -> str | None: 126 return static("authentik/sources/ssf/light.svg") 127 128 @property 129 def component(self) -> str: 130 return "ak-provider-ssf-form" 131 132 class Meta: 133 verbose_name = _("Shared Signals Framework Provider") 134 verbose_name_plural = _("Shared Signals Framework Providers") 135 permissions = [ 136 # This overrides the default "add_stream" permission of the Stream object, 137 # as the user requesting to add a stream must have the permission on the provider 138 ("add_stream", _("Add stream to SSF provider")), 139 ] 140 141 142class SSFProviderOIDCAuthProvider(SimpleThroughModel): 143 ssf_provider = models.ForeignKey( 144 SSFProvider, on_delete=models.CASCADE, db_column="ssfprovider_id" 145 ) 146 oauth2_provider = models.ForeignKey( 147 OAuth2Provider, 148 on_delete=models.CASCADE, 149 db_column="oauth2provider_id", 150 ) 151 152 class Meta: 153 db_table = "authentik_providers_ssf_ssfprovider_oidc_auth_providers" 154 unique_together = (("ssf_provider", "oauth2_provider"),) 155 verbose_name = _("SSF Provider OIDC Auth Provider") 156 verbose_name_plural = _("SSF Provider OIDC Auth Providers") 157 158 def __str__(self): 159 return ( 160 f"SSFProviderOIDCAuthProvider for SSFProvider {self.ssf_provider_id} " 161 f"and OAuth2Provider {self.oauth2_provider_id}." 162 ) 163 164 165class Stream(models.Model): 166 """SSF Stream""" 167 168 uuid = models.UUIDField(default=uuid4, primary_key=True, editable=False) 169 170 status = models.TextField(choices=StreamStatus.choices, default=StreamStatus.ENABLED) 171 172 provider = models.ForeignKey(SSFProvider, on_delete=models.CASCADE) 173 174 delivery_method = models.TextField(choices=DeliveryMethods.choices) 175 endpoint_url = models.TextField(null=True) 176 authorization_header = models.TextField(null=True, default=None) 177 178 events_requested = ArrayField(models.TextField(choices=EventTypes.choices), default=list) 179 format = models.TextField() 180 aud = ArrayField(models.TextField(), default=list) 181 182 iss = models.TextField() 183 184 class Meta: 185 verbose_name = _("SSF Stream") 186 verbose_name_plural = _("SSF Streams") 187 default_permissions = ["change", "delete", "view"] 188 189 def __str__(self) -> str: 190 return "SSF Stream" 191 192 def prepare_event_payload(self, type: EventTypes, event_data: dict, **kwargs) -> dict: 193 jti = uuid4() 194 _now = now() 195 return { 196 "uuid": jti, 197 "stream_id": str(self.pk), 198 "type": type, 199 "expiring": True, 200 "status": SSFEventStatus.PENDING_NEW, 201 "expires": _now + timedelta_from_string(self.provider.event_retention), 202 "payload": { 203 "jti": jti.hex, 204 "aud": self.aud, 205 "iat": int(datetime.now().timestamp()), 206 "iss": self.iss, 207 "events": {type: event_data}, 208 **kwargs, 209 }, 210 } 211 212 def encode(self, data: dict) -> str: 213 headers = {"typ": "secevent+jwt"} 214 if self.provider.signing_key: 215 headers["kid"] = self.provider.signing_key.kid 216 key, alg = self.provider.jwt_key 217 return encode(data, key, algorithm=alg, headers=headers) 218 219 220class StreamEvent(InternallyManagedMixin, CreatedUpdatedModel, ExpiringModel): 221 """Single stream event to be sent""" 222 223 uuid = models.UUIDField(default=uuid4, primary_key=True, editable=False) 224 225 stream = models.ForeignKey(Stream, on_delete=models.CASCADE) 226 status = models.TextField(choices=SSFEventStatus.choices) 227 228 type = models.TextField(choices=EventTypes.choices) 229 payload = models.JSONField(default=dict) 230 231 def expire_action(self, *args, **kwargs): 232 """Only allow automatic cleanup of successfully sent event""" 233 if self.status != SSFEventStatus.SENT: 234 return 235 return super().expire_action(*args, **kwargs) 236 237 def __str__(self): 238 return f"Stream event {self.type}" 239 240 class Meta(ExpiringModel.Meta): 241 verbose_name = _("SSF Stream Event") 242 verbose_name_plural = _("SSF Stream Events") 243 ordering = ("-created",)
27class EventTypes(models.TextChoices): 28 """SSF Event types supported by authentik""" 29 30 CAEP_SESSION_REVOKED = "https://schemas.openid.net/secevent/caep/event-type/session-revoked" 31 """https://openid.net/specs/openid-caep-1_0-final.html#section-3.1""" 32 CAEP_TOKEN_CLAIMS_CHANGE = ( 33 "https://schemas.openid.net/secevent/caep/event-type/token-claims-change" 34 ) 35 """https://openid.net/specs/openid-caep-1_0-final.html#section-3.2""" 36 CAEP_CREDENTIAL_CHANGE = "https://schemas.openid.net/secevent/caep/event-type/credential-change" 37 """https://openid.net/specs/openid-caep-1_0-final.html#section-3.3""" 38 CAEP_ASSURANCE_LEVEL_CHANGE = ( 39 "https://schemas.openid.net/secevent/caep/event-type/assurance-level-change" 40 ) 41 """https://openid.net/specs/openid-caep-1_0-final.html#section-3.4""" 42 CAEP_DEVICE_COMPLIANCE_CHANGE = ( 43 "https://schemas.openid.net/secevent/caep/event-type/device-compliance-change" 44 ) 45 """https://openid.net/specs/openid-caep-1_0-final.html#section-3.5""" 46 CAEP_SESSION_ESTABLISHED = ( 47 "https://schemas.openid.net/secevent/caep/event-type/session-established" 48 ) 49 """https://openid.net/specs/openid-caep-1_0-final.html#section-3.6""" 50 CAEP_SESSION_PRESENTED = "https://schemas.openid.net/secevent/caep/event-type/session-presented" 51 """https://openid.net/specs/openid-caep-1_0-final.html#section-3.7""" 52 CAEP_RISK_LEVEL_CHANGE = "https://schemas.openid.net/secevent/caep/event-type/risk-level-change" 53 """https://openid.net/specs/openid-caep-1_0-final.html#section-3.8""" 54 SET_VERIFICATION = "https://schemas.openid.net/secevent/ssf/event-type/verification" 55 """https://openid.net/specs/openid-sharedsignals-framework-1_0.html#section-8.1.4.1"""
SSF Event types supported by authentik
58class DeliveryMethods(models.TextChoices): 59 """SSF Delivery methods""" 60 61 RISC_PUSH = "https://schemas.openid.net/secevent/risc/delivery-method/push" 62 RISC_POLL = "https://schemas.openid.net/secevent/risc/delivery-method/poll" 63 RFC_PUSH = "urn:ietf:rfc:8935", _("SSF RFC Push") 64 RFC_PULL = "urn:ietf:rfc:8936", _("SSF RFC Pull")
SSF Delivery methods
67class SSFEventStatus(models.TextChoices): 68 """SSF Event status""" 69 70 PENDING_NEW = "pending_new" 71 PENDING_FAILED = "pending_failed" 72 SENT = "sent"
SSF Event status
75class StreamStatus(models.TextChoices): 76 """SSF Stream status""" 77 78 ENABLED = "enabled" 79 PAUSED = "paused" 80 DISABLED = "disabled" 81 DISABLED_DELETED = "disabled_deleted"
SSF Stream status
84class SSFProvider(TasksModel, BackchannelProvider): 85 """Shared Signals Framework provider to allow applications to 86 receive user events from authentik.""" 87 88 signing_key = models.ForeignKey( 89 CertificateKeyPair, 90 verbose_name=_("Signing Key"), 91 on_delete=models.CASCADE, 92 help_text=_("Key used to sign the SSF Events."), 93 ) 94 95 push_verify_certificates = models.BooleanField(default=True) 96 97 oidc_auth_providers = models.ManyToManyField( 98 OAuth2Provider, blank=True, default=None, through="SSFProviderOIDCAuthProvider" 99 ) 100 101 token = models.ForeignKey(Token, on_delete=models.CASCADE, null=True, default=None) 102 103 event_retention = models.TextField( 104 default="days=30", 105 validators=[timedelta_string_validator], 106 ) 107 108 @cached_property 109 def jwt_key(self) -> tuple[PrivateKeyTypes, str]: 110 """Get either the configured certificate or the client secret""" 111 key: CertificateKeyPair = self.signing_key 112 private_key = key.private_key 113 return private_key, JWTAlgorithms.from_private_key(private_key) 114 115 @property 116 def service_account_identifier(self) -> str: 117 return f"ak-providers-ssf-{self.pk}" 118 119 @property 120 def serializer(self): 121 from authentik.enterprise.providers.ssf.api.providers import SSFProviderSerializer 122 123 return SSFProviderSerializer 124 125 @property 126 def icon_url(self) -> str | None: 127 return static("authentik/sources/ssf/light.svg") 128 129 @property 130 def component(self) -> str: 131 return "ak-provider-ssf-form" 132 133 class Meta: 134 verbose_name = _("Shared Signals Framework Provider") 135 verbose_name_plural = _("Shared Signals Framework Providers") 136 permissions = [ 137 # This overrides the default "add_stream" permission of the Stream object, 138 # as the user requesting to add a stream must have the permission on the provider 139 ("add_stream", _("Add stream to SSF provider")), 140 ]
Shared Signals Framework provider to allow applications to receive user events from authentik.
Accessor to the related object on the forward side of a many-to-one or one-to-one (via ForwardOneToOneDescriptor subclass) relation.
In the example::
class Child(Model):
parent = ForeignKey(Parent, related_name='children')
Child.parent is a ForwardManyToOneDescriptor instance.
A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.
Accessor to the related objects manager on the forward and reverse sides of a many-to-many relation.
In the example::
class Pizza(Model):
toppings = ManyToManyField(Topping, related_name='pizzas')
Pizza.toppings and Topping.pizzas are ManyToManyDescriptor
instances.
Most of the implementation is delegated to a dynamically defined manager
class built by create_forward_many_to_many_manager() defined below.
Accessor to the related object on the forward side of a many-to-one or one-to-one (via ForwardOneToOneDescriptor subclass) relation.
In the example::
class Child(Model):
parent = ForeignKey(Parent, related_name='children')
Child.parent is a ForwardManyToOneDescriptor instance.
A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.
108 @cached_property 109 def jwt_key(self) -> tuple[PrivateKeyTypes, str]: 110 """Get either the configured certificate or the client secret""" 111 key: CertificateKeyPair = self.signing_key 112 private_key = key.private_key 113 return private_key, JWTAlgorithms.from_private_key(private_key)
Get either the configured certificate or the client secret
119 @property 120 def serializer(self): 121 from authentik.enterprise.providers.ssf.api.providers import SSFProviderSerializer 122 123 return SSFProviderSerializer
Get serializer for this model
Accessor to the related objects manager on the one-to-many relation created by GenericRelation.
In the example::
class Post(Model):
comments = GenericRelation(Comment)
post.comments is a ReverseGenericManyToOneDescriptor instance.
Accessor to the related object on the forward side of a one-to-one relation.
In the example::
class Restaurant(Model):
place = OneToOneField(Place, related_name='restaurant')
Restaurant.place is a ForwardOneToOneDescriptor instance.
Accessor to the related objects manager on the reverse side of a many-to-one relation.
In the example::
class Child(Model):
parent = ForeignKey(Parent, related_name='children')
Parent.children is a ReverseManyToOneDescriptor instance.
Most of the implementation is delegated to a dynamically defined manager
class built by create_forward_many_to_many_manager() defined below.
Accessor to the related objects manager on the reverse side of a many-to-one relation.
In the example::
class Child(Model):
parent = ForeignKey(Parent, related_name='children')
Parent.children is a ReverseManyToOneDescriptor instance.
Most of the implementation is delegated to a dynamically defined manager
class built by create_forward_many_to_many_manager() defined below.
Inherited Members
- authentik.core.models.Provider
- name
- authentication_flow
- invalidation_flow
- property_mappings
- backchannel_application
- is_backchannel
- objects
- launch_url
- authentication_flow_id
- invalidation_flow_id
- backchannel_application_id
- id
- application
- providerpropertymapping_set
- outpost_set
- outpostprovider_set
- oauth2provider
- ldapprovider
- racprovider
- radiusprovider
- samlprovider
- scimprovider
- googleworkspaceprovider
- microsoftentraprovider
- ssfprovider
The requested object does not exist
The query returned multiple objects when only one was expected.
143class SSFProviderOIDCAuthProvider(SimpleThroughModel): 144 ssf_provider = models.ForeignKey( 145 SSFProvider, on_delete=models.CASCADE, db_column="ssfprovider_id" 146 ) 147 oauth2_provider = models.ForeignKey( 148 OAuth2Provider, 149 on_delete=models.CASCADE, 150 db_column="oauth2provider_id", 151 ) 152 153 class Meta: 154 db_table = "authentik_providers_ssf_ssfprovider_oidc_auth_providers" 155 unique_together = (("ssf_provider", "oauth2_provider"),) 156 verbose_name = _("SSF Provider OIDC Auth Provider") 157 verbose_name_plural = _("SSF Provider OIDC Auth Providers") 158 159 def __str__(self): 160 return ( 161 f"SSFProviderOIDCAuthProvider for SSFProvider {self.ssf_provider_id} " 162 f"and OAuth2Provider {self.oauth2_provider_id}." 163 )
SSFProviderOIDCAuthProvider(id, ssf_provider, oauth2_provider)
Accessor to the related object on the forward side of a many-to-one or one-to-one (via ForwardOneToOneDescriptor subclass) relation.
In the example::
class Child(Model):
parent = ForeignKey(Parent, related_name='children')
Child.parent is a ForwardManyToOneDescriptor instance.
Accessor to the related object on the forward side of a many-to-one or one-to-one (via ForwardOneToOneDescriptor subclass) relation.
In the example::
class Child(Model):
parent = ForeignKey(Parent, related_name='children')
Child.parent is a ForwardManyToOneDescriptor instance.
A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.
Inherited Members
The requested object does not exist
The query returned multiple objects when only one was expected.
166class Stream(models.Model): 167 """SSF Stream""" 168 169 uuid = models.UUIDField(default=uuid4, primary_key=True, editable=False) 170 171 status = models.TextField(choices=StreamStatus.choices, default=StreamStatus.ENABLED) 172 173 provider = models.ForeignKey(SSFProvider, on_delete=models.CASCADE) 174 175 delivery_method = models.TextField(choices=DeliveryMethods.choices) 176 endpoint_url = models.TextField(null=True) 177 authorization_header = models.TextField(null=True, default=None) 178 179 events_requested = ArrayField(models.TextField(choices=EventTypes.choices), default=list) 180 format = models.TextField() 181 aud = ArrayField(models.TextField(), default=list) 182 183 iss = models.TextField() 184 185 class Meta: 186 verbose_name = _("SSF Stream") 187 verbose_name_plural = _("SSF Streams") 188 default_permissions = ["change", "delete", "view"] 189 190 def __str__(self) -> str: 191 return "SSF Stream" 192 193 def prepare_event_payload(self, type: EventTypes, event_data: dict, **kwargs) -> dict: 194 jti = uuid4() 195 _now = now() 196 return { 197 "uuid": jti, 198 "stream_id": str(self.pk), 199 "type": type, 200 "expiring": True, 201 "status": SSFEventStatus.PENDING_NEW, 202 "expires": _now + timedelta_from_string(self.provider.event_retention), 203 "payload": { 204 "jti": jti.hex, 205 "aud": self.aud, 206 "iat": int(datetime.now().timestamp()), 207 "iss": self.iss, 208 "events": {type: event_data}, 209 **kwargs, 210 }, 211 } 212 213 def encode(self, data: dict) -> str: 214 headers = {"typ": "secevent+jwt"} 215 if self.provider.signing_key: 216 headers["kid"] = self.provider.signing_key.kid 217 key, alg = self.provider.jwt_key 218 return encode(data, key, algorithm=alg, headers=headers)
SSF Stream
A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.
A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.
Accessor to the related object on the forward side of a many-to-one or one-to-one (via ForwardOneToOneDescriptor subclass) relation.
In the example::
class Child(Model):
parent = ForeignKey(Parent, related_name='children')
Child.parent is a ForwardManyToOneDescriptor instance.
A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.
A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.
A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.
A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.
A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.
A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.
193 def prepare_event_payload(self, type: EventTypes, event_data: dict, **kwargs) -> dict: 194 jti = uuid4() 195 _now = now() 196 return { 197 "uuid": jti, 198 "stream_id": str(self.pk), 199 "type": type, 200 "expiring": True, 201 "status": SSFEventStatus.PENDING_NEW, 202 "expires": _now + timedelta_from_string(self.provider.event_retention), 203 "payload": { 204 "jti": jti.hex, 205 "aud": self.aud, 206 "iat": int(datetime.now().timestamp()), 207 "iss": self.iss, 208 "events": {type: event_data}, 209 **kwargs, 210 }, 211 }
Method descriptor with partial application of the given arguments and keywords.
Supports wrapping existing descriptors and handles non-descriptor callables as instance methods.
Method descriptor with partial application of the given arguments and keywords.
Supports wrapping existing descriptors and handles non-descriptor callables as instance methods.
Accessor to the related objects manager on the reverse side of a many-to-one relation.
In the example::
class Child(Model):
parent = ForeignKey(Parent, related_name='children')
Parent.children is a ReverseManyToOneDescriptor instance.
Most of the implementation is delegated to a dynamically defined manager
class built by create_forward_many_to_many_manager() defined below.
The requested object does not exist
The query returned multiple objects when only one was expected.
221class StreamEvent(InternallyManagedMixin, CreatedUpdatedModel, ExpiringModel): 222 """Single stream event to be sent""" 223 224 uuid = models.UUIDField(default=uuid4, primary_key=True, editable=False) 225 226 stream = models.ForeignKey(Stream, on_delete=models.CASCADE) 227 status = models.TextField(choices=SSFEventStatus.choices) 228 229 type = models.TextField(choices=EventTypes.choices) 230 payload = models.JSONField(default=dict) 231 232 def expire_action(self, *args, **kwargs): 233 """Only allow automatic cleanup of successfully sent event""" 234 if self.status != SSFEventStatus.SENT: 235 return 236 return super().expire_action(*args, **kwargs) 237 238 def __str__(self): 239 return f"Stream event {self.type}" 240 241 class Meta(ExpiringModel.Meta): 242 verbose_name = _("SSF Stream Event") 243 verbose_name_plural = _("SSF Stream Events") 244 ordering = ("-created",)
Single stream event to be sent
A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.
Accessor to the related object on the forward side of a many-to-one or one-to-one (via ForwardOneToOneDescriptor subclass) relation.
In the example::
class Child(Model):
parent = ForeignKey(Parent, related_name='children')
Child.parent is a ForwardManyToOneDescriptor instance.
A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.
A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.
A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.
232 def expire_action(self, *args, **kwargs): 233 """Only allow automatic cleanup of successfully sent event""" 234 if self.status != SSFEventStatus.SENT: 235 return 236 return super().expire_action(*args, **kwargs)
Only allow automatic cleanup of successfully sent event
A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.
A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.
A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.
A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.
Method descriptor with partial application of the given arguments and keywords.
Supports wrapping existing descriptors and handles non-descriptor callables as instance methods.
Method descriptor with partial application of the given arguments and keywords.
Supports wrapping existing descriptors and handles non-descriptor callables as instance methods.
Method descriptor with partial application of the given arguments and keywords.
Supports wrapping existing descriptors and handles non-descriptor callables as instance methods.
Method descriptor with partial application of the given arguments and keywords.
Supports wrapping existing descriptors and handles non-descriptor callables as instance methods.
Method descriptor with partial application of the given arguments and keywords.
Supports wrapping existing descriptors and handles non-descriptor callables as instance methods.
The requested object does not exist
The query returned multiple objects when only one was expected.