Skip to content

Commit

Permalink
Rename current_product to subscription
Browse files Browse the repository at this point in the history
  • Loading branch information
Ivan committed Feb 28, 2023
1 parent 093c178 commit de78d24
Show file tree
Hide file tree
Showing 4 changed files with 28 additions and 4 deletions.
6 changes: 6 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,12 @@ All notable changes to this project will be documented in this file.

This project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).

## [0.0.10] - 2023-02-28

### Improved

- Database relations [@AivGitHub](https://github.com/AivGitHub/).

## [0.0.9] - 2023-02-28

### Added
Expand Down
2 changes: 1 addition & 1 deletion accounts/admin.py
Original file line number Diff line number Diff line change
Expand Up @@ -103,7 +103,7 @@ class UserAdmin(admin.ModelAdmin):
_('Products'),
{
'fields': (
'current_product',
'subscription',
)
}
),
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
# Generated by Django 4.1.3 on 2023-02-28 18:44

from django.db import migrations


class Migration(migrations.Migration):

dependencies = [
('accounts', '0007_rename_product_subscription'),
]

operations = [
migrations.RenameField(
model_name='user',
old_name='current_product',
new_name='subscription',
),
]
6 changes: 3 additions & 3 deletions accounts/models.py
Original file line number Diff line number Diff line change
Expand Up @@ -89,7 +89,7 @@ class User(AbstractBaseUser, PermissionsMixin):
null=True,
blank=True
)
current_product = models.ForeignKey(
subscription = models.ForeignKey(
'accounts.Subscription',
related_name='clients',
null=True,
Expand Down Expand Up @@ -539,7 +539,7 @@ class ProductBase(models.Model):
)

def get_internal_info(self, user: User):
is_available = user.current_product != self
is_available = user.subscription != self

if not is_available:
return {
Expand Down Expand Up @@ -600,6 +600,6 @@ def configure_user(self):
if self.status != PaymentStatus.CONFIRMED:
return

self.client.current_product = self.product
self.client.subscription = self.product

self.client.save()

0 comments on commit de78d24

Please sign in to comment.