File tree 2 files changed +13
-1
lines changed
2 files changed +13
-1
lines changed Original file line number Diff line number Diff line change 16
16
17
17
########################################
18
18
# Benefit features abstract classes
19
- from sponsors .models .managers import BenefitFeatureQuerySet
19
+ from sponsors .models .managers import BenefitFeatureQuerySet , BenefitFeatureConfigurationQuerySet
20
20
21
21
22
22
########################################
@@ -307,11 +307,14 @@ class BenefitFeatureConfiguration(PolymorphicModel):
307
307
Base class for sponsorship benefits configuration.
308
308
"""
309
309
310
+ objects = BenefitFeatureQuerySet .as_manager ()
310
311
benefit = models .ForeignKey ("sponsors.SponsorshipBenefit" , on_delete = models .CASCADE )
312
+ non_polymorphic = models .Manager ()
311
313
312
314
class Meta :
313
315
verbose_name = "Benefit Feature Configuration"
314
316
verbose_name_plural = "Benefit Feature Configurations"
317
+ base_manager_name = 'non_polymorphic'
315
318
316
319
@property
317
320
def benefit_feature_class (self ):
Original file line number Diff line number Diff line change @@ -146,6 +146,15 @@ def provided_assets(self):
146
146
return self .instance_of (* provided_assets_classes ).select_related ("sponsor_benefit__sponsorship" )
147
147
148
148
149
+ class BenefitFeatureConfigurationQuerySet (PolymorphicQuerySet ):
150
+
151
+ def delete (self ):
152
+ if not self .polymorphic_disabled :
153
+ return self .non_polymorphic ().delete ()
154
+ else :
155
+ return super ().delete ()
156
+
157
+
149
158
class GenericAssetQuerySet (PolymorphicQuerySet ):
150
159
151
160
def all_assets (self ):
You can’t perform that action at this time.
0 commit comments