Skip to content

Commit

Permalink
fix: updates
Browse files Browse the repository at this point in the history
  • Loading branch information
adamstankiewicz committed Oct 31, 2024
1 parent ede4645 commit 9c9cf97
Show file tree
Hide file tree
Showing 4 changed files with 54 additions and 2 deletions.
1 change: 1 addition & 0 deletions license_manager/apps/subscriptions/admin.py
Original file line number Diff line number Diff line change
Expand Up @@ -410,6 +410,7 @@ class CustomSubscriptionExpirationMessagingAdmin(DjangoQLSearchMixin, admin.Mode
'has_custom_license_expiration_messaging',
)


@admin.register(CustomerAgreement)
class CustomerAgreementAdmin(admin.ModelAdmin):
form = CustomerAgreementAdminForm
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
# Generated by Django 4.2.16 on 2024-10-31 13:38

from django.db import migrations, models
import django.db.models.deletion


class Migration(migrations.Migration):

dependencies = [
('subscriptions', '0074_historicalcustomsubscriptionexpirationmessaging_and_more'),
]

operations = [
migrations.AlterField(
model_name='customsubscriptionexpirationmessaging',
name='customer_agreement',
field=models.OneToOneField(null=True, on_delete=django.db.models.deletion.CASCADE, related_name='custom_subscription_expiration_messaging', to='subscriptions.customeragreement'),
),
]
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
# Generated by Django 4.2.16 on 2024-10-31 13:44

from django.db import migrations, models
import django.db.models.deletion


class Migration(migrations.Migration):

dependencies = [
('subscriptions', '0075_alter_customsubscriptionexpirationmessaging_customer_agreement'),
]

operations = [
migrations.AlterField(
model_name='customsubscriptionexpirationmessaging',
name='customer_agreement',
field=models.OneToOneField(blank=True, null=True, on_delete=django.db.models.deletion.CASCADE, related_name='_custom_subscription_expiration_messaging', to='subscriptions.customeragreement'),
),
]
17 changes: 15 additions & 2 deletions license_manager/apps/subscriptions/models.py
Original file line number Diff line number Diff line change
Expand Up @@ -241,6 +241,16 @@ def auto_applicable_subscription(self):

return plan

@property
def custom_subscription_expiration_messaging(self):
"""
Returns the custom subscription expiration messaging associated with this customer agreement.
"""
try:
return self.custom_subscription_expiration_messaging
except CustomSubscriptionExpirationMessaging.DoesNotExist:
return None

class Meta:
verbose_name = _("Customer Agreement")
verbose_name_plural = _("Customer Agreements")
Expand Down Expand Up @@ -302,6 +312,7 @@ def __str__(self):
)
)


class CustomSubscriptionExpirationMessaging(models.Model):
"""
Custom subscription expiration messaging
Expand All @@ -310,8 +321,9 @@ class CustomSubscriptionExpirationMessaging(models.Model):
customer_agreement = models.OneToOneField(
CustomerAgreement,
on_delete=models.CASCADE,
null=False,
related_name='custom_subscription_expiration_messaging',
blank=True,
null=True,
related_name='_custom_subscription_expiration_messaging',
unique=True,
)

Expand Down Expand Up @@ -360,6 +372,7 @@ class CustomSubscriptionExpirationMessaging(models.Model):

history = HistoricalRecords()


class PlanType(models.Model):
"""
Stores top-level information related to available enterprise Subscription plan types.
Expand Down

0 comments on commit 9c9cf97

Please sign in to comment.